Skip to content

Commit 16bd613

Browse files
committed
[nrf fromlist] drivers: udc_dwc2: Arm control out endpoint in DMA mode
It was observed that device ceases to work in Buffer DMA mode after GET DEVICE QUALIFIER request is STALLed (when USB stack is limited to Full-Speed only operation). The issue is due to missing dout feed. Clear pending dout feed flag after bus reset (enumeration done) and after stalled control read transfer to allow dout to be feed when necessary. Upstream PR #: 93103 Signed-off-by: Tomasz Moń <[email protected]> (cherry picked from commit 83c6c402e206b7c68538594599ea495eb84ae967)
1 parent a767af9 commit 16bd613

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/usb/udc/udc_dwc2.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,10 @@ static int udc_dwc2_ep_set_halt(const struct device *dev,
17531753
if (ep_idx != 0) {
17541754
cfg->stat.halted = true;
17551755
} else {
1756+
struct udc_dwc2_data *const priv = udc_get_private(dev);
1757+
17561758
/* Data/Status stage is STALLed, allow receiving next SETUP */
1759+
priv->pending_dout_feed = 0;
17571760
dwc2_ensure_setup_ready(dev);
17581761
}
17591762

@@ -3320,6 +3323,8 @@ static ALWAYS_INLINE void dwc2_thread_handler(void *const arg)
33203323
if (evt & BIT(DWC2_DRV_EVT_ENUM_DONE)) {
33213324
k_event_clear(&priv->drv_evt, BIT(DWC2_DRV_EVT_ENUM_DONE));
33223325

3326+
/* Any potential transfer on control IN endpoint is cancelled */
3327+
priv->pending_dout_feed = 0;
33233328
dwc2_ensure_setup_ready(dev);
33243329
}
33253330

0 commit comments

Comments
 (0)