From: Ye Li Date: Tue, 19 Feb 2019 07:48:02 +0000 (-0800) Subject: MLK-20945-2 dm: device: Check the power up result in probe X-Git-Tag: rel_imx_4.19.35_1.1.0~576 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=f958ee4917eac68b2c46e1bdbaaf42c6a44e663d;p=u-boot.git MLK-20945-2 dm: device: Check the power up result in probe 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 (cherry picked from commit 8524ca764d8fbd05da1593abfed62bb075c50cd4) --- diff --git a/drivers/core/device.c b/drivers/core/device.c index 24fa3eeedb..08a2761d32 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -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); diff --git a/include/dm/device.h b/include/dm/device.h index fdf3889532..f2b7c2a816 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -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)