aboutsummaryrefslogtreecommitdiff
path: root/lib/libusb/usb-xhci.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2016-08-02 11:19:42 +0200
committerAlexey Kardashevskiy <aik@ozlabs.ru>2016-08-03 13:48:18 +1000
commitcf7963a12c7fb516a1addcba40d78977d61fbcc5 (patch)
tree6ba78d0fd596cdd5c4e1947d2961059266c373e2 /lib/libusb/usb-xhci.c
parentf1d7dc911c0203f91af5dfbc462106623c6b8a9b (diff)
downloadSLOF-cf7963a12c7fb516a1addcba40d78977d61fbcc5.zip
SLOF-cf7963a12c7fb516a1addcba40d78977d61fbcc5.tar.gz
SLOF-cf7963a12c7fb516a1addcba40d78977d61fbcc5.tar.bz2
usb: Initialize USB3 devices on a hub and keep track of hub topology
USB3 devices need to be initialized with usb3_dev_init(), so that they get assigned a proper slot ID. And for USB3 devices that are attached to a (non-root) hub, we also need to keep track of the hub topology, so a new field called "hub" is added to the struct usb_dev which references the hub devices where the current USB devices is attached to. The hub topology will be used later to build the so-called "route string" for the USB3 devices. 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.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libusb/usb-xhci.c b/lib/libusb/usb-xhci.c
index 931d779..f3de6fb 100644
--- a/lib/libusb/usb-xhci.c
+++ b/lib/libusb/usb-xhci.c
@@ -528,7 +528,8 @@ static uint32_t usb_control_max_packet(uint32_t speed)
return max_packet;
}
-static bool xhci_alloc_dev(struct xhci_hcd *xhcd, uint32_t slot_id, uint32_t port)
+static bool xhci_alloc_dev(struct xhci_hcd *xhcd, struct usb_dev *hub,
+ uint32_t slot_id, uint32_t port)
{
struct usb_dev *dev;
struct xhci_dev *xdev;
@@ -629,6 +630,7 @@ static bool xhci_alloc_dev(struct xhci_hcd *xhcd, uint32_t slot_id, uint32_t por
dev->speed = USB_SUPER_SPEED;
dev->addr = USB_DEV_ADDRESS(slot->field4);
dev->port = newport;
+ dev->hub = hub;
dev->priv = xdev;
xdev->dev = dev;
if (usb_setup_new_device(dev, newport)) {
@@ -654,7 +656,7 @@ static void xhci_free_dev(struct xhci_dev *xdev)
xhci_free_ctx(&xdev->out_ctx, XHCI_CTX_BUF_SIZE);
}
-static bool usb3_dev_init(struct xhci_hcd *xhcd, uint32_t port)
+bool usb3_dev_init(struct xhci_hcd *xhcd, struct usb_dev *hub, uint32_t port)
{
/* Device enable slot */
xhci_send_enable_slot(xhcd, port);
@@ -663,7 +665,7 @@ static bool usb3_dev_init(struct xhci_hcd *xhcd, uint32_t port)
return false;
}
dprintf("SLOT ID: %d\n", xhcd->slot_id);
- if (!xhci_alloc_dev(xhcd, xhcd->slot_id, port)) {
+ if (!xhci_alloc_dev(xhcd, hub, xhcd->slot_id, port)) {
dprintf("Unable to allocate device\n");
return false;
}
@@ -741,7 +743,7 @@ static int xhci_port_scan(struct xhci_hcd *xhcd,
dprintf("Port reset complete %d\n", i);
}
print_port_status(prs);
- if (!usb3_dev_init(xhcd, (i - (port_off - 1)))) {
+ if (!usb3_dev_init(xhcd, NULL, (i - (port_off - 1)))) {
dprintf("USB device initialization failed\n");
}
}