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 <noreply@anthropic.com>
This commit is contained in:
hathach
2026-06-13 23:26:23 +07:00
parent e47eabd49d
commit c8c63c3061

View File

@ -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;
}
}