diff mbox

[U-Boot] usb: hub: Increase the query delay

Message ID 1462397570-5314-1-git-send-email-marex@denx.de
State Deferred
Delegated to: Marek Vasut
Headers show

Commit Message

Marek Vasut May 4, 2016, 9:32 p.m. UTC
Increase the query delay, otherwise some sticks are not detected.
The problem shows up on the USB bus analyzer such that the stick
takes longer time to switch from FS mode to HS mode than the code
allows when the controller starts from completely off state.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <clsee@altera.com>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Stephen Warren <swarren@nvidia.com>
---
V2: Special-case this only for DWC2
---
 common/usb_hub.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Stephen Warren May 4, 2016, 9:34 p.m. UTC | #1
On 05/04/2016 03:32 PM, Marek Vasut wrote:
> Increase the query delay, otherwise some sticks are not detected.
> The problem shows up on the USB bus analyzer such that the stick
> takes longer time to switch from FS mode to HS mode than the code
> allows when the controller starts from completely off state.

Acked-by: Stephen Warren <swarren@nvidia.com>

(I suspect this is more to do with the board than the USB controller, 
since the board controls the VBUS power. However, if this works, it's 
probably fine for now.)
Marek Vasut May 4, 2016, 9:38 p.m. UTC | #2
On 05/04/2016 11:34 PM, Stephen Warren wrote:
> On 05/04/2016 03:32 PM, Marek Vasut wrote:
>> Increase the query delay, otherwise some sticks are not detected.
>> The problem shows up on the USB bus analyzer such that the stick
>> takes longer time to switch from FS mode to HS mode than the code
>> allows when the controller starts from completely off state.
> 
> Acked-by: Stephen Warren <swarren@nvidia.com>
> 
> (I suspect this is more to do with the board than the USB controller,
> since the board controls the VBUS power. However, if this works, it's
> probably fine for now.)

For now, maybe, but I am extremely unhappy to have this hack in the
common code.
diff mbox

Patch

diff --git a/common/usb_hub.c b/common/usb_hub.c
index 0f39c9f..4795ea1 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -144,8 +144,14 @@  static void usb_hub_power_on(struct usb_hub_device *hub)
 	/*
 	 * Do a minimum delay of the larger value of 100ms or pgood_delay
 	 * so that the power can stablize before the devices are queried
+	 * DWC2 (and possibly others?) needs longer time to stabilize when
+	 * coming out of cold start. 1 second seems to work reliably.
 	 */
+#ifdef CONFIG_USB_DWC2
+	hub->query_delay = get_timer(0) + max(1000, (int)pgood_delay);
+#else
 	hub->query_delay = get_timer(0) + max(100, (int)pgood_delay);
+#endif
 
 	/*
 	 * Record the power-on timeout here. The max. delay (timeout)