Skip to contentSkip to conversation

dm: core: Add a flag for power domain control on device removal

PATCH New Anatolij Gustschin 4 participants 9 messages Feb 17, 2020 – Mar 3, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dm: core: Add a flag for power domain control on device removal

In various cases a power domain must stay enabled after device removal when booting OS (i.e. serial debug console or display). Add a flag to selectively skip switching off a power domain.

Fixes 52edfed65de9 ("dm: core: device: switch off power domain after device removal")
---
 drivers/core/device-remove.c | 5 +++--
 include/dm/device.h          | 6 ++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/core/device-remove.c +3 -2
index 444e34b492..ff5b28cb6a 100644
@@ -194,8 +194,9 @@ int device_remove(struct udevice *dev, uint flags)
 		}
 	}
 
-	if (!(drv->flags & DM_FLAG_DEFAULT_PD_CTRL_OFF) &&
-	    (dev != gd->cur_serial_dev))
+	if (!(drv->flags &
+	      (DM_FLAG_DEFAULT_PD_CTRL_OFF | DM_FLAG_REMOVE_WITH_PD_ON)) &&
+	    dev != gd->cur_serial_dev)
 		dev_power_domain_off(dev);
 
 	if (flags_remove(flags, drv->flags)) {
include/dm/device.h +6 -0
index ab806d0b7e..a56164b19b 100644
@@ -67,6 +67,12 @@ struct driver_info;
 /* Driver platdata has been read. Cleared when the device is removed */
 #define DM_FLAG_PLATDATA_VALID		(1 << 12)
 
+/*
+ * Device is removed without switching off its power domain. This might
+ * be required, i. e. for serial console (debug) output when booting OS.
+ */
+#define DM_FLAG_REMOVE_WITH_PD_ON	(1 << 13)
+
 /*
  * 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
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 video: meson: keep power domain up after booting

Add driver flag to skip power domain disabling on device removal.

Fixes 52edfed65de9 ("dm: core: device: switch off power domain after device removal")
---
 drivers/video/meson/meson_vpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/meson/meson_vpu.c +1 -1
index 4eb66398d0..aa8c0a962f 100644
@@ -210,5 +210,5 @@ U_BOOT_DRIVER(meson_vpu) = {
 	.probe = meson_vpu_probe,
 	.bind = meson_vpu_bind,
 	.priv_auto_alloc_size = sizeof(struct meson_vpu_priv),
-	.flags  = DM_FLAG_PRE_RELOC,
+	.flags  = DM_FLAG_PRE_RELOC | DM_FLAG_REMOVE_WITH_PD_ON,
 };
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 video: meson: keep power domain up after booting

Quoted 14 lines · Anatolij Gustschin

Add driver flag to skip power domain disabling on device removal.

Fixes 52edfed65de9 ("dm: core: device: switch off power domain after device removal")
---
 drivers/video/meson/meson_vpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/meson/meson_vpu.c +0 -0
index 4eb66398d0..aa8c0a962f 100644

drivers/video/meson/meson_vpu.c U_BOOT_DRIVER(meson_vpu) = { · line 214

Quoted 6 lines
drivers/video/meson/meson_vpu.c +1 -1
@@ -210,5 +210,5 @@ U_BOOT_DRIVER(meson_vpu) = {
 	.probe = meson_vpu_probe,
 	.bind = meson_vpu_bind,
 	.priv_auto_alloc_size = sizeof(struct meson_vpu_priv),
-	.flags  = DM_FLAG_PRE_RELOC,
+	.flags  = DM_FLAG_PRE_RELOC | DM_FLAG_REMOVE_WITH_PD_ON,
 };

and

Thanks,
Neil

#3 lore raw

PATCH 2/2 video: meson: keep power domain up after booting

Quoted 8 lines · Anatolij Gustschin

Add driver flag to skip power domain disabling on device removal.

Fixes 52edfed65de9 ("dm: core: device: switch off power domain after device removal")
---
 drivers/video/meson/meson_vpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm, thanks!

#4 lore raw

PATCH 1/2 dm: core: Add a flag for power domain control on device removal

In reply to Anatolij Gustschin
Quoted 35 lines · Anatolij Gustschin

In various cases a power domain must stay enabled after device removal when booting OS (i.e. serial debug console or display). Add a flag to selectively skip switching off a power domain.

Fixes 52edfed65de9 ("dm: core: device: switch off power domain after device removal")
---
 drivers/core/device-remove.c | 5 +++--
 include/dm/device.h          | 6 ++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/core/device-remove.c +3 -2
index 444e34b492..ff5b28cb6a 100644
@@ -194,8 +194,9 @@ int device_remove(struct udevice *dev, uint flags)
 		}
 	}
 
-	if (!(drv->flags & DM_FLAG_DEFAULT_PD_CTRL_OFF) &&
-	    (dev != gd->cur_serial_dev))
+	if (!(drv->flags &
+	      (DM_FLAG_DEFAULT_PD_CTRL_OFF | DM_FLAG_REMOVE_WITH_PD_ON)) &&
+	    dev != gd->cur_serial_dev)
 		dev_power_domain_off(dev);
 
 	if (flags_remove(flags, drv->flags)) {
include/dm/device.h +0 -0
index ab806d0b7e..a56164b19b 100644
@@ -67,6 +67,12 @@ struct driver_info;
 /* Driver platdata has been read. Cleared when the device is removed */
 #define DM_FLAG_PLATDATA_VALID		(1 << 12)

include/dm/device.h struct driver_info; · line 78

Quoted 10 lines
include/dm/device.h +6 -0
 
+/*
+ * Device is removed without switching off its power domain. This might
+ * be required, i. e. for serial console (debug) output when booting OS.
+ */
+#define DM_FLAG_REMOVE_WITH_PD_ON	(1 << 13)
+
 /*
  * 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

and

Thanks,
Neil

#5 lore raw

PATCH 1/2 dm: core: Add a flag for power domain control on device removal

In reply to Anatolij Gustschin

Hi Anatolij,

Quoted 11 lines · Anatolij Gustschin

In various cases a power domain must stay enabled after device removal when booting OS (i.e. serial debug console or display). Add a flag to selectively skip switching off a power domain.

Fixes 52edfed65de9 ("dm: core: device: switch off power domain after device removal")
---
 drivers/core/device-remove.c | 5 +++--
 include/dm/device.h          | 6 ++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

This seems OK. Should we add a device tree property for this? Or is the driver-level side enough.

Regards,
Simon

#6 lore raw

PATCH 1/2 dm: core: Add a flag for power domain control on device removal

Hi Simon,

Quoted 15 lines · On Tue, 18 Feb 2020 11:31:26 -0700 Simon Glass sjg at chromium.org wrote:

Hi Anatolij,

Quoted 11 lines · Anatolij Gustschin

In various cases a power domain must stay enabled after device removal when booting OS (i.e. serial debug console or display). Add a flag to selectively skip switching off a power domain.

Fixes 52edfed65de9 ("dm: core: device: switch off power domain after device removal")
---
 drivers/core/device-remove.c | 5 +++--
 include/dm/device.h          | 6 ++++++
 2 files changed, 9 insertions(+), 2 deletions(-)  
Quoted 2 lines

This seems OK. Should we add a device tree property for this? Or is the driver-level side enough.

For all potential users I'm currently aware of the driver-level side is enough. Should this ever be required per device, then we can add a property later.

--
Anatolij

#7 lore raw

PATCH 1/2 dm: core: Add a flag for power domain control on device removal

Hi Anatolij,

Quoted 21 lines · Anatolij Gustschin

Hi Simon,

Quoted 15 lines · On Tue, 18 Feb 2020 11:31:26 -0700 Simon Glass sjg at chromium.org wrote:

Hi Anatolij,

Quoted 11 lines · Anatolij Gustschin

In various cases a power domain must stay enabled after device removal when booting OS (i.e. serial debug console or display). Add a flag to selectively skip switching off a power domain.

Fixes 52edfed65de9 ("dm: core: device: switch off power domain after device removal")
---
 drivers/core/device-remove.c | 5 +++--
 include/dm/device.h          | 6 ++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
Quoted 6 lines
Quoted 2 lines

This seems OK. Should we add a device tree property for this? Or is the driver-level side enough.

For all potential users I'm currently aware of the driver-level side is enough. Should this ever be required per device, then we can add a property later.

Thanks,
Simon

#8 lore raw

PATCH 1/2 dm: core: Add a flag for power domain control on device removal

Hi Anatolij,

Quoted 21 lines · Anatolij Gustschin

Hi Simon,

Quoted 15 lines · On Tue, 18 Feb 2020 11:31:26 -0700 Simon Glass sjg at chromium.org wrote:

Hi Anatolij,

Quoted 11 lines · Anatolij Gustschin

In various cases a power domain must stay enabled after device removal when booting OS (i.e. serial debug console or display). Add a flag to selectively skip switching off a power domain.

Fixes 52edfed65de9 ("dm: core: device: switch off power domain after device removal")
---
 drivers/core/device-remove.c | 5 +++--
 include/dm/device.h          | 6 ++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
Quoted 6 lines
Quoted 2 lines

This seems OK. Should we add a device tree property for this? Or is the driver-level side enough.

For all potential users I'm currently aware of the driver-level side is enough. Should this ever be required per device, then we can add a property later.

Thanks,
Simon

Applied to u-boot-dm, thanks!