public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] usb: dwc2: Add delay to fix the USB detection problem on SoCFPGA
@ 2016-05-06 11:53 Stefan Roese
  2016-05-06 13:28 ` Chin Liang See
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Roese @ 2016-05-06 11:53 UTC (permalink / raw)
  To: u-boot

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).

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Chin Liang See <clsee@altera.com>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Marek Vasut <marex@denx.de>
---
 drivers/usb/host/dwc2.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
index 27fcf7c..7f8d9c3 100644
--- a/drivers/usb/host/dwc2.c
+++ b/drivers/usb/host/dwc2.c
@@ -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;
 }
 
-- 
2.8.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] usb: dwc2: Add delay to fix the USB detection problem on SoCFPGA
  2016-05-06 11:53 [U-Boot] [PATCH] usb: dwc2: Add delay to fix the USB detection problem on SoCFPGA Stefan Roese
@ 2016-05-06 13:28 ` Chin Liang See
  0 siblings, 0 replies; 2+ messages in thread
From: Chin Liang See @ 2016-05-06 13:28 UTC (permalink / raw)
  To: u-boot

On Fri, 2016-05-06 at 13:53 +0200, Stefan Roese wrote:
> 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).
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Chin Liang See <clsee@altera.com>
> Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Stephen Warren <swarren@nvidia.com>
> Cc: Marek Vasut <marex@denx.de>
> ---
>  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

Reviewed-by: Chin Liang See <clsee@altera.com>
Tested-by: Chin Liang See <clsee@altera.com>

Thanks
Chin Liang

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-06 13:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-06 11:53 [U-Boot] [PATCH] usb: dwc2: Add delay to fix the USB detection problem on SoCFPGA Stefan Roese
2016-05-06 13:28 ` Chin Liang See

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox