[PATCH v3 5/5] pmic: qcom: dont use dev_read_addr to get USID

Sumit Garg sumit.garg at linaro.org
Fri Nov 17 11:33:54 CET 2023


On Tue, 14 Nov 2023 at 19:18, Caleb Connolly <caleb.connolly at linaro.org> wrote:
>
> Linux DTs stuff a value indicating if the USID is a USID or a GSID in the
> reg property, the Linux SPMI driver then reads the two address cells
> separately. U-boot's dev_read_addr() doesn't know how to handle this, so
> use ofnode_read_u32_index() to get just the USID.
>
> The Qcom pmic driver doesn't have support for GSID handling, so just
> ignore the second value for now.
>

Since you are trying to add Linux DT bindings compatibility here, I
suggest you drop custom u-boot binding here:
doc/device-tree-bindings/pmic/qcom,spmi-pmic.txt.

-Sumit

> Signed-off-by: Caleb Connolly <caleb.connolly at linaro.org>
> ---
>  drivers/power/pmic/pmic_qcom.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/power/pmic/pmic_qcom.c b/drivers/power/pmic/pmic_qcom.c
> index ad8daf43f06f..f2ac6494811d 100644
> --- a/drivers/power/pmic/pmic_qcom.c
> +++ b/drivers/power/pmic/pmic_qcom.c
> @@ -66,12 +66,19 @@ static const struct udevice_id pmic_qcom_ids[] = {
>  static int pmic_qcom_probe(struct udevice *dev)
>  {
>         struct pmic_qcom_priv *priv = dev_get_priv(dev);
> +       int ret;
>
> -       priv->usid = dev_read_addr(dev);
> -
> -       if (priv->usid == FDT_ADDR_T_NONE)
> +       /*
> +        * dev_read_addr() can't be used here because the reg property actually
> +        * contains two discrete values, not a single 64-bit address.
> +        * The address is the first value.
> +        */
> +       ret = ofnode_read_u32_index(dev_ofnode(dev), "reg", 0, &priv->usid);
> +       if (ret < 0)
>                 return -EINVAL;
>
> +       debug("usid: %d\n", priv->usid);
> +
>         return 0;
>  }
>
>
> --
> 2.42.1
>


More information about the U-Boot mailing list