Skip to contentSkip to conversation

dwc3: Fix fastboot re-run failure with flat DTS

PATCH In review Balaji Selvanathan 3 participants 4 messages May 29 – Jun 8

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

PATCH 1/1 dwc3: Fix fastboot re-run failure with flat DTS

Problem: The first "run fastboot" works and enumerates on the host. Subsequent runs fail, with no USB enumeration observed.

With flat DTS configurations, the peripheral device inherits power-domains from its parent (glue) node, as both reference the same DT node. During teardown after "fastboot continue", device_remove() of peripheral device invokes dev_power_domain_off(), which powers off the shared USB GDSC.

As a result, the next "run fastboot" fails because the power domain is left in an uninitialized state.

Add DM_FLAG_LEAVE_PD_ON to dwc3_generic_peripheral to prevent power domain shutdown during peripheral removal.

This aligns with hierarchical DTS behavior, where the peripheral child does not own power-domains. Power management remains with the glue device, which persists across probe/remove cycles, allowing repeated fastboot runs to succeed.

---
 drivers/usb/dwc3/dwc3-generic.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/dwc3/dwc3-generic.c +1 -0
index 22b9ef0b24e..788fe6fc819 100644
@@ -220,6 +220,7 @@ U_BOOT_DRIVER(dwc3_generic_peripheral) = {
 	.remove = dwc3_generic_peripheral_remove,
 	.priv_auto	= sizeof(struct dwc3_generic_priv),
 	.plat_auto	= sizeof(struct dwc3_generic_plat),
+	.flags  = DM_FLAG_LEAVE_PD_ON,
 };
 #endif
 

---
base-commit: 987907ae4bcc5d6055bdf7d318a3edf53e14d5fa
change-id: 20260529-usb-3b6b44559cc5

Best regards,

Signature · 1 line
Balaji Selvanathan <[email protected]>
#1 lore raw
Quoted 9 lines · Balaji Selvanathan

Problem: The first "run fastboot" works and enumerates on the host. Subsequent runs fail, with no USB enumeration observed.

With flat DTS configurations, the peripheral device inherits power-domains from its parent (glue) node, as both reference the same DT node. During teardown after "fastboot continue", device_remove() of peripheral device invokes dev_power_domain_off(), which powers off the shared USB GDSC.

Quoted 5 lines

As a result, the next "run fastboot" fails because the power domain is left in an uninitialized state.

Add DM_FLAG_LEAVE_PD_ON to dwc3_generic_peripheral to prevent power domain shutdown during peripheral removal.

It seems the driver does not handle its power domains correctly, inhibiting PD control is not a fix, sorry.

#2 lore raw

Hi,

Quoted 10 lines · Marek Vasut
Quoted 9 lines · Balaji Selvanathan

Problem: The first "run fastboot" works and enumerates on the host. Subsequent runs fail, with no USB enumeration observed.

With flat DTS configurations, the peripheral device inherits power-domains from its parent (glue) node, as both reference the same DT node. During teardown after "fastboot continue", device_remove() of peripheral device invokes dev_power_domain_off(), which powers off the shared USB GDSC.

Quoted 7 lines
Quoted 5 lines

As a result, the next "run fastboot" fails because the power domain is left in an uninitialized state.

Add DM_FLAG_LEAVE_PD_ON to dwc3_generic_peripheral to prevent power domain shutdown during peripheral removal.

It seems the driver does not handle its power domains correctly, inhibiting PD control is not a fix, sorry.

I agree with Marek here. Especially since this is a generic driver.

I had a somewhat similar problem on amlogic devices where I could only run fastboot once.

I've solved this via
https://lore.kernel.org/all/[email protected]/

Maybe you can explore something similar instead?

#3 lore raw

Hi Mattijs,

Quoted 23 lines · Mattijs Korpershoek

Hi,

Quoted 10 lines · Marek Vasut
Quoted 9 lines · Balaji Selvanathan

Problem: The first "run fastboot" works and enumerates on the host. Subsequent runs fail, with no USB enumeration observed.

With flat DTS configurations, the peripheral device inherits power-domains from its parent (glue) node, as both reference the same DT node. During teardown after "fastboot continue", device_remove() of peripheral device invokes dev_power_domain_off(), which powers off the shared USB GDSC.

Quoted 7 lines
Quoted 5 lines

As a result, the next "run fastboot" fails because the power domain is left in an uninitialized state.

Add DM_FLAG_LEAVE_PD_ON to dwc3_generic_peripheral to prevent power domain shutdown during peripheral removal.

It seems the driver does not handle its power domains correctly, inhibiting PD control is not a fix, sorry.

I agree with Marek here. Especially since this is a generic driver.

Quoted 7 lines

I had a somewhat similar problem on amlogic devices where I could only run fastboot once.

I've solved this via
https://lore.kernel.org/all/[email protected]/

Maybe you can explore something similar instead?

Thanks, will look into this patch.

Regards,

Balaji