u-boot/common
Shantur Rathore 08e2cd6cd3 common: usb-hub: Reset USB 3.0 hubs only
Additional testing of the changes introduced in commit 33e06dcbe5 "common:
usb-hub: Reset hub port before scanning") revealed that some USB 2.0 and 3.0
flash drives didn't work in U-Boot on some Allwinner SoCs that support USB
2.0 interfaces only.  More precisely, some of the tested USB 2.0 and 3.0
flash drives failed to be detected and work on an OrangePi Zero 3, based on
the Allwinner H616 SoC that supports USB 2.0 only, while the same USB flash
drives worked just fine on a Pine64 H64, based on the Allwinner H6 SoC that
supports both USB 2.0 and USB 3.0 interfaces.

The USB ID of the above-mentioned USB 3.0 flash drive that failed to work is
1f75:0917 (Innostor Technology Corporation IS917 Mass storage), it is 32 GB
in size and sold under the PNY brand.  The mentioned USB 2.0 drive is some
inexpensive no-name drive with an invalid USB ID.

Resetting USB 3.0 hubs only, which this patch introduces to the USB hub
resets, has been tested to work as expected, resolving the identified issues
on the Allwinner H616, while not introducing any new issues on other tested
Allwinner SoCs.  Thus, let's fix it that way.

According to the USB 3.0 specification, resetting a USB 3.0 port is required
when an attached USB device transitions between different states, such as
when it resumes from suspend.  Though, the Linux kernel performs additional
USB 3.0 port resets upon initial USB device attachment, as visible in commit
07194ab7be63 ("USB: Reset USB 3.0 devices on (re)discovery") in the kernel
source, to ensure proper state of the USB 3.0 hub port and proper USB mode
negotiation during the initial USB device attachment and enumeration.

These additional types of USB port resets don't exist for USB 2.0 hubs,
according the USB 2.0 specification.  The resets seem to be added to the USB
3.0 specification as part of the port and device mode negotiation.

The Linux kernel resets USB 3.0 (i.e. SuperSpeed) hubs only, as visible in
commit 10d674a82e55 ("USB: When hot reset for USB3 fails, try warm reset.")
in the kernel source.  The check for SuperSpeed hubs is performed in a way
that also applies to newer SuperSpeed Plus (USB 3.1 or 3.2) hubs as well,
which hopefully makes it future proof.

Fixes: 33e06dcbe5 ("common: usb-hub: Reset hub port before scanning")

Link:
https://lore.kernel.org/u-boot/20240207102327.35125-1-i@shantur.com/T/#u
Link:
https://lore.kernel.org/u-boot/20240201164604.13315fa6@donnerap.manchester.arm.com/T/#u

Signed-off-by: Shantur Rathore <i@shantur.com>
Helped-by: Dragan Simic <dsimic@manjaro.org>
Tested-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2024-02-19 20:08:41 +01:00
..
eeprom SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
init spl: Use SYS_MALLOC_F instead of SYS_MALLOC_F_LEN 2023-10-06 14:38:12 -04:00
spl spl: Make SPL_STACK available for ROCKCHIP_RK3036 without spl framework 2024-02-04 18:01:03 +08:00
autoboot.c autoboot: Rework CONFIG_AUTOBOOT_STOP_STR_* usage 2023-01-20 12:27:06 -05:00
avb_verify.c common: avb_verify: add str_avb_io_error/str_avb_slot_error 2024-02-15 10:38:34 +01:00
bloblist.c bloblist: Add alignment to bloblist_new() 2023-12-31 07:21:02 -07:00
board_f.c video: Skip framebuffer reservation if already reserved 2024-01-29 14:49:17 -05:00
board_info.c sysinfo: Allow displaying more info on startup 2023-11-28 12:53:04 -05:00
board_r.c scsi: Forceably finish migration to DM_SCSI 2023-11-07 18:36:06 -05:00
bootstage.c bootstage: Correct exhasuted typo 2023-11-14 20:04:01 -07:00
bouncebuf.c common: bouncebuf: Add missing cast to dma_addr_t 2023-08-22 15:17:52 -04:00
button_cmd.c boot: add support for button commands 2024-02-13 15:38:49 -05:00
cli.c cli: add modern hush as parser for run_command*() 2023-12-28 12:02:56 -05:00
cli_getch.c cli: Consume invalid escape sequences early 2023-10-24 16:34:45 -04:00
cli_hush.c common: hush: Remove unused NEEDS_MANUAL_RELOC code bits 2023-09-14 10:42:24 -04:00
cli_hush_modern.c Merge patch series "Modernize U-Boot shell" 2023-12-28 14:38:25 -05:00
cli_hush_upstream.c cli: modern_hush: Add upstream commits up to 2nd October 2023. 2023-12-28 12:02:56 -05:00
cli_readline.c getchar(): Correct usage 2024-01-18 20:24:13 -05:00
cli_simple.c cli_simple: Rework this support slightly 2023-11-07 14:48:51 -05:00
command.c cmd/command.c: relax length check in cmd_get_data_size() 2024-01-16 17:05:29 -05:00
console.c common: console: Fix print complete stdio device list 2024-01-24 11:12:11 -05:00
cros_ec.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
cyclic.c cyclic: get rid of cyclic_init() 2022-11-02 08:42:03 +01:00
ddr_spd.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
dfu.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
dlmalloc.c malloc: Enable assertions if UNIT_TEST is enabled 2023-10-11 13:22:29 -04:00
dlmalloc.src Consolidate bool type 2013-04-01 16:33:52 -04:00
edid.c doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
event.c common: event: check event_type_name() argument 2024-02-06 16:31:06 -05:00
exports.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
flash.c Audit <flash.h> inclusion 2022-08-04 16:18:47 -04:00
hash.c common: hash: Remove unused NEEDS_MANUAL_RELOC code bits 2023-09-14 10:42:24 -04:00
hwconfig.c hwconfig: Allow to use restricted env 2022-08-20 18:12:51 -04:00
iomux.c IOMUX: Fix buffer overflow in iomux_replace_device() 2021-04-27 08:05:30 -04:00
iotrace.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
kallsyms.c global: Convert simple_strtoul() with hex to hextoul() 2021-08-02 13:32:14 -04:00
Kconfig Kconfig: Move CONFIG_SYS_[CP]BSIZE to common/Kconfig 2023-11-07 14:48:19 -05:00
kgdb.c common: board_r: drop initr_kgdb wrapper 2022-01-18 08:31:02 -05:00
kgdb_stubs.c common: Drop asm/ptrace.h from common header 2020-05-18 21:19:23 -04:00
log.c log: Tidy up an ambiguous comment 2023-07-17 17:12:07 +08:00
log_console.c log: Support outputing function names in SPL 2023-07-17 17:23:15 +08:00
log_syslog.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
main.c boot: add support for button commands 2024-02-13 15:38:49 -05:00
Makefile boot: add support for button commands 2024-02-13 15:38:49 -05:00
malloc_simple.c malloc: Annotate allocator for valgrind 2022-04-11 10:00:30 -04:00
memsize.c common/memsize.c: Fix get_ram_size() when cache is enabled 2023-06-21 16:54:25 -04:00
menu.c menu: Re-enable the ANSI codes 2023-06-23 14:38:16 -04:00
miiphyutil.c Convert CONFIG_PHY_RESET_DELAY to Kconfig 2022-03-25 12:01:15 +00:00
qfw.c qemu: Move qfw kernel setup into a common file 2023-02-06 13:04:53 -05:00
s_record.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
scp03.c common: SCP03 control (enable and provision of keys) 2021-03-13 13:14:52 -05:00
splash.c common: Replace #ifdef and #if with if's 2023-04-24 21:37:45 +02:00
splash_source.c common: splash_source: Don't compile ubifs splash cmd for SPL build 2024-01-29 14:50:05 -05:00
stackprot.c Fix stack-protector for powerpc 2023-11-29 09:32:15 -05:00
stdio.c stdio: fix stdio_deregister_dev() 2023-10-09 15:24:31 -04:00
system_map.c Add support for Linux-like kallsysms 2009-06-12 20:45:48 +02:00
update.c common: Drop linux/printk.h from common header 2023-09-24 09:54:57 -04:00
usb.c usb: Tidy up the usb_start flag 2023-05-13 09:52:32 -04:00
usb_hub.c common: usb-hub: Reset USB 3.0 hubs only 2024-02-19 20:08:41 +01:00
usb_kbd.c cyclic: Use schedule() instead of WATCHDOG_RESET() 2022-09-18 10:26:33 +02:00
usb_onboard_hub.c usb: onboard-hub: add driver to manage onboard hub supplies 2023-01-12 16:19:53 +01:00
usb_storage.c usb: storage: Use the correct CBW lengths 2023-12-01 14:06:12 +01:00
version.c version: Separate our version string from the version command 2023-11-07 14:48:19 -05:00
xyzModem.c cyclic: Use schedule() instead of WATCHDOG_RESET() 2022-09-18 10:26:33 +02:00