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

Peng Fan peng.fan at nxp.com
Mon Sep 2 10:19:44 UTC 2019


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;
+		}
 	}
 
 	ret = uclass_pre_probe_device(dev);
-- 
2.16.4



More information about the U-Boot mailing list