uboot/common
Stefan Roese c998da0d67 usb: Change power-on / scanning timeout handling
This patch changes the USB port scanning procedure and timeout
handling in the following ways:

a)
The power-on delay in usb_hub_power_on() is now reduced to a value of
max(100ms, "hub->desc.bPwrOn2PwrGood * 2"). The code does not wait
using mdelay, instead usb_hub_power_on() will wait before querying
the device in the scanning loop later. The total timeout for this
hub, which is 1 second + "hub->desc.bPwrOn2PwrGood * 2" is calculated
and will be used in the following per-port scanning loop as the timeout
to detect active USB devices on this hub.

b)
Don't delay the minimum delay (for power to stabilize) in
usb_hub_power_on(). Instead skip querying these devices in the scannig
loop until the delay time is reached.

c)
The ports are now scanned in a quasi parallel way. The current code did
wait for each (unconnected) port to reach its timeout and only then
continue with the next port. This patch now changes this to scan all
ports of all USB hubs quasi simultaneously. For this, all ports are added
to a scanning list. This list is scanned until all ports are ready
by either a) reaching the connection timeout (calculated earlier), or
by b) detecting a USB device. This results in a faster USB scan time as
the recursive scanning of USB hubs connected to the hub that's currently
being scanned will start earlier.

One small functional change to the original code is, that ports with
overcurrent detection will now get rescanned multiple times
(PORT_OVERCURRENT_MAX_SCAN_COUNT).

Without this patch:
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 9 USB Device(s) found

time: 20.163 seconds

With this patch:
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 9 USB Device(s) found

time: 1.822 seconds

So ~18.3 seconds of USB scanning time reduction.

Signed-off-by: Stefan Roese <sr@denx.de>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-20 18:00:45 +01:00
..
init x86: Fix board init breakage 2016-01-15 08:09:46 -05:00
spl spl_nor: fix warning when compiled for 64bit target 2016-03-15 21:30:20 -04:00
Kconfig Move all command code into its own directory 2016-01-25 10:39:43 -05:00
Makefile fdt: Allow libfdt to be used in SPL 2016-03-14 19:18:26 -04:00
autoboot.c autoboot.c: Fill env vars in process_fdt_options() only if TEXT_BASE is set 2016-02-05 12:47:20 +08:00
bedbug.c
board_f.c x86: Allow use of serial soon after relocation 2016-03-17 10:27:24 +08:00
board_info.c
board_r.c dm: timer: Correct timer init ordering after relocation 2016-03-17 10:27:24 +08:00
bootm.c fdt: Allow libfdt to be used in SPL 2016-03-14 19:18:26 -04:00
bootm_os.c VxWorks: fixup MAC address for VxWorks 2015-12-12 15:56:08 -05:00
bootretry.c
bootstage.c
bouncebuf.c
cli.c common: cli: avoid memory leak 2016-01-04 12:25:35 -05:00
cli_hush.c hush: Add rudimentary support for PS1 and PS2 2016-02-08 10:10:37 -05:00
cli_readline.c
cli_simple.c common: cli_simple: use strlcpy instead of strcpy 2016-01-13 21:05:26 -05:00
command.c
console.c dm: video: Add a temporary work-around for old stdout var 2016-02-11 21:37:17 +01:00
cros_ec.c
ddr_spd.c Add more SPDX-License-Identifier tags 2016-01-19 08:31:21 -05:00
dlmalloc.c malloc: remove !gd handling 2016-03-08 15:01:47 -05:00
dlmalloc.src
edid.c
env_attr.c
env_callback.c common: env: initialize scalar variable 2016-01-04 12:25:35 -05:00
env_common.c
env_dataflash.c
env_eeprom.c
env_embedded.c
env_ext4.c common: Add support for environment file in EXT4. 2016-03-14 14:18:39 -04:00
env_fat.c dm: block: Rename device number member dev to devnum 2016-03-14 15:34:50 -06:00
env_flags.c tools: fix env_flags build 2016-02-15 20:58:25 +00:00
env_flash.c
env_mmc.c env_mmc: support overriding mmc dev from board code 2016-01-25 10:39:46 -05:00
env_nand.c
env_nowhere.c
env_nvram.c
env_onenand.c
env_remote.c
env_sf.c dm: env_sf: fix saveenv() to use driver model 2016-01-27 08:28:40 -08:00
env_ubi.c
exports.c
fb_mmc.c dm: block: Adjust device calls to go through helpers function 2016-03-14 15:34:50 -06:00
fb_nand.c
fdt_support.c Revert "fdt: fix address cell count checking in fdt_translate_address()" 2016-03-17 21:27:39 -06:00
flash.c
hash.c hash.c: Conditionally compile hash_command, static hash_show 2016-01-13 21:05:08 -05:00
hwconfig.c
image-android.c
image-fdt.c efi_loader: Call fdt preparation functions 2016-03-15 21:30:14 -04:00
image-fit.c common: image-fit: Fix load and entry addresses in FIT image 2016-03-14 19:18:41 -04:00
image-sig.c
image-sparse.c
image.c image: Add functions to obtain short names 2016-03-14 19:18:28 -04:00
iomux.c
iotrace.c
kallsyms.c
kgdb.c
kgdb_stubs.c Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
lcd.c lcd: fix the color testpattern in 16bit mode 2016-01-24 00:38:40 +01:00
lcd_console.c
lcd_console_rotation.c
lcd_simplefb.c
lynxkdi.c
main.c Remove unused CONFIG_MODEM_SUPPORT option and associated dead code. 2016-02-08 10:22:44 -05:00
malloc_simple.c malloc_simple: Add a little more debugging 2016-03-17 10:27:23 +08:00
memsize.c Revert "common/memsize.c: Simplify RAM size detection" 2016-02-10 08:34:42 -05:00
menu.c
miiphyutil.c common: miiphyutil: avoid memory leak 2015-12-05 18:22:24 -05:00
s_record.c
splash.c
splash_source.c
stdio.c stdio: Correct a build error with driver model 2016-01-21 20:42:36 -07:00
system_map.c
update.c
usb.c usb: Don't reset the USB hub a 2nd time 2016-03-20 18:00:45 +01:00
usb_hub.c usb: Change power-on / scanning timeout handling 2016-03-20 18:00:45 +01:00
usb_kbd.c usb: kbd: Prevent out of bound access 2016-01-25 22:00:46 +01:00
usb_storage.c dm: usb: Convert USB storage to use driver-model for block devs 2016-03-14 15:34:50 -06:00
xyzModem.c lib/crc16.c: Rename cyg_crc16() to crc16_ccitt() and add crc start value 2016-03-14 19:18:42 -04:00