u-boot/drivers/usb/host
Fabrice Gasnier 5b43bc97ee usb: check for companion controller in uclass
EHCI is usually used with companion controller (like OHCI) as companion
controller. This information on the companion is missing currently in
companion drivers.
So, if the usb-uclass isn't aware, it may scan busses in any order: OHCI
first, then EHCI.
This is seen on STM32MP1 where DT probing makes the probe order to occur
by increasing address (OHCI address < EHCI address).

When a low speed or full-speed device is plugged in, it's not detected as
EHCI should first detect it, and give ownership (handover) to OHCI.

Current situation on STM32MP1 (with a low speed device plugged-in)
STM32MP> usb start
starting USB...
Bus usb@5800c000: USB OHCI 1.0
Bus usb@5800d000: USB EHCI 1.00
scanning bus usb@5800c000 for devices... 1 USB Device(s) found
scanning bus usb@5800d000 for devices... 1 USB Device(s) found
   scanning usb for storage devices... 0 Storage Device(s) found

The "companion" property in the device tree allow to retrieve companion
controller information, from the EHCI node. This allow marking the
companion driver as such.

With this patch (same low speed device plugged in):
STM32MP> usb start
starting USB...
Bus usb@5800c000: USB OHCI 1.0
Bus usb@5800d000: USB EHCI 1.00
scanning bus usb@5800d000 for devices... 1 USB Device(s) found
scanning bus usb@5800c000 for devices... 2 USB Device(s) found
   scanning usb for storage devices... 0 Storage Device(s) found
STM32MP> usb tree
USB device tree:
1  Hub (12 Mb/s, 0mA)
|   U-Boot Root Hub
|
+-2  Human Interface (1.5 Mb/s, 100mA)
   HP HP USB 1000dpi Laser Mouse

1  Hub (480 Mb/s, 0mA)
 u-boot EHCI Host Controller

This also optimize bus scan when a High speed device is plugged in, as
the usb-uclass skips OHCI in this case:

STM32MP> usb reset
resetting USB...
Bus usb@5800c000: USB OHCI 1.0
Bus usb@5800d000: USB EHCI 1.00
scanning bus usb@5800d000 for devices... 2 USB Device(s) found
   scanning usb for storage devices... 1 Storage Device(s) found
STM32MP> usb tree
USB device tree:
1  Hub (480 Mb/s, 0mA)
|  u-boot EHCI Host Controller
|
+-2  Mass Storage (480 Mb/s, 200mA)
   SanDisk Cruzer Blade 03003432021922011407

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
2023-09-04 18:25:20 +02:00
..
dwc2.c usb: dwc2: Use regulator_set_enable_if_allowed 2023-08-14 09:14:41 -04:00
dwc2.h usb: dwc2: Fix the write to W1C fields in HPRT register 2023-06-21 13:15:58 +02:00
dwc3-octeon-glue.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
dwc3-of-simple.c dm: treewide: Rename dev_get_platdata() to dev_get_plat() 2020-12-13 16:51:09 -07:00
dwc3-sti-glue.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
ehci-atmel.c dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
ehci-exynos.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
ehci-fsl.c usb: Remove non-DM code in ehci-fsl and xhci 2022-06-28 17:11:48 -04:00
ehci-generic.c usb: ehci-generic: Use regulator_set_enable_if_allowed 2023-08-14 09:14:41 -04:00
ehci-hcd.c usb: Drop unused ehci-faraday driver 2023-02-07 14:33:50 -05:00
ehci-marvell.c usb: ehci: ehci-marvell: Support for marvell,ac5-ehci 2022-11-07 07:46:28 +01:00
ehci-msm.c usb: ehci: Make usage of generic_{setup,shutdown}_phy() helpers 2022-10-10 18:08:18 +02:00
ehci-mx5.c global: Migrate CONFIG_MXC_USB_FLAGS et al to CFG 2022-12-23 10:14:51 -05:00
ehci-mx6.c usb: ehci-mx6: remove unnecessary regulator enable from probe 2023-07-21 02:05:10 +02:00
ehci-mxs.c ehci-mxs: Remove non-DM code 2022-06-28 17:03:30 -04:00
ehci-npcm.c usb: host: nuvoton: Add nuvoton NPCM7xx ehci/ohci driver 2022-09-26 01:49:36 +02:00
ehci-omap.c usb: ehci-omap: Use PHY system to manage phy resets 2022-02-23 05:25:17 +01:00
ehci-pci.c usb: ehci: Make usage of generic_{setup,shutdown}_phy() helpers 2022-10-10 18:08:18 +02:00
ehci-tegra.c drivers: use dev_read_addr_ptr when cast to pointer 2023-05-06 17:28:18 +08:00
ehci-vf.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
ehci-zynq.c dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
ehci.h usb: ehci: Remove unused ehci_{setup,shutdown}_phy() helpers 2022-10-10 18:08:18 +02:00
Kconfig usb: Move SPL_USB_HOST Kconfig symbol to drivers/usb/ 2023-05-17 01:51:39 +02:00
Makefile usb: Drop unused sl811-hcd driver 2023-02-07 14:33:50 -05:00
ohci-at91.c Convert CONFIG_USB_OHCI_NEW et al to Kconfig 2022-07-07 09:29:08 -04:00
ohci-da8xx.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
ohci-generic.c usb: ohci: Make usage of generic_{setup,shutdown}_phy() helpers 2022-10-10 18:08:18 +02:00
ohci-hcd.c global: Move remaining CONFIG_SYS_* to CFG_SYS_* 2022-12-05 16:06:08 -05:00
ohci-lpc32xx.c global: Migrate CONFIG_USB_ISP1301_I2C_ADDR to CFG 2022-12-23 10:15:12 -05:00
ohci-npcm.c usb: host: nuvoton: Add nuvoton NPCM7xx ehci/ohci driver 2022-09-26 01:49:36 +02:00
ohci-pci.c pci: Add mask parameter to dm_pci_map_bar() 2022-05-03 18:33:29 -04:00
ohci.h usb: ohci: Use a flexible array member for portstatus 2022-11-03 23:24:09 +01:00
r8a66597-hcd.c usb: common: move urb code to common 2022-07-12 21:59:54 +02:00
r8a66597.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
usb-sandbox.c usb: sandbox: Add gadget callbacks 2021-10-12 14:20:04 +02:00
usb-uclass.c usb: check for companion controller in uclass 2023-09-04 18:25:20 +02:00
usb_bootdev.c bootstd: Use bootdev instead of bootdevice 2023-07-16 23:13:17 +08:00
xhci-brcm.c usb: xhci-brcm: Include header file needed for dev_err 2021-10-30 22:54:57 +02:00
xhci-dwc3.c usb: xhci-dwc3: Support role switch default role 2022-05-20 09:41:33 +02:00
xhci-exynos5.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
xhci-fsl.c usb: xhci-fsl: Remove non-DM code 2022-06-28 17:03:31 -04:00
xhci-mem.c usb: xhci: Implement DMA mapping 2023-01-27 14:47:58 -05:00
xhci-mtk.c usb: xhci-mtk: modify the SOF/ITP interval for mt8195 2023-03-02 22:43:43 +01:00
xhci-mvebu.c dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
xhci-omap.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
xhci-pci.c pci: Add mask parameter to dm_pci_map_bar() 2022-05-03 18:33:29 -04:00
xhci-rcar-r8a779x_usb3_v3.h WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
xhci-rcar.c dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
xhci-ring.c usb: xhci: Implement DMA mapping 2023-01-27 14:47:58 -05:00
xhci.c usb: xhci: Fix double free on failure 2023-07-27 03:59:38 +02:00