MLK-16118-3 core: Add power domain operation to device probe
authorYe Li <ye.li@nxp.com>
Wed, 2 Aug 2017 02:57:33 +0000 (21:57 -0500)
committerJason Liu <jason.hui.liu@nxp.com>
Thu, 2 Nov 2017 18:37:05 +0000 (02:37 +0800)
When power domain driver is enabled, power on the power domain
for the device be probed.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
drivers/core/device.c

index 70fcfc2..88be0fa 100644 (file)
@@ -24,6 +24,9 @@
 #include <dm/util.h>
 #include <linux/err.h>
 #include <linux/list.h>
+#ifdef CONFIG_POWER_DOMAIN
+#include <power-domain.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -345,6 +348,15 @@ int device_probe(struct udevice *dev)
        if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL)
                pinctrl_select_state(dev, "default");
 
+#ifdef CONFIG_POWER_DOMAIN
+       if (dev->parent && device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
+               struct power_domain pd;
+               if (!power_domain_get(dev, &pd)) {
+                       power_domain_on(&pd);
+               }
+       }
+#endif
+
        ret = uclass_pre_probe_device(dev);
        if (ret)
                goto fail;