[PATCH 2/2] usb: hub: increase HUB_DEBOUNCE_TIMEOUT
Patrick DELAUNAY
patrick.delaunay at foss.st.com
Thu Sep 8 13:20:11 CEST 2022
Hi Marek,
On 7/8/22 17:34, Marek Vasut wrote:
> On 7/4/22 12:45, Patrick Delaunay wrote:
>> 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
>
> Do you think it is possible to make this somehow dynamic , so not all
> devices would wait so long ?
Yes I do it in V2.
Patrick
More information about the U-Boot
mailing list