[U-Boot] [PATCH 4/6] usb: usb_hub_power_on(): Use 100ms power-on delay instead of 1 sec (optionally)
Stefan Roese
sr at denx.de
Fri Mar 11 11:13:13 CET 2016
Hi Hans,
On 10.03.2016 20:12, Hans de Goede wrote:
> On 10-03-16 16:50, Stefan Roese wrote:
>> In a system with a complex USB infrastrcture (many USB hubs), the
>> power-on delay of mininimum 1 second for each USB hub results in a quite
>> big USB scanning time. Many USB devices can deal with much lower
>> power-on delays. In my test system, even 10ms seems to be enough
>> for the USB device to get detected correctly. This patch now
>> reduces the minimum 1 second delay to a minumum of 100ms instead.
>> This results in a big USB scan time reduction:
>>
>> Here the numbers for my current board:
>>
>> Without this patch:
>> starting USB...
>> USB0: USB EHCI 1.00
>> scanning bus 0 for devices... 9 USB Device(s) found
>>
>> time: 10.822 seconds
>>
>> With this patch:
>> starting USB...
>> USB0: USB EHCI 1.00
>> scanning bus 0 for devices... 9 USB Device(s) found
>>
>> time: 6.319 seconds
>>
>> So ~4.5 seconds of USB scanning time reduction.
>>
>> I'm not really sure if this patch can be accepted in general as is.
>>
>> In patch 0d437bca [usb: hub: fix power good delay timing] by Stephen
>> Warren, this delay was changes according to "Connect Timing ECN.pdf"
>> to a total of 1 second plus the hub port's power good time. Now its
>> changes back to 100ms which is a violation of this spec. But still,
>> for most USB devices this 100ms is more than enough. So its a valid
>> use-case to lower this time in special (perhaps static) USB
>> environments.
>
> Actually that 1 second + poweron delay is why we had the 1 sec
> delay in usb_hub_configure(), that is where we wait for a device
> to show up. Note that we can already save a lot of time, by
> first powering up all ports and then doing the 1 sec wait
> and then checking all ports without needing to delay any further.
>
> Or even better:
>
> 1) turn on all ports
> 2) do power-on-delay (either 2ms * bPwrOn2PwrGood from descriptor, or
> 100ms which ever one is LARGER)
> 3) set a timeout val 1 sec from now, loop over all ports and quit
> the loop when either all ports are connected (we already skip the
> per port delay in this connected case now), or when the 1 sec
> expires. There is no reason for the 1 sec per port delay,
> one sec + bPwrOn2PwrGood delay is enough for all ports
One question here: Do we really need to do this power-on-delay in
step 2) at all? Shouldn't it be sufficient to do the port scanning
loop with a "2ms * bPwrOn2PwrGood + 1 sec" timeout instead? As
I've done in the patch I've attached (which works just fine on
my platform).
Note that I will also dig into the parallelizing idea as well. I'm
just trying to implement the timeout handling correctly first.
Thanks,
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-usb-Change-power-on-scanning-timeout-handling.patch
Type: text/x-diff
Size: 2656 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160311/0d17a2ab/attachment.patch>
More information about the U-Boot
mailing list