summaryrefslogtreecommitdiff
path: root/drivers/core/device.c
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2018-07-27 10:20:38 +0800
committerAnatolij Gustschin <agust@denx.de>2018-08-06 11:52:00 +0200
commit3ad3077848474d75f75cde31dc3eb80d075a4b82 (patch)
tree6986b014f44883bc2d998e584def0cb0ea67daf1 /drivers/core/device.c
parente13278c943913af1d11be8955418012bbbad913e (diff)
dm: core: device: enable power domain in probe
Enable power domain associated with the device when probe. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r--drivers/core/device.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c
index d5f5fc31b0..207d566b71 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -26,6 +26,7 @@
#include <dm/util.h>
#include <linux/err.h>
#include <linux/list.h>
+#include <power-domain.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -304,6 +305,7 @@ static void *alloc_priv(int size, uint flags)
int device_probe(struct udevice *dev)
{
+ struct power_domain pd;
const struct driver *drv;
int size = 0;
int ret;
@@ -383,6 +385,11 @@ int device_probe(struct udevice *dev)
if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL)
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);
+ }
+
ret = uclass_pre_probe_device(dev);
if (ret)
goto fail;