kernel-ark/drivers/usb/host
Sarah Sharp f6ff0ac878 xhci: Register second xHCI roothub.
This patch changes the xHCI driver to allocate two roothubs.  This touches
the driver initialization and shutdown paths, roothub emulation code, and
port status change event handlers.  This is a rather large patch, but it
can't be broken up, or it would break git-bisect.

Make the xHCI driver register its own PCI probe function.  This will call
the USB core to create the USB 2.0 roothub, and then create the USB 3.0
roothub.  This gets the code for registering a shared roothub out of the
USB core, and allows other HCDs later to decide if and how many shared
roothubs they want to allocate.

Make sure the xHCI's reset method marks the xHCI host controller's primary
roothub as the USB 2.0 roothub.  This ensures that the high speed bus will
be processed first when the PCI device is resumed, and any USB 3.0 devices
that have migrated over to high speed will migrate back after being reset.
This ensures that USB persist works with these odd devices.

The reset method will also mark the xHCI USB2 roothub as having an
integrated TT.  Like EHCI host controllers with a "rate matching hub" the
xHCI USB 2.0 roothub doesn't have an OHCI or UHCI companion controller.
It doesn't really have a TT, but we'll lie and say it has an integrated
TT.  We need to do this because the USB core will reject LS/FS devices
under a HS hub without a TT.

Other details:
-------------

The roothub emulation code is changed to return the correct number of
ports for the two roothubs.  For the USB 3.0 roothub, it only reports the
USB 3.0 ports.  For the USB 2.0 roothub, it reports all the LS/FS/HS
ports.  The code to disable a port now checks the speed of the roothub,
and refuses to disable SuperSpeed ports under the USB 3.0 roothub.

The code for initializing a new device context must be changed to set the
proper roothub port number.  Since we've split the xHCI host into two
roothubs, we can't just use the port number in the ancestor hub.  Instead,
we loop through the array of hardware port status register speeds and find
the Nth port with a similar speed.

The port status change event handler is updated to figure out whether the
port that reported the change is a USB 3.0 port, or a non-SuperSpeed port.
Once it figures out the port speed, it kicks the proper roothub.

The function to find a slot ID based on the port index is updated to take
into account that the two roothubs will have over-lapping port indexes.
It checks that the virtual device with a matching port index is the same
speed as the passed in roothub.

There's also changes to the driver initialization and shutdown paths:

 1. Make sure that the xhci_hcd pointer is shared across the two
    usb_hcd structures.  The xhci_hcd pointer is allocated and the
    registers are mapped in when xhci_pci_setup() is called with the
    primary HCD.  When xhci_pci_setup() is called with the non-primary
    HCD, the xhci_hcd pointer is stored.

 2. Make sure to set the sg_tablesize for both usb_hcd structures.  Set
    the PCI DMA mask for the non-primary HCD to allow for 64-bit or 32-bit
    DMA.  (The PCI DMA mask is set from the primary HCD further down in
    the xhci_pci_setup() function.)

 3. Ensure that the host controller doesn't start kicking khubd in
    response to port status changes before both usb_hcd structures are
    registered.  xhci_run() only starts the xHC running once it has been
    called with the non-primary roothub.  Similarly, the xhci_stop()
    function only halts the host controller when it is called with the
    non-primary HCD.  Then on the second call, it resets and cleans up the
    MSI-X irqs.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2011-03-13 18:23:39 -07:00
..
whci USB: whci-hcd: fix compiler warning 2010-12-10 14:18:35 -08:00
ehci-atmel.c ehci-atmel: fix section mismatch warning 2011-03-11 14:18:52 -08:00
ehci-au1xxx.c USB: EHCI: fix scheduling while atomic during suspend 2011-02-03 16:57:43 -08:00
ehci-cns3xxx.c USB: cns3xxx: Add EHCI and OHCI bus glue for cns3xxx SOCs 2010-11-29 18:32:47 +03:00
ehci-dbg.c USB: EHCI: Cleanup and rewrite ehci_vdgb(). 2011-02-04 11:43:58 -08:00
ehci-fsl.c USB: ehci-fsl: Fix 'have_sysif_regs' detection 2011-01-22 18:38:58 -08:00
ehci-fsl.h USB: ehci-fsl: Fix 'have_sysif_regs' detection 2011-01-22 18:38:58 -08:00
ehci-hcd.c usb: host: Add EHCI driver for NVIDIA Tegra SoCs 2011-03-11 14:22:11 -08:00
ehci-hub.c USB 3.0 Hub Changes 2011-03-13 18:07:11 -07:00
ehci-ixp4xx.c
ehci-lpm.c USB: Mark EHCI LPM functions as __maybe_unused 2011-02-17 10:47:55 -08:00
ehci-mem.c USB: EHCI: AMD periodic frame list table quirk 2010-11-16 13:36:40 -08:00
ehci-msm.c USB: EHCI: Fix compiler warnings with MSM driver 2011-02-25 11:34:35 -08:00
ehci-mxc.c USB: ehci-mxc: add work-around for efika mx/sb bug 2011-01-22 18:48:10 -08:00
ehci-octeon.c USB: Add EHCI and OHCH glue for OCTEON II SOCs. 2010-10-29 19:08:44 +01:00
ehci-omap.c usb: host: omap: ehci and ohci simplification 2011-03-01 17:02:49 +02:00
ehci-orion.c USB: don't run ehci_reset in ehci_run for tdi device 2011-02-17 10:57:13 -08:00
ehci-pci.c USB host: Move AMD PLL quirk to pci-quirks.c 2011-03-01 16:01:45 -05:00
ehci-pmcmsp.c USB: EHCI bus glue for on-chip PMC MSP USB controller 2011-02-25 11:37:31 -08:00
ehci-ppc-of.c USB: ehci-ppc-of: problems in unwind 2010-09-03 17:33:40 -07:00
ehci-ps3.c
ehci-q.c USB: EHCI: Rearrange EHCI_URB_TRACE code to avoid GCC-4.6 warnings. 2011-02-04 11:43:59 -08:00
ehci-sched.c USB host: Move AMD PLL quirk to pci-quirks.c 2011-03-01 16:01:45 -05:00
ehci-sh.c usb: ehci-sh: Add missing ehci helpers. 2010-11-26 16:48:31 +09:00
ehci-spear.c USB host: Adding USB ehci & ohci support for spear platform 2010-11-16 13:53:29 -08:00
ehci-tegra.c USB: ehci: tegra: Align DMA transfers to 32 bytes 2011-03-11 14:22:12 -08:00
ehci-vt8500.c usb: Add support for VIA VT8500 and compatibles in EHCI HCD 2010-11-11 06:24:54 -08:00
ehci-w90x900.c usb: Add in missing EHCI helpers. 2010-11-30 16:51:21 -08:00
ehci-xilinx-of.c usb: Add in missing EHCI helpers. 2010-11-30 16:51:21 -08:00
ehci.h USB host: Move AMD PLL quirk to pci-quirks.c 2011-03-01 16:01:45 -05:00
fhci-dbg.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
fhci-hcd.c drivers: fix comment typo diable -> disable. 2011-01-03 16:08:59 +01:00
fhci-hub.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
fhci-mem.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
fhci-q.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
fhci-sched.c fix comment/printk typos concerning "already" 2010-07-11 21:45:40 +02:00
fhci-tds.c drivers: fix comment typo diable -> disable. 2011-01-03 16:08:59 +01:00
fhci.h USB: FHCI: cq_get() should check kfifo_out()'s return value 2010-05-20 13:21:46 -07:00
fsl-mph-dr-of.c USB: ehci-fsl: Fix 'have_sysif_regs' detection 2011-01-22 18:38:58 -08:00
hwa-hc.c USB: convert usb_hcd bitfields into atomic flags 2010-08-10 14:35:37 -07:00
imx21-dbg.c USB: MXC: Add i.MX21 specific USB host controller driver. 2010-03-02 14:52:55 -08:00
imx21-hcd.c USB 3.0 Hub Changes 2011-03-13 18:07:11 -07:00
imx21-hcd.h USB: imx21-hcd accept arbitary transfer buffer alignement. 2010-10-22 10:22:03 -07:00
isp116x-hcd.c USB 3.0 Hub Changes 2011-03-13 18:07:11 -07:00
isp116x.h
isp1362-hcd.c USB 3.0 Hub Changes 2011-03-13 18:07:11 -07:00
isp1362.h USB: host: Remove dead CONFIG_ARCH_KARO 2010-08-10 14:35:40 -07:00
isp1760-hcd.c USB 3.0 Hub Changes 2011-03-13 18:07:11 -07:00
isp1760-hcd.h usb/isp1760: Consolidate printouts and remove unused code 2011-02-28 19:23:38 -08:00
isp1760-if.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
Kconfig usb: host: Add EHCI driver for NVIDIA Tegra SoCs 2011-03-11 14:22:11 -08:00
Makefile USB: Add EHCI and OHCH glue for OCTEON II SOCs. 2010-10-29 19:08:44 +01:00
octeon2-common.c USB: Add EHCI and OHCH glue for OCTEON II SOCs. 2010-10-29 19:08:44 +01:00
ohci-at91.c USB: ohci-at91: fix power management hanging 2010-04-30 09:25:12 -07:00
ohci-au1xxx.c
ohci-cns3xxx.c USB: cns3xxx: Add EHCI and OHCI bus glue for cns3xxx SOCs 2010-11-29 18:32:47 +03:00
ohci-da8xx.c USB: OHCI: DA8xx/OMAP-L1x: fix up macro rename 2010-04-22 15:18:24 -07:00
ohci-dbg.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
ohci-ep93xx.c
ohci-hcd.c usb: EHCI, OHCI: Add configuration for the SH USB controller 2011-03-01 16:01:46 -05:00
ohci-hub.c USB 3.0 Hub Changes 2011-03-13 18:07:11 -07:00
ohci-jz4740.c USB: ohci-jz4740: Fix spelling in MODULE_ALIAS 2010-11-11 07:14:07 -08:00
ohci-lh7a404.c USB: Convert concatenated __FILE__ to %s, __FILE__ 2010-03-02 14:54:59 -08:00
ohci-mem.c
ohci-octeon.c USB: Add EHCI and OHCH glue for OCTEON II SOCs. 2010-10-29 19:08:44 +01:00
ohci-omap3.c usb: host: omap: ehci and ohci simplification 2011-03-01 17:02:49 +02:00
ohci-omap.c
ohci-pci.c USB: OHCI: use pci_dev->revision 2011-03-07 12:15:21 -08:00
ohci-pnx4008.c i2c: Add support for custom probe function 2010-08-11 18:20:56 +02:00
ohci-pnx8550.c
ohci-ppc-of.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
ohci-ppc-soc.c USB: Convert concatenated __FILE__ to %s, __FILE__ 2010-03-02 14:54:59 -08:00
ohci-ps3.c
ohci-pxa27x.c ARM: ohci-pxa27x: enable OHCI over U2DC for pxa3xx 2010-10-08 16:21:17 +08:00
ohci-q.c USB host: Move AMD PLL quirk to pci-quirks.c 2011-03-01 16:01:45 -05:00
ohci-s3c2410.c
ohci-sa1111.c USB: Convert concatenated __FILE__ to %s, __FILE__ 2010-03-02 14:54:59 -08:00
ohci-sh.c usb: ohci-sh: Set IRQ as shared. 2010-11-01 17:01:27 -04:00
ohci-sm501.c USB: ohci-sm501: add iounmap on error path 2010-10-22 10:21:35 -07:00
ohci-spear.c USB host: Adding USB ehci & ohci support for spear platform 2010-11-16 13:53:29 -08:00
ohci-ssb.c USB: Add USB 2.0 to ssb ohci driver 2010-08-10 14:35:44 -07:00
ohci-tmio.c
ohci.h USB host: Move AMD PLL quirk to pci-quirks.c 2011-03-01 16:01:45 -05:00
oxu210hp-hcd.c USB 3.0 Hub Changes 2011-03-13 18:07:11 -07:00
oxu210hp.h
pci-quirks.c USB host: Move AMD PLL quirk to pci-quirks.c 2011-03-01 16:01:45 -05:00
pci-quirks.h USB host: Move AMD PLL quirk to pci-quirks.c 2011-03-01 16:01:45 -05:00
r8a66597-hcd.c USB 3.0 Hub Changes 2011-03-13 18:07:11 -07:00
r8a66597.h usb: r8a66597-hcd: Change mistake of the outsw function 2010-10-22 10:22:11 -07:00
sl811_cs.c pcmcia: move driver name to struct pcmcia_driver 2010-09-29 17:20:24 +02:00
sl811-hcd.c USB 3.0 Hub Changes 2011-03-13 18:07:11 -07:00
sl811.h
u132-hcd.c USB 3.0 Hub Changes 2011-03-13 18:07:11 -07:00
uhci-debug.c BKL: remove extraneous #include <smp_lock.h> 2010-11-17 08:59:32 -08:00
uhci-hcd.c usb: host: uhci-hcd.c Remove one to many n's in a word. 2011-02-28 19:19:56 -08:00
uhci-hcd.h USB: UHCI: add support for Intel's wakeup flags 2010-08-10 14:35:38 -07:00
uhci-hub.c USB: controller resume should check the root hub 2010-08-10 14:35:37 -07:00
uhci-q.c USB: host: uhci-q: Fixed minor coding style issues 2010-12-10 14:18:36 -08:00
xhci-dbg.c USB: xhci: Correct assumptions about number of rings per endpoint. 2010-05-20 13:21:38 -07:00
xhci-ext-caps.h xHCI: prolong host controller halt time limit 2011-03-13 18:07:09 -07:00
xhci-hub.c xhci: Register second xHCI roothub. 2011-03-13 18:23:39 -07:00
xhci-mem.c xhci: Register second xHCI roothub. 2011-03-13 18:23:39 -07:00
xhci-pci.c xhci: Register second xHCI roothub. 2011-03-13 18:23:39 -07:00
xhci-ring.c xhci: Register second xHCI roothub. 2011-03-13 18:23:39 -07:00
xhci.c xhci: Register second xHCI roothub. 2011-03-13 18:23:39 -07:00
xhci.h xhci: Register second xHCI roothub. 2011-03-13 18:23:39 -07:00