From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/6] usb: Implement static USB port configuration to speed up USB scanning
Date: Fri, 11 Mar 2016 16:08:24 +0100 [thread overview]
Message-ID: <56E2DF68.1010508@denx.de> (raw)
In-Reply-To: <56E1C868.2050007@redhat.com>
Hi Hans,
On 10.03.2016 20:18, Hans de Goede wrote:
> Hi,
>
> On 10-03-16 16:50, Stefan Roese wrote:
>> This patch implements an optionally quasi static USB port configuration.
>> This is done by using an environment variable, that describes the ports
>> that shall be scanned at the next USB scans (usb start, usb reset).
>>
>> The "usb_port_use" env variable is used to describe this static USB
>> configuration. For this, each USB hub is represented by a 8-bit value.
>> Making it possible to configure a maximum of 8 ports for each USB hub.
>> A 64-bit representation is used, therefore 8 USB hubs can be described
>> in total.
>>
>> Here an example for this "usb_port_use" environment variable:
>>
>> usb_port_use = 0000000000040301
>> -------------------------------
>> 1st USB hub: 0x01 -> Use port 1 (first port)
>> 2nd USB hub: 0x03 -> Use port 1 and 2
>> 3rd USB hub: 0x04 -> Use port 3
>> 4th USB hub: 0x00 -> Use no ports
>> ...
>> 8th USB hub: 0x00 -> Use no ports
>>
>> To make this procedure of configuring this env variable less error prone
>> and less painful, this patch also introduces another env variable that
>> is dynamically generated at each USB scan: "usb_port_detected". This
>> variable is similar to "usb_port_use". It has a bit enabled for each
>> port that has been detected. This can be easily used on a new system,
>> where the USB configuration is static in this way:
>>
>> Run the USB scan (usb start, usb reset) without the "usb_port_use"
>> variable set. This will result in all ports being scanned and the result
>> written into the "usb_port_detected" variable. To configure the USB
>> subsystem to only scan these specific USB ports upon the next
>> scans, you only need to write the value from "usb_port_detected"
>> into the "usb_port_use" variable:
>>
>> => setenv usb_port_use ${usb_port_detected}
>> => saveenv
>>
>> The next scans will only scan those enabled ports.
>>
>> Its of course also possible to manually "tune" this env variable. If
>> some ports are not needed in U-Boot, they can be disabled this way.
>> This will result in less USB hub ports getting scanned and therefore
>> in a faster USB scan time. Here an example:
>>
>> With all USB devices enabled (usb_port_use not set):
>
> This will fall apart when you get multiple root hubs,
> if you want to do this (I believe there is much more low hanging fruit
> see my previous mails), you somehow need to describe the entire
> path to the hub in the env variable, currently if one hub gets removed,
> other hubs which are children of the same parent will get a different
> number in your hub-numbering scheme and things go awry, also what about
> hubs
> on a second host controller, do those number on from the hub-numbering of
> the first hcd ? That seems vary fragile and will break when we add
> (semi) parallel scanning.
>
> So NACK because this disallows later implementing parallel scanning
> without regressing this feature.
Yes, I see your point. But I still like the idea of this static USB
configuration. Best in a similar way as done in this patch (via some
env variables) to have a flexible means to configure the USB system.
I'll need to re-think this a bit more and will probably get back to
this at some point.
For now, I've removed this patch from the patch series (as you will
have noticed by now).
Thanks for all you comments so far.
Thanks,
Stefan
prev parent reply other threads:[~2016-03-11 15:08 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
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 [this message]
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=56E2DF68.1010508@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