Skip to contentSkip to conversation

usb_hub: Set DM_FLAG_DEFAULT_PD_CTRL_OFF to usb_hub driver

PATCH In review Ye Li 2 participants 2 messages Mar 28, 2022

lore
Share & tools
lore

Ye Li

author
#0 lore raw

PATCH 1/1 usb_hub: Set DM_FLAG_DEFAULT_PD_CTRL_OFF to usb_hub driver

Because usb_hub uses same device tree node with USB controller device, when probe and remove usb_hub, it will call the power domain control of USB controller device.
This is not expected, because power domain control implmentation may not have count when the power domain is dedicated for USB controller. So once removed usb_hub, the power domain is power off before removing USB controller.

---
 common/usb_hub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/usb_hub.c +1 -1
index ba11a18..990993a 100644
@@ -950,7 +950,7 @@ U_BOOT_DRIVER(usb_generic_hub) = {
 	.name	= "usb_hub",
 	.id	= UCLASS_USB_HUB,
 	.of_match = usb_hub_ids,
-	.flags	= DM_FLAG_ALLOC_PRIV_DMA,
+	.flags	= DM_FLAG_ALLOC_PRIV_DMA | DM_FLAG_DEFAULT_PD_CTRL_OFF,
 };
 
 UCLASS_DRIVER(usb_hub) = {
Signature · 1 line
2.7.4
#1 lore raw
Quoted 17 lines · Ye Li

Because usb_hub uses same device tree node with USB controller device, when probe and remove usb_hub, it will call the power domain control of USB controller device.
This is not expected, because power domain control implmentation may not have count when the power domain is dedicated for USB controller. So once removed usb_hub, the power domain is power off before removing USB controller.

---
  common/usb_hub.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
common/usb_hub.c +0 -0
index ba11a18..990993a 100644

common/usb_hub.c U_BOOT_DRIVER(usb_generic_hub) = { · line 954

Quoted 6 lines
common/usb_hub.c +1 -1
@@ -950,7 +950,7 @@ U_BOOT_DRIVER(usb_generic_hub) = {
  	.name	= "usb_hub",
  	.id	= UCLASS_USB_HUB,
  	.of_match = usb_hub_ids,
-	.flags	= DM_FLAG_ALLOC_PRIV_DMA,
+	.flags	= DM_FLAG_ALLOC_PRIV_DMA | DM_FLAG_DEFAULT_PD_CTRL_OFF,
  };

+CC Simon.

Which device does trigger this behavior ?
Do you have a test case you can share ?