All of lore.kernel.org
 help / color / mirror / Atom feed
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 11:13:13 +0100	[thread overview]
Message-ID: <56E29A39.6000802@denx.de> (raw)
In-Reply-To: <56E1C711.3080204@redhat.com>

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>

  parent reply	other threads:[~2016-03-11 10:13 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
2016-03-11 10:13     ` Stefan Roese [this message]
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=56E29A39.6000802@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.