Fishwaldo opened a new pull request, #19862:
URL: https://github.com/apache/nuttx/pull/19862

   ## Summary
   
   The first twenty-eight commits belong to #19745, #19860 and #19861 and are 
not
   part of this change. This PR adds the last five.
   
   The xHCI driver refused `CONFIG_USBHOST_HUB` at compile time. A controller
   reaches a device behind a hub by the path to it, and for a low or full speed
   device through the hub that translates for it, and none of that was 
described.
   
   - **A device is keyed by the port it occupies, not by the root port.** The
     slot, the default control endpoint and the device context lived in the root
     port structure, which holds only while every device is plugged straight 
into
     the controller. Two keys replace it: an endpoint records the slot it was
     opened on, and a hub port belongs to one device wherever it sits. No
     functional change for a directly attached device, whose port slot and
     endpoint slot are the same one.
   - **A hub reports what it is on the port it occupies.** Some controllers must
     be told about the hubs in a topology, not only about the device at the end 
of
     it: a hub's slot context carries a hub flag, its downstream port count and
     its transaction translator think time. The hub class driver already reads
     both values from the hub descriptor; this publishes them on the hub's own 
hub
     port, beside the speed and function address already there. Nothing is
     required to read them, so a controller that does not need them is 
unaffected.
   - **A device behind a hub is described to the controller.** The route string 
is
     the path to it, a nibble per tier with the tier nearest the root lowest,
     stopping after five as the field and USB both require. Slot context dword 2
     names the transaction translator, reported by slot rather than by USB 
address
     as EHCI does, and naming the nearest high speed ancestor rather than the
     immediate parent. `xhci_epalloc()` carried a copy of `sam_ehci.c`'s
     split-transaction block, writing fields this driver never read; both are
     removed.
   - **Hub support is implemented.** A device is created wherever it sits; the 
hub
     asks for a port's control endpoint before it reports the connection, so an
     endpoint may exist before its slot does; a hub must be described as a hub
     before anything behind it can be reached, which is only known once its 
class
     driver has read the descriptor, so `xhci_hub_update()` corrects the slot
     context the first time something appears behind it; and a hub reports each
     changed port without waiting for the last, so the connect method queues 
them
     rather than holding one pointer.
   - **The host stack is told which controller a port belongs to.**
     `struct usbhost_roothubport_s` carries that number and nothing set it.
   
   One commit touches shared code outside the xHCI driver: reporting the hub's
   port count and think time adds two fields to `struct usbhost_hubport_s`, both
   inside `CONFIG_USBHOST_HUB`, as the parent pointer already is.
   
   Multi-TT is not implemented. It comes from the hub's interface protocol 
rather
   than its descriptor, and driving a multi-TT hub as single-TT costs bandwidth
   behind that hub but is correct.
   
   ## Impact
   
   Enables `USBHOST_HUB` with `USBHOST_XHCI`, previously rejected at compile 
time.
   No change when hub support is disabled; the two new `usbhost_hubport_s` 
fields
   are compiled out without it.
   
   ## Testing
   
   EIC7700 EVB, Synopsys DWC3 in host mode, with a real Fresco Logic 6-port USB
   2.0 hub:
   
   ```
   usb 1-1:   keyboard, driver attached
   usb 0-1:   hub, driver attached (USB2.0 Hub, Fresco Logic)
   usb 0-1.1: mass storage, driver attached -> /dev/sda
   usb 0-1.2: misc, driver attached (SIPEED UARTx4 HS) -> /dev/ttyACM0-3
   ```
   
   The device behind the hub mounts as a 59 GB vfat volume, its directory lists,
   and `dd if=/dev/sda bs=512 count=256` reads at 703 KB/s.
   
   QEMU with `-device qemu-xhci` plus a `usb-hub` carrying both a `usb-storage`
   and a `usb-kbd`: both enumerate behind the hub, giving `/dev/sda` and
   `/dev/kbda`, the file reads back `qemu-xhci-regression-ok`, and no assertions
   fire.
   
   Note for anyone reproducing this: `qemu-intel64:jumbo` has xHCI, mass storage
   and HID keyboard but does not set `CONFIG_USBHOST_HUB`, so hub coverage needs
   it enabled.
   
   Depends-On: https://github.com/apache/nuttx/pull/19861
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to