summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-02-19 14:38:34 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-02-20 12:07:03 +0100
commit42db38526b2c8c6d5f6a2825770786ed44b6a678 (patch)
tree84c692613ebb4b55ffb06a47ab2f328064fb2381
parent3b3af837338f199fae38627ea0b9467a931cf784 (diff)
downloadbarebox-42db38526b2c.tar.gz
barebox-42db38526b2c.tar.xz
usb: xhci: Recover from halted bulk endpoints
This ports U-Boot commit 9d88bd4dcf1628bf129163eb5a25c48068423601: | Author: Hector Martin <marcan@marcan.st> | AuthorDate: Sun Oct 29 15:37:41 2023 +0900 | | usb: xhci: Recover from halted bulk endpoints | | There is currently no codepath to recover from this case. In principle | we could require that the upper layer do this explicitly, but let's just | do it in xHCI when the next bulk transfer is started, since that | reasonably implies whatever caused the problem has been dealt with. | | Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-15-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/usb/host/xhci-ring.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 1b9a5b7867..6a859dbbfa 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -695,6 +695,14 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
ep_ctx = xhci_get_ep_ctx(ctrl, virt_dev->out_ctx, ep_index);
+ /*
+ * If the endpoint was halted due to a prior error, resume it before
+ * the next transfer. It is the responsibility of the upper layer to
+ * have dealt with whatever caused the error.
+ */
+ if ((le32_to_cpu(ep_ctx->ep_info) & EP_STATE_MASK) == EP_STATE_HALTED)
+ reset_ep(udev, ep_index, timeout_ms);
+
ring = virt_dev->eps[ep_index].ring;
/*
* How much data is (potentially) left before the 64KB boundary?