usb: musb: host: clear stale RX interrupt on three-strikes error

Unplugging a busy USB Ethernet adapter can leave a stale RX interrupt
pending while the host handles MUSB_RXCSR_H_ERROR. On AM335x/DSPS
platforms this can retrigger the same three-strikes error before the
disconnect path completes, flooding the log and potentially leaving the
host port stuck until reboot.

Clear the pending endpoint RX interrupt when aborting the transfer so
the error storm is broken, and rate limit the error message to avoid
spamming the log while the fault path completes.

Signed-off-by: Lucas Martins Alves <lucas.alves@lumal21.com.br>
Link: https://patch.msgid.link/20260714134941.18508-1-lucas.alves@lumal21.com.br
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Lucas Martins Alves 2026-07-14 13:49:49 +00:00 committed by Greg Kroah-Hartman
parent c7ca309d57
commit 3a3a484873

View File

@ -1774,7 +1774,8 @@ void musb_host_rx(struct musb *musb, u8 epnum)
status = -EPIPE;
} else if (rx_csr & MUSB_RXCSR_H_ERROR) {
dev_err(musb->controller, "ep%d RX three-strikes error", epnum);
dev_err_ratelimited(musb->controller,
"ep%d RX three-strikes error\n", epnum);
/*
* The three-strikes error could only happen when the USB
@ -1788,6 +1789,17 @@ void musb_host_rx(struct musb *musb, u8 epnum)
rx_csr &= ~MUSB_RXCSR_H_ERROR;
musb_writew(epio, MUSB_RXCSR, rx_csr);
/*
* Unplugging a USB-Ethernet adapter while it is busy can make
* the controller keep re-asserting the three-strikes error for
* this endpoint before the disconnect is processed. That floods
* the log and can wedge the host port until reboot. Drop the
* stale pending RX interrupt on platforms that support it (e.g.
* AM335x/DSPS) to break the storm; the transfer is still
* aborted below via the fault path.
*/
musb_platform_clear_ep_rxintr(musb, epnum);
} else if (rx_csr & MUSB_RXCSR_DATAERROR) {
if (USB_ENDPOINT_XFER_ISOC != qh->type) {