From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/6] usb: usb_hub_power_on(): Use 100ms power-on delay instead of 1 sec (optionally)
Date: Fri, 11 Mar 2016 10:05:51 +0100 [thread overview]
Message-ID: <56E28A6F.50908@denx.de> (raw)
In-Reply-To: <56E1C711.3080204@redhat.com>
On 10.03.2016 20:12, Hans de Goede wrote:
> Hi,
>
> 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
Right. There's definitely room for improvement and optimization
here.
> ###
>
> Note that even better would be to in 3 first calls some sort of
> probe_prepare function, which if the child is a hub itself, does
> the poweron, and records the timeout for its loop and runs its
> loop once (to probe_prepare its children if they come up immediately).
>
> And then only once the loop over all ports ends, call the real
> probe which will then do usb_hub_configure() for its (hub)
> children using the timeout recorded during the probe_prepare,
> and will thus likely be able to skip a large part of that
> 1 sec waiting since that was already waited in the parent
> hub's usb_hub_configure() call.
>
> Note this would speed up scanning deep trees of hubs, if
> we have multiple usb controllers, it would also be really
> good to probe them in parallel as described here:
>
> http://lists.denx.de/pipermail/u-boot/2016-February/245243.html
>
> (yes I'm repeating myself :)
Thanks for your comments Hans. Lets see, what I can come up with in
next patchset version.
Thanks,
Stefan
next prev parent reply other threads:[~2016-03-11 9:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-10 15:50 [U-Boot] [PATCH 0/6] usb: Reduce USB scanning time Stefan Roese
2016-03-10 15:50 ` [U-Boot] [PATCH 1/6] usb: legacy_hub_port_reset(): Speedup hub reset handling Stefan Roese
2016-03-10 18:51 ` Hans de Goede
2016-03-11 6:37 ` Stefan Roese
2016-03-11 0:06 ` Stephen Warren
2016-03-10 15:50 ` [U-Boot] [PATCH 2/6] usb: Remove 200 ms delay in usb_hub_port_connect_change() Stefan Roese
2016-03-10 18:55 ` Hans de Goede
2016-03-11 6:34 ` Stefan Roese
2016-03-11 6:35 ` Stefan Roese
2016-03-11 0:06 ` Stephen Warren
2016-03-10 15:50 ` [U-Boot] [PATCH 3/6] usb: Remove 1 second per port timeout in usb_hub_configure() Stefan Roese
2016-03-10 18:59 ` Hans de Goede
2016-03-10 15:50 ` [U-Boot] [PATCH 4/6] usb: usb_hub_power_on(): Use 100ms power-on delay instead of 1 sec (optionally) Stefan Roese
2016-03-10 19:12 ` Hans de Goede
2016-03-11 9:05 ` Stefan Roese [this message]
2016-03-11 10:13 ` Stefan Roese
2016-03-11 10:32 ` Hans de Goede
2016-03-11 10:42 ` Stefan Roese
2016-03-10 15:50 ` [U-Boot] [PATCH 5/6] usb: Don't reset the USB hub a 2nd time Stefan Roese
2016-03-10 19:13 ` Hans de Goede
2016-03-11 6:43 ` Stefan Roese
2016-03-11 0:07 ` Stephen Warren
2016-03-10 15:50 ` [U-Boot] [PATCH 6/6] usb: Implement static USB port configuration to speed up USB scanning Stefan Roese
2016-03-10 19:18 ` Hans de Goede
2016-03-11 15:08 ` Stefan Roese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56E28A6F.50908@denx.de \
--to=sr@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox