From f958ee4917eac68b2c46e1bdbaaf42c6a44e663d Mon Sep 17 00:00:00 2001 From: Ye Li Date: Mon, 18 Feb 2019 23:48:02 -0800 Subject: [PATCH] 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) --- drivers/core/device.c | 11 +++++++++-- include/dm/device.h | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) 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) -- 2.17.1