aboutsummaryrefslogtreecommitdiff
path: root/lib/libusb/usb-xhci.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2016-08-02 11:19:43 +0200
committerAlexey Kardashevskiy <aik@ozlabs.ru>2016-08-03 13:48:18 +1000
commitb14743a8ff89dcadfcbaea507b8478088199c346 (patch)
treee9d88a74c9ad9f6ea125f32f4245f0f3c35cf1e8 /lib/libusb/usb-xhci.c
parentcf7963a12c7fb516a1addcba40d78977d61fbcc5 (diff)
downloadSLOF-b14743a8ff89dcadfcbaea507b8478088199c346.zip
SLOF-b14743a8ff89dcadfcbaea507b8478088199c346.tar.gz
SLOF-b14743a8ff89dcadfcbaea507b8478088199c346.tar.bz2
usb: Build correct route string for USB3 devices behind a hub
To support USB3 devices attached to a hub, we've got to set the so-called "route string" in the slot context, which is a concatenation of the hub port numbers that need to be traversed between the root hub port and the destination device. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'lib/libusb/usb-xhci.c')
-rw-r--r--lib/libusb/usb-xhci.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/libusb/usb-xhci.c b/lib/libusb/usb-xhci.c
index f3de6fb..97cc116 100644
--- a/lib/libusb/usb-xhci.c
+++ b/lib/libusb/usb-xhci.c
@@ -538,7 +538,7 @@ static bool xhci_alloc_dev(struct xhci_hcd *xhcd, struct usb_dev *hub,
struct xhci_ep_ctx *ep0;
uint32_t ctx_size, val;
uint16_t max_packet;
- uint32_t newport;
+ uint32_t newport, rootport;
if (slot_id > XHCI_CONFIG_MAX_SLOT) {
printf("USB3 slot ID %d is too high (max is %d)\n", slot_id,
@@ -565,10 +565,16 @@ static bool xhci_alloc_dev(struct xhci_hcd *xhcd, struct usb_dev *hub,
/* Step 3 */
slot = xhci_get_slot_ctx(&xdev->in_ctx, ctx_size);
- newport = port + 1;
- val = LAST_CONTEXT(1) | SLOT_SPEED_SS | (newport << 16); /* FIXME speed, read from PS */
+ newport = rootport = port + 1;
+ val = newport & 0xf;
+ for (dev = hub; dev != NULL; dev = dev->hub) {
+ val = (val << 4) | (dev->port & 0xf); /* Build route string */
+ rootport = dev->port;
+ }
+ val >>= 4; /* Remove root hub ID from the string */
+ val |= LAST_CONTEXT(1) | SLOT_SPEED_SS; /* FIXME speed, read from PS */
slot->field1 = cpu_to_le32(val);
- slot->field2 = cpu_to_le32(ROOT_HUB_PORT(newport)); /* FIXME how to get port no */
+ slot->field2 = cpu_to_le32(ROOT_HUB_PORT(rootport));
/* Step 4 */
if (!xhci_alloc_seg(&xdev->control, XHCI_CONTROL_TRBS_SIZE, TYPE_CTRL)) {