MLK-20945-2 dm: device: Check the power up result in probe
authorYe Li <ye.li@nxp.com>
Tue, 19 Feb 2019 07:48:02 +0000 (23:48 -0800)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 11:28:18 +0000 (04:28 -0700)
If a device has relevant power domain, we will check the power up
result in probing the device. If the power up is failed, the device_probe
will return failure immediately.

The only exception is the new FLAG (DM_FLAG_IGNORE_POWER_ON) is set by driver
to indicate ignore the power up result.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 8524ca764d8fbd05da1593abfed62bb075c50cd4)

drivers/core/device.c
include/dm/device.h

index 24fa3ee..08a2761 100644 (file)
@@ -389,8 +389,15 @@ int device_probe(struct udevice *dev)
                pinctrl_select_state(dev, "default");
 
        if (dev->parent && device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
-               if (!power_domain_get(dev, &pd))
-                       power_domain_on(&pd);
+               if (!power_domain_get(dev, &pd)) {
+                       if (!(dev->driver->flags & DM_FLAG_IGNORE_POWER_ON)) {
+                               ret = power_domain_on(&pd);
+                               if (ret) {
+                                       power_domain_free(&pd);
+                                       goto fail;
+                               }
+                       }
+               }
        }
 
        ret = uclass_pre_probe_device(dev);
index fdf3889..f2b7c2a 100644 (file)
@@ -61,6 +61,9 @@ struct driver_info;
  */
 #define DM_FLAG_OS_PREPARE             (1 << 10)
 
+/* DM should ignore the power domain on for this driver */
+#define DM_FLAG_IGNORE_POWER_ON                (1 << 11)
+
 /* DM should ignore the assign default clocks for this driver */
 #define DM_FLAG_IGNORE_DEFAULT_CLKS            (1 << 12)