[PATCH 3/4] configs: Increase USB Hub debounce timeout in Agilex5
Ravulapalli, Naresh Kumar
nareshkumar.ravulapalli at altera.com
Mon Sep 8 10:49:48 CEST 2025
On 08-Sep-25 2:14 PM, Ravulapalli, Naresh Kumar wrote:
> Hi Marek
>
> On 02-Sep-25 11:48 PM, Marek Vasut wrote:
>>
>> On 9/2/25 9:52 AM, Ravulapalli, Naresh Kumar wrote:
>>>
>>>
>>> On 30-Aug-25 5:30 AM, Marek Vasut wrote:
>>>>
>>>> On 8/29/25 6:19 PM, Ravulapalli, Naresh Kumar wrote:
>>>>> Hi Marek
>>>>>
>>>>> On 29-Aug-25 2:11 PM, Marek Vasut wrote:
>>>>>>
>>>>>> On 8/8/25 12:04 PM, Naresh Kumar Ravulapalli wrote:
>>>>>>> Some USB devices need more time to be initialized. Hence,
>>>>>>> increasing the default USB Hub debounce timeout value for
>>>>>>> devices to be discovered, connected to Agilex5 boards.
>>>>>> Is this really hub debounce timeout or usb_pgood_delay ?
>>>>>>
>>>>>> Which devices are those, include that in the commit message.
>>>>>
>>>>> Yes, timeout is related to USB connect/disconnect signal bounces not
>>>>> about bus stability during init.
>>>>>
>>>>> Issue was mainly observed with legacy flash drives. Maybe I will
>>>>> change
>>>>> commit text from "Some USB devices need more time to be
>>>>> initialized..."
>>>>> to "Some old USB flash drives need more time to be initialized during
>>>>> connect or disconnect events ..."?
>>>>>
>>>>> Note that I am not modifying the default Kconfig value in general;
>>>>> change is only made for an SoCFPGA devkit we tested.
>>>> Does this same issue go away if you set usb_pgood_delay to 2000 or
>>>> higher too ?
>>>
>>> No, changing USB HUB debounce timeout is working for us.
>> Look at this code:
>>
>> https://source.denx.de/u-boot/u-boot/-/blob/master/common/usb_hub.c?
>> ref_type=heads#L199
>>
>> "
>> #if CONFIG_IS_ENABLED(ENV_SUPPORT)
>> env = env_get("usb_pgood_delay");
>> if (env)
>> pgood_delay = max(pgood_delay,
>> (unsigned)simple_strtol(env, NULL, 0));
>> #endif
>> debug("pgood_delay=%dms\n", pgood_delay);
>>
>> /*
>> * Do a minimum delay of the larger value of 100ms or pgood_delay
>> * so that the power can stablize before the devices are queried
>> */
>> hub->query_delay = get_timer(0) + max(100, (int)pgood_delay);
>>
>> /*
>> * Record the power-on timeout here. The max. delay (timeout)
>> * will be done based on this value in the USB port loop in
>> * usb_hub_configure() later.
>> */
>> hub->connect_timeout = hub->query_delay + HUB_DEBOUNCE_TIMEOUT;
>> debug("devnum=%d poweron: query_delay=%d connect_timeout=%d\n",
>> dev->devnum, max(100, (int)pgood_delay),
>> max(100, (int)pgood_delay) + HUB_DEBOUNCE_TIMEOUT);
>> "
>>
>> Changing both usb_pgood_delay or (CONFIG_USB_)HUB_DEBOUNCE_TIMEOUT
>> should have the same effect. How come it does not ?
>
> CONFIG_USB_HUB_DEBOUNCE_TIMEOUT and pgood_delay are used for different
> purposes. If I am not mistaken I think I explained this in my earlier
> comments.
>
> Anyway, to further elaborate, CONFIG_USB_HUB_DEBOUNCE_TIMEOUT is used
> for debounce timeouts during device connect events and pgood_delay is
> used during initial VBus stabilization.
>
> You would be able to see this difference in the link below, where
> pgood_delay which is populated into "hub->query_delay" is used for
> voltages to stabilize before initiating communication and "hub-
> >connect_timeout" where "HUB_DEBOUNCE_TIMEOUT" is populated is used
> after getting the port status.
>
Apologies for the earlier link, please use this link,
https://github.com/u-boot/u-boot/blob/328747974a0620d0996113fe2b3906b06e96de00/common/usb_hub.c#L455
>
> Also, the change made as part of the comment is not applicable to the
> USB stack in general; it is only for our devkit defconfig.
>
More information about the U-Boot
mailing list