[PATCH 3/4] configs: Increase USB Hub debounce timeout in Agilex5
Ravulapalli, Naresh Kumar
nareshkumar.ravulapalli at altera.com
Tue Sep 9 07:36:31 CEST 2025
Hi Marek
On 09-Sep-25 4:32 AM, Marek Vasut wrote:
>
> On 9/8/25 3:41 PM, Ravulapalli, Naresh Kumar wrote:
>>
>>
>> On 08-Sep-25 6:32 PM, Marek Vasut wrote:
>>>
>>> On 9/8/25 10:44 AM, Ravulapalli, Naresh Kumar wrote:
>>>> Hi Marek
>>>>
>>>> On 02-Sep-25 11:48 PM, Marek Vasut wrote:
>>>>> [CAUTION: This email is from outside your organization. Unless you
>>>>> trust the sender, do not click on links or open attachments as it may
>>>>> be a fraudulent email attempting to steal your information and/or
>>>>> compromise your computer.]
>>>>>
>>>>> 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.
>>>>
>>>> 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.
>>> But none of this answers my question, looking at the aforementioned code
>>> -- Changing both usb_pgood_delay or (CONFIG_USB_)HUB_DEBOUNCE_TIMEOUT
>>> should have the same effect. How come it does not in your case ?
>>
>> Maybe I wasn't explicit in my earlier comment, "No, changing USB HUB
>> debounce timeout is working for us."
>
> USB_HUB_DEBOUNCE_TIMEOUT is basically the hard-coded-into-U-Boot-binary
> version of "usb_pgood_delay" . The upside of "usb_pgood_delay" is that
> users can change the value at runtime, which helps in case users need to
> use some broken USB storage device which takes more than
> "usb_pgood_delay" ms to start up. You cannot do that with
> USB_HUB_DEBOUNCE_TIMEOUT .
>
> Since the commit description talks about "Some USB devices need more
> time to be initialized." , this looks more like "usb_pgood_delay" type
> of issue.
It is a debounce issue, I will modify the commit message to state this.
>> What I meant is I didn't want to modify usb_pgood_delay as my issue was
>> with HUB_DEBOUNCE_TIMEOUT, so modifying this value worked for us.
>
> Does it also work if you modify usb_pgood_delay instead ?
More information about the U-Boot
mailing list