[PATCH 2/2] usb: hub: increase HUB_DEBOUNCE_TIMEOUT
Patrick Delaunay
patrick.delaunay at foss.st.com
Mon Jul 4 12:45:43 CEST 2022
Increase HUB_DEBOUNCE_TIMEOUT to 2000 because some usb device
needs around 1.5s or more to make the hub port status to be
connected steadily after being powered off and powered on.
These value is aligned with Linux driver and avoids to configure
"usb_pgood_delay" as a workaround for connection timeout on
some USB device; normally the env variable "usb_pgood_delay" is used
to delay the first query after power ON and thus the device answer,
but this variable not to increase the connection timeout delay.
Signed-off-by: Patrick Delaunay <patrick.delaunay at foss.st.com>
---
Hi,
I think this patch solves a general issue because a 1s timeout for
USB connection is too short on problematic USB keys / USB HUB.
The issue was introduced by the commit c998da0d6709 ("usb: Change
power-on / scanning timeout handling")
Patching usb_hub allows to avoid to patch in each board/driver.
For example, commit 0417169054cb ("imx: ventana: add usb_pgood_delay
2sec default") => use pgood_delay = 2s !?
or ("ARM: stm32: Increase USB power-good delay on DHSOM")
https://patchwork.ozlabs.org/project/uboot/patch/20211113022444.231801-1-marex@denx.de/
or commit 2bf352f0c1b7 ("usb: dwc2: Add delay to fix the USB
detection problem on SoCFPGA") => patch in USB DWC2 driver to add
a timeout in driver
The commit 319418c01c95 ("usb: hub: allow pgood_delay to be
specified via env") introduces an env variable for warm-up times
managed by hub->query_delay.
But it is not linked to the connect timeout after power on
managed by hub->connect_timeout.
This patch can increase the boot time for some board when USB device is
not available; if it is a problem I can introduce a new config:
CONFIG_USB_HUB_DEBOUNCE_TIMEOUT to define this value with default = 1s
to keep the current behavior.
This issue appears with DWC2 and USB HUB used in STM32MP135F-DK board;
pgood_delay=2 is not enough to solved all the USB key detection issues.
Patrick
common/usb_hub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/usb_hub.c b/common/usb_hub.c
index d73638950b9..e681f1b3073 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -47,7 +47,7 @@
#define HUB_SHORT_RESET_TIME 20
#define HUB_LONG_RESET_TIME 200
-#define HUB_DEBOUNCE_TIMEOUT 1000
+#define HUB_DEBOUNCE_TIMEOUT 2000
#define PORT_OVERCURRENT_MAX_SCAN_COUNT 3
--
2.25.1
More information about the U-Boot
mailing list