diff --git a/drivers/usbhost/usbhost_xhci.c b/drivers/usbhost/usbhost_xhci.c index 625a074c174..db2e94934f1 100644 --- a/drivers/usbhost/usbhost_xhci.c +++ b/drivers/usbhost/usbhost_xhci.c @@ -248,6 +248,7 @@ struct usbhost_xhci_s /* xHCI parameters */ uint8_t no_ports; /* Number of USB Ports */ + uint8_t bus; /* Which controller this is */ uint8_t no_slots; /* Maximum number of Device Slots (one per USB device) */ uint8_t no_scratch; /* Number of scratch buffers */ uint8_t no_erst; /* Event Ring Segment Table size */ @@ -5830,6 +5831,7 @@ static inline int xhci_sw_initialize(FAR struct usbhost_xhci_s *priv) rhport->ep0.epno = 0; rhport->ep0.devaddr = 0; nxsem_init(&rhport->ep0.iocsem, 0, 0); + rhport->hport.bus = priv->bus; nxmutex_init(&rhport->ep0.lock); /* Initialize the public port representation */ @@ -5874,7 +5876,7 @@ static inline int xhci_sw_initialize(FAR struct usbhost_xhci_s *priv) ****************************************************************************/ FAR struct usbhost_connection_s * -xhci_initialize(FAR const char *name, uintptr_t base, +xhci_initialize(FAR const char *name, uint8_t bus, uintptr_t base, FAR const struct xhci_bus_ops_s *ops, FAR void *arg) { FAR struct usbhost_conn_xhci_s *conn = NULL; @@ -5903,6 +5905,13 @@ xhci_initialize(FAR const char *name, uintptr_t base, conn->priv = priv; priv->name = name; + + /* The bus is what the controller calls itself, so that a port reported + * through the generic host stack and a message from this driver name the + * same thing. Numbering them here instead would agree only by accident. + */ + + priv->bus = bus; priv->ops = ops; priv->arg = arg; priv->base = base; diff --git a/drivers/usbhost/usbhost_xhci_pci.c b/drivers/usbhost/usbhost_xhci_pci.c index 95b794c4c26..8c7f0819b44 100644 --- a/drivers/usbhost/usbhost_xhci_pci.c +++ b/drivers/usbhost/usbhost_xhci_pci.c @@ -213,7 +213,7 @@ static int pci_xhci_probe(FAR struct pci_device_s *dev) goto errout; } - pcix->conn = xhci_initialize("usb", base, &g_pci_xhci_ops, pcix); + pcix->conn = xhci_initialize("usb", 0, base, &g_pci_xhci_ops, pcix); if (pcix->conn == NULL) { pcierr("xhci_initialize failed\n"); diff --git a/include/nuttx/usb/xhci.h b/include/nuttx/usb/xhci.h index 1010811244b..32a6638a940 100644 --- a/include/nuttx/usb/xhci.h +++ b/include/nuttx/usb/xhci.h @@ -95,7 +95,7 @@ struct xhci_bus_ops_s ****************************************************************************/ FAR struct usbhost_connection_s * -xhci_initialize(FAR const char *name, uintptr_t base, +xhci_initialize(FAR const char *name, uint8_t bus, uintptr_t base, FAR const struct xhci_bus_ops_s *ops, FAR void *arg); /****************************************************************************