From: Peng Fan Date: Mon, 2 Sep 2019 10:19:44 +0000 Subject: [U-Boot] [PATCH] core: device: support multiple power domains for one device Message-ID: <20190902103602.4588-1-peng.fan@nxp.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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; + } } ret = uclass_pre_probe_device(dev); -- 2.16.4