Skip to contentSkip to conversation

usb: xhci-dwc3: Add DM_FLAG_ACTIVE_DMA flag

PATCH In review Jacob Procee 2 participants 2 messages Oct 22 – Oct 23 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 1/1 usb: xhci-dwc3: Add DM_FLAG_ACTIVE_DMA flag

xhci-dwc3 is not removed before U-Boot hands over to the OS, so the controller keeps running after ExitBootServices or bootm. If a device was enumerated by "usb start" (for example by the default preboot command for USB keyboards), the controller keeps polling it.

On Apple Silicon machines (tested on a MacBook Pro M1 Pro, J314s), a USB device that is connected while U-Boot runs is then not detected by Linux until it is unplugged and plugged back in. Running "usb stop" before booting avoids this.

Add DM_FLAG_ACTIVE_DMA so the controller is removed, and its DMA stopped, before the handover.

---
Changes in v2:
- Use DM_FLAG_ACTIVE_DMA instead of DM_FLAG_OS_PREPARE (Marek)

 drivers/usb/host/xhci-dwc3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-dwc3.c +1 -1
index 3504a7cf4..5b352866a 100644
@@ -256,6 +256,6 @@ U_BOOT_DRIVER(xhci_dwc3) = {
 	.ops = &xhci_usb_ops,
 	.priv_auto	= sizeof(struct xhci_ctrl),
 	.plat_auto	= sizeof(struct xhci_dwc3_plat),
-	.flags = DM_FLAG_ALLOC_PRIV_DMA,
+	.flags = DM_FLAG_ACTIVE_DMA | DM_FLAG_ALLOC_PRIV_DMA,
 };
 #endif
Signature · 1 line
2.56.0
Reviewed-by on v2 1/1
#2 lore raw
Quoted 10 lines · Jacob Procee

xhci-dwc3 is not removed before U-Boot hands over to the OS, so the controller keeps running after ExitBootServices or bootm. If a device was enumerated by "usb start" (for example by the default preboot command for USB keyboards), the controller keeps polling it.

On Apple Silicon machines (tested on a MacBook Pro M1 Pro, J314s), a USB device that is connected while U-Boot runs is then not detected by Linux until it is unplugged and plugged back in. Running "usb stop" before booting avoids this.

Quoted 4 lines

Add DM_FLAG_ACTIVE_DMA so the controller is removed, and its DMA stopped, before the handover.