Skip to contentSkip to conversation

usb: dwc2: Add delay to fix the USB detection problem on SoCFPGA

PATCH New Stefan Roese 2 participants 2 messages May 6, 2016 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc2: Add delay to fix the USB detection problem on SoCFPGA

With patch c998da0d (usb: Change power-on / scanning timeout handling), the USB scanning is started earlier and with a smaller timeout. This resulted on SoCFPGA (using the DWC2 driver) in some USB sticks not getting detected any more. This patch now adds a 1 second delay (in the host mode only) to the DWC2 driver before the scanning is started. With this delay, now all problematic USB keys are detected successfully again. And there is no need any more to change the delay / timeout in the common USB code (usb_hub.c).

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Marek Vasut <[email protected]>
---
 drivers/usb/host/dwc2.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/usb/host/dwc2.c +9 -0
index 27fcf7c..7f8d9c3 100644
@@ -1122,6 +1122,15 @@ static int dwc2_init_common(struct dwc2_priv *priv)
 		}
 	}
 
+	/*
+	 * Add a 1 second delay here. This gives the host controller
+	 * a bit time before the comminucation with the USB devices
+	 * is started (the bus is scanned) and  fixes the USB detection
+	 * problems with some problematic USB keys.
+	 */
+	if (readl(&regs->gintsts) & DWC2_GINTSTS_CURMODE_HOST)
+		mdelay(1000);
+
 	return 0;
 }
 
Signature · 1 line
2.8.2
#1 lore raw

PATCH 1/1 usb: dwc2: Add delay to fix the USB detection problem on SoCFPGA

Quoted 18 lines · Stefan Roese

With patch c998da0d (usb: Change power-on / scanning timeout handling),
the USB scanning is started earlier and with a smaller timeout. This resulted on SoCFPGA (using the DWC2 driver) in some USB sticks not getting detected any more. This patch now adds a 1 second delay (in the host mode only) to the DWC2 driver before the scanning is started.
With this delay, now all problematic USB keys are detected successfully
again. And there is no need any more to change the delay / timeout in the common USB code (usb_hub.c).

Cc Chin Liang See <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Marek Vasut <[email protected]>
Quoted 5 lines
---
 drivers/usb/host/dwc2.c | 9 +++++++++
 1 file changed, 9 insertions(+)

For record, works for my problematic pen drives. This is apply on top of Marek's patch except 7/7

Thanks
Chin Liang