diff mbox series

[U-Boot,1/4] dm: core: Allow for not controlling the power-domain by DM framework

Message ID 20190927081815.19314-2-lokeshvutla@ti.com
State Accepted
Commit af94ad418dc72957d3b7398d83bfc5a1efd415db
Delegated to: Simon Glass
Headers show
Series dm: core: Add support for controlled power domain handling | expand

Commit Message

Lokesh Vutla Sept. 27, 2019, 8:18 a.m. UTC
In some remoteproc cases, enabling the power domain of the core will
start running the core. In such cases image should be loaded before
enabling the power domain. But the current DM framework enables the
power-domain by default during probe. This is causing the remotecore
to start and crash as there is no valid image loaded.

In order to avoid this introduce a DM flag that doesn't allow for
enabling/disabling the power-domain by DM framework.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/core/device.c | 3 ++-
 include/dm/device.h   | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Simon Glass Oct. 11, 2019, 10:21 p.m. UTC | #1
Hi Lokesh,

On Fri, 27 Sep 2019 at 02:19, Lokesh Vutla <lokeshvutla@ti.com> wrote:
>
> In some remoteproc cases, enabling the power domain of the core will
> start running the core. In such cases image should be loaded before
> enabling the power domain. But the current DM framework enables the
> power-domain by default during probe. This is causing the remotecore
> to start and crash as there is no valid image loaded.
>
> In order to avoid this introduce a DM flag that doesn't allow for
> enabling/disabling the power-domain by DM framework.
>
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> ---
>  drivers/core/device.c | 3 ++-
>  include/dm/device.h   | 3 +++
>  2 files changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass Oct. 12, 2019, 2:53 a.m. UTC | #2
Hi Lokesh,

On Fri, 27 Sep 2019 at 02:19, Lokesh Vutla <lokeshvutla@ti.com> wrote:
>
> In some remoteproc cases, enabling the power domain of the core will
> start running the core. In such cases image should be loaded before
> enabling the power domain. But the current DM framework enables the
> power-domain by default during probe. This is causing the remotecore
> to start and crash as there is no valid image loaded.
>
> In order to avoid this introduce a DM flag that doesn't allow for
> enabling/disabling the power-domain by DM framework.
>
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> ---
>  drivers/core/device.c | 3 ++-
>  include/dm/device.h   | 3 +++
>  2 files changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/drivers/core/device.c b/drivers/core/device.c
index f4d7140698..91f80edc8d 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -388,7 +388,8 @@  int device_probe(struct udevice *dev)
 		pinctrl_select_state(dev, "default");
 
 	if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent &&
-	    device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
+	    (device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) &&
+	    !(drv->flags & DM_FLAG_DEFAULT_PD_CTRL_OFF)) {
 		ret = dev_power_domain_on(dev);
 		if (ret)
 			goto fail;
diff --git a/include/dm/device.h b/include/dm/device.h
index 27a6d7b9fd..f51f9b71da 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 does not enable/disable the power domains corresponding to this device */
+#define DM_FLAG_DEFAULT_PD_CTRL_OFF	(1 << 11)
+
 /*
  * One or multiple of these flags are passed to device_remove() so that
  * a selective device removal as specified by the remove-stage and the