[U-Boot] [PATCH] core: device: support multiple power domains for one device

Simon Glass sjg at chromium.org
Mon Sep 16 17:25:00 UTC 2019


Hi Peng,

On Mon, 2 Sep 2019 at 04:19, Peng Fan <peng.fan at nxp.com> wrote:
>
> When device has multiple power domains, power_domain_get could
> not able to support that. So let's iterate each power domain
> and enable it.
>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> ---
>  drivers/core/device.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/core/device.c b/drivers/core/device.c
> index 474c1642ee..67fcff87fa 100644
> --- a/drivers/core/device.c
> +++ b/drivers/core/device.c
> @@ -311,7 +311,7 @@ int device_probe(struct udevice *dev)
>         const struct driver *drv;
>         int size = 0;
>         int ret;
> -       int seq;
> +       int seq, i, count;
>
>         if (!dev)
>                 return -EINVAL;
> @@ -390,8 +390,16 @@ int device_probe(struct udevice *dev)
>
>         if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent &&
>             device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
> -               if (!power_domain_get(dev, &pd))
> -                       power_domain_on(&pd);
> +               count = dev_count_phandle_with_args(dev, "power-domains",
> +                                                   "#power-domain-cells");
> +               for (i = 0; i < count; i++) {
> +                       ret = power_domain_get_by_index(dev, &pd, i);
> +                       if (ret)
> +                               goto fail;
> +                       ret = power_domain_on(&pd);
> +                       if (ret)
> +                               goto fail;
> +               }

Can you please move this into a new function, perhaps in a new
drivers/core/power.c file?

>         }
>
>         ret = uclass_pre_probe_device(dev);
> --
> 2.16.4
>

Regards,
Simon


More information about the U-Boot mailing list