summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-06-13 23:26:23 +0700
committerhathach <[email protected]>2026-06-13 23:34:57 +0700
commitc8c63c30617d23bb604affcad423acbb11f8d10d (patch)
tree5fe1b42b9a706f366e9e61f33066cf9748e4b5a2
parente47eabd49d1838dc2a4eb42b9bd167a1d24d7cf5 (diff)
dcd/musb: clear rxrdy_consumed when stalling EP0
The actual-STALL path (no deferred SETUP) forced EP0 to IDLE but left rxrdy_consumed set if the aborted transfer had parked RXRDY via NAK flow control (e.g. a rejected OUT-data request in DATA_OUT). A subsequent SETUP IRQ would then hit the parked-gate early return and be ignored, relying on SentStall/SetupEnd to clear the flag first. Clear it here so recovery never depends on that ordering. Addresses Copilot review on #3699. Co-Authored-By: Claude Fable 5 <[email protected]>
-rw-r--r--src/portable/mentor/musb/dcd_musb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/portable/mentor/musb/dcd_musb.c b/src/portable/mentor/musb/dcd_musb.c
index 15928ec24..5f0ac4546 100644
--- a/src/portable/mentor/musb/dcd_musb.c
+++ b/src/portable/mentor/musb/dcd_musb.c
@@ -944,6 +944,9 @@ void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) {
// would land on that innocent request. Skip the stall and replay the deferred SETUP instead.
pipe0_process_deferred_setup(rhport, ep_csr, false);
} else {
+ // Forcing EP0 to IDLE: any RXRDY parked by the aborted transfer's flow control is stale,
+ // clear it so the next SETUP IRQ is not gated off.
+ _dcd.pipe0.rxrdy_consumed = false;
ep_csr->csr0l = MUSB_CSRL0_STALL;
}
}