This series adds driver model support to USB. The intent is to permit the various subsystems (OHCI, EHCI, XHCI) to co-exist and allow any number of USB ports of different types.
With the RFC series, only USB controllers had a real driver model device. USB devices (including the hub in the controller) were not modelled as driver model devices. While this was expedient, and produced much fewer patches, it is not a long-term solution. Also, since then, driver model Ethernet support (which USB can use) has been merged to u-boot-dm/next. It seems better to bite the bullet and do a full conversion. Unfortunately this results in a very large series. It includes: - USB uclass - USB hub uclass - Adjustments to make USB keyboard, Ethernet and storage continue to work - Sandbox USB emulation support - Sandbox USB emulations for flash and hub devices - A reasonable set of tests - EHCI and XHCI support (not OHCI) - Conversion of Tegra and Exynos drivers to driver model - Adjustments to make the 'usb' command operate as expected - README describing how USB works with driver model Both EHCI and XHCI needed a little bit of refactoring before they are converted to driver model - e.g. removal of weak fuctions and splitting up the init code. This series includes patches to remove the non-driver-model code for Exynos and Tegra, to be applied once everything is stable. For now it is convenient to be able to compare the two options. This series does not change how USB is started up. The 'usb start' command scans the buses as before, and takes just as long. Once it has started you can use 'dm tree' to see the tree structure of the USB bus, although 'usb tree' provides a better view. It is unclear how we could implement lazy init for USB given the long time it takes to probe the bus. A README is provided to describe how USB works under driver model. This series is available at u-boot-dm/usb-working. Changes in v2: - Rewrite and expand series to support driver model fully Simon Glass (80): linker_lists: Add a function to access a linker list entry sandbox: Fix comment for os_open() dm: test: bus: Use a local variable to simplify code dm: exynos: snow: Move the keyboard to I2C dm: core: Support allocating driver-private data for DMA dm: core: Convert driver_bind() to use const dm: core: Rename driver data function to dev_get_driver_data() dm: core: Mark device as active before calling uclass probe() methods dm: core: Add device children and sibling functions dm: gpio: Add an implementation for gpio_get_number() dm: usb: Add a uclass for USB controllers dm: usb: Adjust usb command to prepare for driver model dm: usb: Adjust usb_alloc_new_device() to return an error dm: usb: Convert 'usb' command to support driver model dm: usb: Drop the legacy USB init sequence dm: usb: Refactor port resets dm: usb: Move descriptor setup code into its own function dm: usb: Split out more code from usb_new_device() dm: usb: Complete the splitting up of usb_new_device() dm: usb: Convert core usb.c file to support driver model dm: usb: Split hub detection into its own function dm: usb: Add driver model support for hubs dm: usb: Move USB storage definitions to usb_defs.h dm: usb: Fix type problems in usb_stor_get_info() dm: usb: Simply device finding code in usb_storage dm: usb: Adjust usb_storage to work with sandbox dm: usb: Move storage device scanning into its own function dm: usb: Convert usb_storage to driver model dm: usb: Move all the EHCI weak functions together and declare them dm: usb: Pass EHCI controller pointer to ehci_get_port_speed() dm: usb: Allow ECHI to hold private data for the controller dm: usb: tegra: Store the controller type explicitly dm: usb: Pass EHCI controller pointer to ehci_powerup_fixup() dm: usb: tegra: Drop use of global controller variable dm: usb: Pass EHCI controller pointer to ehci_set_usbmode() dm: usb: Pass EHCI controller pointer to ehci_get_portsc_register() dm: usb: ehci: Use a function to find the controller from struct udevice dm: usb: Refactor EHCI init dm: usb: Drop the EHCI weak functions dm: usb: Change ehci_reset() to use a pointer dm: usb: Add driver model support to EHCI dm: usb: Allow USB drivers to be declared and auto-probed dm: usb: Bind generic USB devices when there is no driver dm: usb: Allow setting up a USB controller as a device/gadget dm: usb: Split out the keyboard probe into its own function dm: usb: Support driver model with USB keyboards dm: usb: tegra: Add vbus GPIOs for nyan dm: usb: Move struct usb_string to a common place dm: usb: sandbox: Add a uclass for USB device emulation dm: usb: sandbox: Reset emulation devices in usb stop() dm: usb: sandbox: Add an emulator for USB flash devices dm: usb: sandbox: Add an emulator for USB hub emulation dm: usb: sandbox: Add a driver for sandbox dm: usb: dts: sandbox: Add some sample USB devices to sandbox dm: usb: Add support for USB ethernet devices with driver model dm: usb: exynos: Add driver model support to exynos EHCI dm: usb: tegra: Remove the port_addr_clear_csc variable dm: usb: tegra: Tidy up error handling and a static function dm: usb: tegra: Move most of init/uninit into a function dm: usb: tegra: Add driver model support to tegra EHCI dm: usb: xhci: Use a function to get xhci_ctrl dm: usb: xhci: Use explicit parameters for xhci_alloc_virt_device() dm: usb: xhci: Use explicit parameters for xhci_setup_addressable_virt_dev() dm: usb: xhci: Factor out common init/uninit dm: usb: Support driver model in XHCI dm: usb: Rename the XHCI HCD to U-Boot dm: usb: exynos: Adjust XHCI driver to support driver model dm: usb: exynos: Use driver model for USB dm: usb: exynos: Enable both USB ports on snow dm: usb: exynos: Enable both EHCI and XHCI on snow dm: usb: tegra: Move to driver model for USB dm: usb: Add a generic descriptor struct dm: usb: Tidy up pipe value decoding dm: usb: sandbox: Enable USB dm: test: Correct printf() output nit in 'dm uclass' dm: test: Allow 'dm test' to select a particular test to run dm: usb: Add tests for the USB uclass dm: usb: tegra: Drop legacy USB code dm: usb: exynos: Drop legacy USB code dm: usb: Add a README for driver model Makefile | 1 + arch/arm/cpu/armv7/exynos/Kconfig | 3 + arch/arm/dts/exynos5250-snow.dts | 5 +- arch/arm/dts/tegra124-nyan-big.dts | 2 + arch/arm/mach-tegra/Kconfig | 3 + arch/sandbox/dts/sandbox.dts | 40 ++ board/genesi/mx51_efikamx/efikamx-usb.c | 4 +- board/nvidia/common/board.c | 1 - common/cmd_usb.c | 198 ++++++++-- common/usb.c | 277 ++++++++------ common/usb_hub.c | 194 ++++++++-- common/usb_kbd.c | 119 ++++-- common/usb_storage.c | 249 ++++++------ configs/sandbox_defconfig | 4 + doc/driver-model/usb-info.txt | 415 ++++++++++++++++++++ drivers/core/device-remove.c | 4 +- drivers/core/device.c | 66 +++- drivers/core/lists.c | 2 +- drivers/gpio/gpio-uclass.c | 12 + drivers/i2c/s3c24x0_i2c.c | 2 +- drivers/i2c/tegra_i2c.c | 6 +- drivers/usb/Kconfig | 16 + drivers/usb/emul/Kconfig | 8 + drivers/usb/emul/Makefile | 10 + drivers/usb/emul/sandbox_flash.c | 423 +++++++++++++++++++++ drivers/usb/emul/sandbox_hub.c | 303 +++++++++++++++ drivers/usb/emul/usb-emul-uclass.c | 263 +++++++++++++ drivers/usb/eth/usb_ether.c | 52 ++- drivers/usb/gadget/ci_udc.c | 4 + drivers/usb/host/Makefile | 5 + drivers/usb/host/ehci-exynos.c | 127 +++---- drivers/usb/host/ehci-faraday.c | 112 +++--- drivers/usb/host/ehci-hcd.c | 379 ++++++++++++++----- drivers/usb/host/ehci-mx5.c | 12 + drivers/usb/host/ehci-tegra.c | 288 +++++++------- drivers/usb/host/ehci.h | 47 +++ drivers/usb/host/usb-sandbox.c | 117 ++++++ drivers/usb/host/usb-uclass.c | 645 ++++++++++++++++++++++++++++++++ drivers/usb/host/xhci-exynos5.c | 106 +++--- drivers/usb/host/xhci-mem.c | 24 +- drivers/usb/host/xhci-ring.c | 8 +- drivers/usb/host/xhci.c | 312 ++++++++++++--- drivers/usb/host/xhci.h | 31 +- drivers/usb/musb-new/musb_uboot.c | 4 +- include/configs/sandbox.h | 2 + include/configs/snow.h | 2 + include/dm/device-internal.h | 2 +- include/dm/device.h | 51 ++- include/dm/test.h | 7 +- include/dm/uclass-id.h | 5 + include/fdtdec.h | 5 - include/linker_lists.h | 10 + include/linux/usb/ch9.h | 18 + include/linux/usb/gadget.h | 13 - include/os.h | 2 +- include/usb.h | 494 +++++++++++++++++++++++- include/usb_defs.h | 68 +++- lib/fdtdec.c | 5 - test/dm/Makefile | 1 + test/dm/bus.c | 16 +- test/dm/cmd_dm.c | 13 +- test/dm/test-dm.sh | 3 + test/dm/test-main.c | 7 +- test/dm/test-uclass.c | 3 +- test/dm/test.dts | 41 ++ test/dm/usb.c | 50 +++ 66 files changed, 4807 insertions(+), 914 deletions(-) create mode 100644 doc/driver-model/usb-info.txt create mode 100644 drivers/usb/emul/Kconfig create mode 100644 drivers/usb/emul/Makefile create mode 100644 drivers/usb/emul/sandbox_flash.c create mode 100644 drivers/usb/emul/sandbox_hub.c create mode 100644 drivers/usb/emul/usb-emul-uclass.c create mode 100644 drivers/usb/host/usb-sandbox.c create mode 100644 drivers/usb/host/usb-uclass.c create mode 100644 test/dm/usb.c -- 2.2.0.rc0.207.ga3a616c _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot