u-boot/drivers/usb
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
..
common fsl/usb: enable errata-a010151 for ls2088a and ls2081a 2017-08-01 08:28:56 -07:00
dwc3 usb: dwc3: fix Kconfig dependency to accept host driver in drivers/usb/dwc3 2017-08-28 22:32:34 +02:00
emul usb: emul: hub: Report the actual device speed of the emulation device 2017-10-01 16:32:51 +02:00
eth usb: net: migrate USB Ethernet adapters to Kconfig 2017-09-08 10:23:00 -04:00
gadget usb: dwc2: Align size of invalidating dcache before starting DMA 2017-09-27 12:12:23 +02:00
host dm: usb: Fix broken usb_stop() 2017-10-01 16:32:51 +02:00
musb omap4: Drop redundant CONFIG_OMAP4430 symbol 2017-05-15 10:39:59 -04:00
musb-new avr32: Retire AVR32 for good 2017-07-06 16:17:19 -04:00
phy treewide: replace #include <asm-generic/errno.h> with <linux/errno.h> 2016-09-23 22:25:27 -04:00
ulpi usb: ulpi: Fix compile warning in read/write on 64-bit machines. 2016-04-01 17:18:09 -04:00
Kconfig usb: kbd: Set a default polling mechanism for USB keyboard 2017-09-27 12:12:23 +02:00