[v3,2/7] misc: qcom: Add Qualcomm SPMI SDAM NVMEM driver

Simon Glass sjg at chromium.org
Tue Mar 31 21:51:56 CEST 2026


Hi Aswin,

On 2026-03-30T17:14:12, Aswin Murugan <aswin.murugan at oss.qualcomm.com> wrote:
> diff --git a/drivers/misc/qcom-spmi-sdam.c b/drivers/misc/qcom-spmi-sdam.c
> @@ -0,0 +1,200 @@
> +static int qcom_sdam_probe(struct udevice *dev)
> +{
> +     struct qcom_sdam_priv *priv = dev_get_priv(dev);
> +     int ret;
> +
> +     priv->base = dev_read_addr(dev);
> +     if (priv->base == FDT_ADDR_T_NONE) {

priv->base is u32 but dev_read_addr() returns fdt_addr_t, which is u64
on 64-bit platforms. When FDT_ADDR_T_NONE is truncated into a u32 and
then promoted back for the comparison, the check silently passes. I
suggest storing the result in a local fdt_addr_t, check it against
FDT_ADDR_T_NONE, and only then assign to priv->base

> diff --git a/drivers/misc/qcom-spmi-sdam.c b/drivers/misc/qcom-spmi-sdam.c
> @@ -0,0 +1,200 @@
> +     priv->size = dev_read_u32_default(dev, "qcom,sdam-size", SDAM_SIZE);

The upstream DT binding (qcom,spmi-sdam.yaml) does not define a
'qcom,sdam-size' property - the size is implied by 'ranges'. Is that
coming later? I suspect this should either parse the 'ranges' property
or just hardcode 0x100

> diff --git a/drivers/misc/qcom-spmi-sdam.c b/drivers/misc/qcom-spmi-sdam.c
> @@ -0,0 +1,200 @@
> +     dev_info(dev, "SDAM base=0x%x size=0x%x PMIC_USID=%d\n",
> +              priv->base, priv->size, priv->pmic_usid);

This is rather noisy for every boot. Please can you make this dev_dbg() instead.

Regards,
Simon


More information about the U-Boot mailing list