usb: hub: allow to increase HUB_DEBOUNCE_TIMEOUT
authorPatrick Delaunay <patrick.delaunay@foss.st.com>
Fri, 9 Sep 2022 09:45:23 +0000 (11:45 +0200)
committerMarek Vasut <marex@denx.de>
Sat, 14 Jan 2023 13:10:30 +0000 (14:10 +0100)
Add a new CONFIG_USB_HUB_DEBOUNCE_TIMEOUT to increase the
HUB_DEBOUNCE_TIMEOUT value, for example to 2s 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.

This 2s 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 used to increase the connection timeout delay.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
common/Kconfig
common/usb_hub.c

index 73e3fe3..439b219 100644 (file)
@@ -1099,3 +1099,15 @@ config FDT_SIMPLEFB
 
 config IO_TRACE
        bool
+
+config USB_HUB_DEBOUNCE_TIMEOUT
+       int "Timeout in milliseconds for USB HUB connection"
+       depends on USB
+       default 1000
+       help
+         Value in milliseconds of the USB connection timeout, the max delay to
+         wait the hub port status to be connected steadily after being powered
+         off and powered on in the usb hub driver.
+         This define allows to increase the HUB_DEBOUNCE_TIMEOUT default
+         value = 1s because some usb device needs around 1.5s to be initialized
+         and a 2s value should solve detection issue on problematic USB keys.
index 95f1449..f7fd12c 100644 (file)
@@ -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   CONFIG_USB_HUB_DEBOUNCE_TIMEOUT
 
 #define PORT_OVERCURRENT_MAX_SCAN_COUNT                3