Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion drivers/usbhost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ if(CONFIG_USBHOST)
list(APPEND SRCS usbhost_bthci.c)
endif()

if(CONFIG_USBHOST_XHCI)
list(APPEND SRCS usbhost_xhci.c usbhost_xhci_trace.c)
endif()

if(CONFIG_USBHOST_XHCI_PCI)
list(APPEND SRCS usbhost_xhci_pci.c usbhost_xhci_trace.c)
list(APPEND SRCS usbhost_xhci_pci.c)
endif()

# HCD debug/trace logic
Expand Down
38 changes: 32 additions & 6 deletions drivers/usbhost/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -778,15 +778,17 @@ config USBHOST_BTHCI
---help---
Select this option to build in support for USB Bluetooth HCI devices.

menuconfig USBHOST_XHCI_PCI
bool "USB xHCI PCI Host Driver Support"
config USBHOST_XHCI
bool
default n
depends on PCI && PCI_MSIX && USBHOST_WAITER && SCHED_HPWORK && SCHED_LPWORK
depends on USBHOST_WAITER && SCHED_HPWORK && SCHED_LPWORK
select USBHOST_HAVE_ASYNCH
---help---
USB xHCI PCI host driver support.
The xHCI controller driver itself, which is the same wherever the
controller is fitted. Selected by whichever bus found one: PCI
below, or an SoC that wires one in.

if USBHOST_XHCI_PCI
if USBHOST_XHCI

config USBHOST_XHCI_MAX_DEVS
int "xHCI maximum supported devices"
Expand All @@ -795,6 +797,30 @@ config USBHOST_XHCI_MAX_DEVS
---help---
How many USB devices will be supported by xHCI driver.

endif # USBHOST_XHCI_PCI
config USBHOST_XHCI_ENUM_RETRIES
int "xHCI enumeration attempts per port"
default 3
range 1 255
---help---
How many times to attempt enumeration of a newly connected device
before leaving the port alone until the device is unplugged.

A device whose descriptors cannot be read, or that no class driver
claims, fails enumeration every time. Each failure marks the port
disconnected so the attempt repeats, so without a limit such a
device is retried for as long as it stays plugged in, logging and
taking a device slot on every pass.

The count is per root hub port and is cleared by a new connection.

endif # USBHOST_XHCI

menuconfig USBHOST_XHCI_PCI
bool "USB xHCI PCI Host Driver Support"
default n
depends on PCI && PCI_MSIX && USBHOST_WAITER && SCHED_HPWORK && SCHED_LPWORK
select USBHOST_XHCI
---help---
USB xHCI PCI host driver support.

endif # USBHOST
6 changes: 5 additions & 1 deletion drivers/usbhost/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ ifeq ($(CONFIG_USBHOST_BTHCI),y)
CSRCS += usbhost_bthci.c
endif

ifeq ($(CONFIG_USBHOST_XHCI),y)
CSRCS += usbhost_xhci.c usbhost_xhci_trace.c
endif

ifeq ($(CONFIG_USBHOST_XHCI_PCI),y)
CSRCS += usbhost_xhci_pci.c usbhost_xhci_trace.c
CSRCS += usbhost_xhci_pci.c
endif

# HCD debug/trace logic
Expand Down
11 changes: 11 additions & 0 deletions drivers/usbhost/usbhost_hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,17 @@ static inline int usbhost_hubdesc(FAR struct usbhost_class_s *hubclass)
priv->pwrondelay = (2 * hubdesc->pwrondelay);
priv->ctrlcurrent = hubdesc->ctrlcurrent;

/* Publish what describes this hub as a hub, rather than as a device, on
* the port it occupies. A host controller that has to be told about the
* hubs in a topology reads it from there when it sets up a device behind
* this one. This runs before any downstream port is activated, so it is
* in place before there is anything behind it to set up.
*/

hport->nports = hubdesc->nports;
hport->ttt = (hubchar & USBHUB_CHAR_TTTT_MASK) >>
USBHUB_CHAR_TTTT_SHIFT;

uinfo("Hub Descriptor:\n");
uinfo(" bDescLength: %d\n", hubdesc->len);
uinfo(" bDescriptorType: 0x%02x\n", hubdesc->type);
Expand Down
Loading
Loading