u-boot-brain/drivers/usb/host
Bin Meng d4efefe32e dm: usb: Fix broken usb_stop()
At present we only do device_remove() during usb stop. The DM API
device_remove() only marks the device state as inactivated, but
still keeps its USB topology (eg: parent, children, etc) in the DM
device structure. There is no issue if we only start USB subsystem
once and never stop it. But a big issue occurs when we do 'usb stop'
and 'usb start' multiple times.

Strange things may be observed with current implementation, like:
- the enumeration may report only 1 mass storage device is detected,
  but the total number of USB devices is correct.
- USB keyboard does not work anymore after a bunch of 'usb reset'
  even if 'usb tree' shows it is correctly identified.
- read/write flash drive via 'fatload usb' may complain "Bad device"

In fact, every time when USB host controller starts the enumeration
process, it takes random time for each USB port to show up online,
hence each USB device may appear in a different order from previous
enumeration, and gets assigned to a totally different USB address.
As a result, we end up using a stale USB topology in the DM device
structure which still reflects the previous enumeration result, and
it may create an exact same DM device name like generic_bus_0_dev_7
that is already in the DM device structure. And since the DM device
structure is there, there is no device_bind() call to bind driver to
the device during current enumeration process, eventually creating
an inconsistent software representation of the hardware topology, a
non-working USB subsystem.

The fix is to clear the unused USB topology in the usb_stop(), by
calling device_unbind() on each controller's root hub device, and
the unbinding will unbind all of its children automatically.

For Sandbox, we need scan the device tree each time when we start
the USB stack, in order to re-create the emulated USB devices and
bind drivers for them before we actually do the driver probe.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01 16:32:51 +02:00
..
dwc2.c usb: dwc2: convert to livetree 2017-09-27 12:12:22 +02:00
dwc2.h usb: dwc2: disable erroneous overcurrent condition 2016-03-05 02:21:36 +01:00
dwc3-sti-glue.c usb: dwc3: Add dwc3 glue driver support for STi 2017-09-22 07:39:59 -04:00
ehci-armada100.c Update Maintainer and Author's email address 2016-12-27 11:24:17 -05:00
ehci-atmel.c dm: Rename dev_addr..() functions 2017-06-01 07:03:01 -06:00
ehci-exynos.c dm: Rename dev_addr..() functions 2017-06-01 07:03:01 -06:00
ehci-faraday.c dm: usb: Drop the EHCI weak functions 2015-04-18 11:11:24 -06:00
ehci-fsl.c env: Rename getenv/_f() to env_get() 2017-08-16 08:30:24 -04:00
ehci-generic.c usb: host: ehci-generic: convert to livetree 2017-09-27 12:12:23 +02:00
ehci-hcd.c dm: usb: ehci: Implement get_max_xfer_size() operation 2017-09-27 12:12:22 +02:00
ehci-marvell.c dm: core: Rename of_device_is_compatible() 2017-06-01 07:03:06 -06:00
ehci-msm.c dm: Rename dev_addr..() functions 2017-06-01 07:03:01 -06:00
ehci-mx5.c usb: Rename ehci-fsl.h to ehci-ci.h 2016-04-01 17:18:10 -04:00
ehci-mx6.c imx: reorganize IMX code as other SOCs 2017-07-12 10:17:44 +02:00
ehci-mxc.c usb: Rename ehci-fsl.h to ehci-ci.h 2016-04-01 17:18:10 -04:00
ehci-mxs.c usb: ehci: mxs: Add board-specific callbacks 2014-09-29 09:02:16 +02:00
ehci-omap.c usb: ehci-omap: Reset the USB Host OMAP module 2013-12-06 07:02:32 -05:00
ehci-pci.c ehci-pci: Prepare for usage of readl()/writel() accessors 2017-06-05 13:42:09 +02:00
ehci-ppc4xx.c ehci-ppc4xx: Prepare for usage of readl()/writel() accessors 2017-04-25 12:50:13 +02:00
ehci-rcar_gen3.c usb: ehci: Add Renesas RCar M3/H3 EHCI support 2017-05-22 11:47:27 +02:00
ehci-rmobile.c usb: rmobile: Use ARRAY_SIZE(usb_base_address) instead of CONFIG_USB_MAX_CONTROLLER_COUNT 2014-11-07 16:32:02 +01:00
ehci-spear.c usb: spear: Add support for both SPEAr600 EHCI controllers 2015-08-19 22:30:20 +02:00
ehci-sunxi.c dm: Rename dev_addr..() functions 2017-06-01 07:03:01 -06:00
ehci-tegra.c dm: tegra: usb: Convert to livetree 2017-07-28 12:02:47 -06:00
ehci-vct.c usb: ehci-hcd: add enum usb_init_type parameter to ehci_hcd_init. 2013-10-20 23:46:27 +02:00
ehci-vf.c imx: reorganize IMX code as other SOCs 2017-07-12 10:17:44 +02:00
ehci-zynq.c dm: Rename dev_addr..() functions 2017-06-01 07:03:01 -06:00
ehci.h usb: ehci: Get rid of CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 2017-07-28 23:34:23 +02:00
isp116x-hcd.c Remove some merge markers 2016-10-23 18:33:18 -04:00
isp116x.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
Kconfig usb: dwc3: Add dwc3 glue driver support for STi 2017-09-22 07:39:59 -04:00
Makefile usb: dwc3: Add dwc3 glue driver support for STi 2017-09-22 07:39:59 -04:00
ohci-at91.c drivers: usb: ohci-at91: clean up the PLLB code 2016-02-18 21:34:41 +01:00
ohci-da8xx.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
ohci-ep93xx.c arm: ep9315: Return back Cirrus Logic EDB9315A board support 2014-07-04 23:45:48 +02:00
ohci-generic.c usb: host: ohci-generic: initialize PHY only when found 2017-07-28 23:34:43 +02:00
ohci-hcd.c powerpc: remove 4xx support 2017-07-03 17:35:28 -04:00
ohci-lpc32xx.c usb: lpc32xx: add i2c DM support 2017-05-18 11:31:56 +02:00
ohci-sunxi.c dm: Rename dev_addr..() functions 2017-06-01 07:03:01 -06:00
ohci.h powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x 2017-06-16 10:14:55 -04:00
r8a66597-hcd.c Move console definitions into a new console.h file 2015-11-19 20:27:50 -07:00
r8a66597.h usb: Update some EHCI driver licenses to use SPDX 2015-07-21 17:39:38 -06:00
sl811-hcd.c usb: add enum usb_init_type parameter to usb_lowlevel_init 2013-10-20 23:45:26 +02:00
sl811.h drivers/usb: regorganisation 2009-04-06 20:40:46 +02:00
usb-sandbox.c usb: sandbox: Fix emulator device select logic in usb_emul_find_devnum() 2017-10-01 16:32:50 +02:00
usb-uclass.c dm: usb: Fix broken usb_stop() 2017-10-01 16:32:51 +02:00
utmi-armada100.c Update Maintainer and Author's email address 2016-12-27 11:24:17 -05:00
xhci-dwc3.c usb: host: xhci-dxc3: fix compilation warnings 2017-07-28 23:34:45 +02:00
xhci-exynos5.c dm: Rename dev_addr..() functions 2017-06-01 07:03:01 -06:00
xhci-fsl.c dm: Rename dev_addr..() functions 2017-06-01 07:03:01 -06:00
xhci-keystone.c treewide: replace #include <asm-generic/errno.h> with <linux/errno.h> 2016-09-23 22:25:27 -04:00
xhci-mem.c usb: xhci: Enable TT to support LS/FS devices behind a HS hub 2017-07-28 23:34:37 +02:00
xhci-mvebu.c dm: Rename dev_addr..() functions 2017-06-01 07:03:01 -06:00
xhci-omap.c arm: am57xx: cl-som-am57x: invoke clock API to enable/disable clocks 2017-05-08 11:38:38 -04:00
xhci-pci.c usb: xhci-pci: Clean up the driver a little bit 2017-07-28 23:34:29 +02:00
xhci-ring.c usb: xhci: Correct command TRB 4th dword initialization 2017-07-28 23:34:15 +02:00
xhci-rockchip.c rockchip: xhci: Convert to livetree 2017-09-27 12:12:22 +02:00
xhci-zynqmp.c treewide: replace #include <asm-generic/errno.h> with <linux/errno.h> 2016-09-23 22:25:27 -04:00
xhci.c dm: usb: xhci: Implement get_max_xfer_size() operation 2017-09-27 12:12:22 +02:00
xhci.h usb: xhci: Set number of event segments and entries to 1 2017-09-27 12:12:21 +02:00