nuttx/drivers/usbhost
Justin Hammond ba7c7e1f77 drivers/usbhost: Support USB hubs on xHCI.
The driver refused CONFIG_USBHOST_HUB outright.  Everything needed to
describe a device behind a hub is now in place, so implement the rest.

- xhci_device_init() took a root hub port and read the slot, the control
  endpoint and the device out of it, all of which belong to the device.
  It now takes the hub port and the control endpoint, and records the
  device on the root port only when that is where it sits: once a hub is
  plugged in, the device a root port names is the hub.  xhci_address_set()
  and xhci_device_deinit() likewise work on a device, and
  xhci_disconnect() finds the device by the port going away.
- The hub asks for a port's control endpoint before it reports the
  connection, so xhci_epalloc() has nothing to attach one to.  It returns
  an endpoint with no slot, and xhci_connect() gives it one when it
  creates the device.
- A hub must be described to the controller as a hub before anything
  behind it can be reached, and nothing knows it is one when its slot is
  created.  xhci_hub_update() corrects the slot context with a Configure
  Endpoint command the first time something appears behind it.
- A hub reports each changed port without waiting for the last to be dealt
  with, so the connect method queues them; holding one pointer meant the
  second report overwrote the first.  No more can be outstanding than the
  controller has slots.
- Report the root port and slot counts from HCSPARAMS1, and the port count
  from a hub's descriptor.

Tested on an EIC7700X board with a hub on one controller and a keyboard on
the other.  Behind the hub, a 59 GB mass storage device mounts and reads a
file back, and a composite CDC device gives four ttyACM nodes.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-09-28 21:45:57 +08:00
..
CMakeLists.txt drivers/usbhost: Separate the xHCI driver from the PCI bus. 2026-08-18 09:35:23 -03:00
hid_parser.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
Kconfig drivers/usbhost: Stop retrying an xHCI port that will not enumerate. 2026-09-20 22:28:07 +08:00
Make.defs drivers/usbhost: Separate the xHCI driver from the PCI bus. 2026-08-18 09:35:23 -03:00
usbhost_bthci.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbhost_cdcacm.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbhost_cdcecm.c drivers/usbhost/usbhost_cdcecm.c: Converted CDC-ECM to lower half 2026-05-06 06:20:03 +08:00
usbhost_cdcmbim.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
usbhost_composite.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbhost_composite.h
usbhost_devaddr.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbhost_drivers.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbhost_enumerate.c usbhost: Report each device as it is enumerated. 2026-08-09 02:09:47 +08:00
usbhost_findclass.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbhost_ft232r.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbhost_hidkbd.c drivers/usbhost: Do not unregister a HID keyboard that never registered. 2026-08-09 20:57:41 +08:00
usbhost_hidmouse.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
usbhost_hub.c usbhost: Report what a hub is on the port it occupies. 2026-09-28 21:45:57 +08:00
usbhost_max3421e.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbhost_registerclass.c drivers/usbhost: Refuse to register the same class driver twice. 2026-08-08 14:55:34 -03:00
usbhost_registry.c drivers/usbhost: Use small lock to protect usbhost common function 2025-12-13 12:39:48 +08:00
usbhost_registry.h drivers/usbhost: Use small lock to protect usbhost common function 2025-12-13 12:39:48 +08:00
usbhost_skeleton.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbhost_storage.c drivers/usbhost: Register the partitions on a mass storage device. 2026-08-08 14:40:52 -03:00
usbhost_trace.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbhost_waiter.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usbhost_xboxcontroller.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
usbhost_xhci.c drivers/usbhost: Support USB hubs on xHCI. 2026-09-28 21:45:57 +08:00
usbhost_xhci.h drivers/usbhost: Describe a device behind a hub to the xHCI controller. 2026-09-28 21:45:57 +08:00
usbhost_xhci_pci.c drivers/usbhost: Separate the xHCI driver from the PCI bus. 2026-08-18 09:35:23 -03:00
usbhost_xhci_trace.c drivers/usbhost: Correct the xHCI controller name in a trace string. 2026-08-08 14:55:00 -03:00
usbhost_xhci_trace.h drivers/usbhost: Define the xHCI endpoint-allocation trace. 2026-08-08 14:55:00 -03:00