diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2010-12-16 14:21:10 -0500 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2011-03-13 21:23:39 -0400 |
commit | f6ff0ac878eb420011fa2448851dd48c3a7e7b31 (patch) | |
tree | 4073e9de7541030ee7b775d118a1ee1d1821a0c7 /drivers/usb/host/xhci.h | |
parent | 5233630fcdd6f7d415dcbed264031439cab73f9d (diff) |
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>
Diffstat (limited to 'drivers/usb/host/xhci.h')
-rw-r--r-- | drivers/usb/host/xhci.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 443d6333f280..e9217bb288ad 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1174,12 +1174,16 @@ struct xhci_bus_state { | |||
1174 | 1174 | ||
1175 | static inline unsigned int hcd_index(struct usb_hcd *hcd) | 1175 | static inline unsigned int hcd_index(struct usb_hcd *hcd) |
1176 | { | 1176 | { |
1177 | return 0; | 1177 | if (hcd->speed == HCD_USB3) |
1178 | return 0; | ||
1179 | else | ||
1180 | return 1; | ||
1178 | } | 1181 | } |
1179 | 1182 | ||
1180 | /* There is one ehci_hci structure per controller */ | 1183 | /* There is one ehci_hci structure per controller */ |
1181 | struct xhci_hcd { | 1184 | struct xhci_hcd { |
1182 | struct usb_hcd *main_hcd; | 1185 | struct usb_hcd *main_hcd; |
1186 | struct usb_hcd *shared_hcd; | ||
1183 | /* glue to PCI and HCD framework */ | 1187 | /* glue to PCI and HCD framework */ |
1184 | struct xhci_cap_regs __iomem *cap_regs; | 1188 | struct xhci_cap_regs __iomem *cap_regs; |
1185 | struct xhci_op_regs __iomem *op_regs; | 1189 | struct xhci_op_regs __iomem *op_regs; |
@@ -1262,10 +1266,8 @@ struct xhci_hcd { | |||
1262 | #define XHCI_LINK_TRB_QUIRK (1 << 0) | 1266 | #define XHCI_LINK_TRB_QUIRK (1 << 0) |
1263 | #define XHCI_RESET_EP_QUIRK (1 << 1) | 1267 | #define XHCI_RESET_EP_QUIRK (1 << 1) |
1264 | #define XHCI_NEC_HOST (1 << 2) | 1268 | #define XHCI_NEC_HOST (1 << 2) |
1265 | /* There's only one roothub to keep track of bus suspend info for | 1269 | /* There are two roothubs to keep track of bus suspend info for */ |
1266 | * (right now). | 1270 | struct xhci_bus_state bus_state[2]; |
1267 | */ | ||
1268 | struct xhci_bus_state bus_state[1]; | ||
1269 | /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */ | 1271 | /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */ |
1270 | u8 *port_array; | 1272 | u8 *port_array; |
1271 | /* Array of pointers to USB 3.0 PORTSC registers */ | 1273 | /* Array of pointers to USB 3.0 PORTSC registers */ |