drivers: udc_dwc2: Recover after STALLed OUT Data Stage

Prepare buffer to receive SETUP data on OUT endpoint 0 after endpoint
halt. This solves the issue where the device would no longer process any
control transfers after the first failed transfer with too large OUT
Data Stage (when processing failed due to data stage buffer allocation
failure).

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
This commit is contained in:
Tomasz Moń 2025-01-14 11:32:42 +01:00 committed by Benjamin Cabé
parent 18be1d0768
commit 883b77fe3b

View File

@ -1577,6 +1577,9 @@ static int udc_dwc2_ep_set_halt(const struct device *dev,
LOG_DBG("Set halt ep 0x%02x", cfg->addr);
if (ep_idx != 0) {
cfg->stat.halted = true;
} else if (!udc_buf_peek(dev, USB_CONTROL_EP_OUT)) {
/* Data stage is STALLed, allow receiving next SETUP */
dwc2_ctrl_feed_dout(dev, 8);
}
return 0;