[PATCH 0/2] USB fixes: (Re)implement timeouts

Hector Martin marcan at marcan.st
Sun Oct 29 08:36:15 CET 2023


A long time ago, the USB code was interrupt-driven and used top-level
timeout handling. This has long been obsolete, and that code is just
broken dead cruft. HC drivers instead hardcode timeouts today.

We need to be able to specify timeouts explicitly to handle cases like
USB hard disks spinning up, without having ridiculously long timeouts
across the board (which would cause endless waiting when things go
wrong anywhere else). So, it's time to rip out the old broken nonsense
and actually pass through timeouts to USB host controller drivers, so
they can be implemented properly.

This series adds the necessary top-level scaffolding for control/bulk
timeouts, and implements them in xHCI. I didn't bother with interrupt
transfers, since I figure those probably never need long timeouts
anyway.

The platform I deal with only has xHCI, so I'll leave implementing this
for EHCI/OHCI to someone else if anyone cares :)

This series needs to be applied after [1], since the xHCI changes depend
on changes made there.

[1] https://lore.kernel.org/u-boot/20231029-usb-fixes-1-v2-0-623533f6316e@marcan.st/

Signed-off-by: Hector Martin <marcan at marcan.st>
---
Hector Martin (2):
      usb: Pass through timeout to drivers
      usb: xhci: Hook up timeouts

 common/usb.c                    | 21 ++-------------------
 drivers/usb/host/ehci-hcd.c     |  5 +++--
 drivers/usb/host/ohci-hcd.c     |  5 +++--
 drivers/usb/host/r8a66597-hcd.c |  5 +++--
 drivers/usb/host/usb-sandbox.c  |  6 ++++--
 drivers/usb/host/usb-uclass.c   |  9 +++++----
 drivers/usb/host/xhci-ring.c    | 32 ++++++++++++++++++++------------
 drivers/usb/host/xhci.c         | 28 ++++++++++++++++------------
 include/usb.h                   | 10 ++++++----
 include/usb/xhci.h              | 14 ++++++++++----
 10 files changed, 72 insertions(+), 63 deletions(-)
---
base-commit: 3d5d748e4d66b98109669c05d0c473fe67795801
change-id: 20231029-usb-fixes-5-ca87bbedb40c

Best regards,
-- 
Hector Martin <marcan at marcan.st>



More information about the U-Boot mailing list