Refactor USB Host Drivers

Registered by Deepak Saxena

The USB stack in the linux kernel is currently written such that only one USB controller can be built at a time, regardless of whether it is modular or a static-linked driver. This is due to legacy code that was expanded over time with build-time interface implementations that are selected based on controller type. From the code (drivers/usb/host/ehci-hcd.c):

#ifdef CONFIG_USB_EHCI_MXC
#include "ehci-mxc.c"
#define PLATFORM_DRIVER ehci_mxc_driver
#endif

#ifdef CONFIG_USB_EHCI_HCD_OMAP
#include "ehci-omap.c"
#define PLATFORM_DRIVER ehci_hcd_omap_driver
#endif

From drivers/usb/host/ohci-hcd.c:

#ifdef CONFIG_PCI
#include "ohci-pci.c"
#define PCI_DRIVER ohci_pci_driver
#endif

#if defined(CONFIG_ARCH_SA1100) && defined(CONFIG_SA1111)
#include "ohci-sa1111.c"
#define SA1111_DRIVER ohci_hcd_sa1111_driver
#endif

#if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S3C64XX)
#include "ohci-s3c2410.c"
#define PLATFORM_DRIVER ohci_hcd_s3c2410_driver
#endif

#ifdef CONFIG_USB_OHCI_EXYNOS
#include "ohci-exynos.c"
#define PLATFORM_DRIVER exynos_ohci_driver
#endif

Due to this limitation, even if we build a kernel that boots on multiple SOCs, it will be limited to only supporting the USB controller on one of these. This blueprint tracks the refactoring of the USB host code to allow building of individual controllers as low level bus interface modules.

Blueprint information

Status:
Complete
Approver:
Arnd Bergmann
Priority:
High
Drafter:
None
Direction:
Approved
Assignee:
manjunath goudar
Definition:
Approved
Series goal:
Accepted for kernel-merge-window
Implementation:
Implemented
Milestone target:
milestone icon 3.11
Started by
Jakub Pavelek
Completed by
Jakub Pavelek

Related branches

Sprints

Whiteboard

Meta:
Roadmap id: KWG2011-SINGLE-KERNEL-BINARY
Headline: Refactor USB stack to allow building of multiple controllers at once
Acceptance:
   * Code is merged upstream into Linux tip tree.
   * upstream GIT commit link or hash logged here for verification

[jakub-pavelek 2013-02-25] moved from 3.9 to 3.10

[arnd-arndb-de] all EHCI patches aside from tegra and mmp are merged into 3.10
as of 9fc377799bc9bfd8d5cb35d0d1ea2e2458cbdbb3, for OHCI a workaround in in place now that circumvents the problem, but we still want to do a proper patch.
[jakub-pavelek 2013-05-10] Moving from 3.10 to 3.11 for completion. Thanks for the updates.

(?)

Work Items

Work items for 12.12:
Analyzing ehci-hcd and echi-omap source code (Dec 7): DONE
Studying existing ehci-platform,echi-mxc, ehci-spear, and ehci-orion code (Dec 7): DONE
Write OMAP MXC and Spear host controller driver to separate from ehci-hcd host code into its own driver module and patch is submitted to linaro (Dec 28): DONE

Work items for 13.01:
Write Orine host controller driver to separate from ehci-hcd host code into its own driver module (Jan 04): DONE
Prepare EHCI driver for conversion according to discussion: DONE
Write Tegra host controller driver to separate from ehci-hcd host code into its own driver module : DONE
Split out all platform glue code from EHCI driver: DONE

Work items for backlog:
Prepare OHCI driver for conversion according to discussion: TODO
Split out all platform glue code from OHCI driver: TODO
Agree on approach for UHCI driver: TODO
Decide on approach for MUSB driver: TODO
Implement a way for multiple MUSB platform drivers to coexist: TODO
Implement a way for multiple MUSB DMA implementation to coexist: TODO
Get patches accepted by Alan Stern and GregKH: TODO
Get patches accepted into the mainline kernel: TODO

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.