Skip to content

Commit f456852

Browse files
kasjernashif
authored andcommitted
drivers: usb_device: smartbond: Fix unnecessary flush
Switching from write to read on EP0 is done when data is transmitted. Additionally receiver is enabled when NAK is created in response to OUT token. This may happen when host sent ZLP before everything was transmitted. This case flushed receiver FIFO which could lead to setup packet corruption. Signed-off-by: Jerzy Kasenberg <[email protected]>
1 parent 18a7603 commit f456852

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/usb/device/usb_dc_smartbond.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,9 +838,8 @@ static void handle_ep0_nak(void)
838838
} else {
839839
if (REG_GET_BIT(USB_RXC0_REG, USB_RX_EN) == 0 &&
840840
GET_BIT(ep0_nak, USB_USB_EP0_NAK_REG_USB_EP0_OUTNAK)) {
841-
/* NAK over EP0 was sent, transmit should conclude */
841+
/* NAK over EP0 was sent, receive should conclude */
842842
USB->USB_TXC0_REG = USB_USB_TXC0_REG_USB_FLUSH_Msk;
843-
REG_SET_BIT(USB_RXC0_REG, USB_FLUSH);
844843
REG_SET_BIT(USB_RXC0_REG, USB_RX_EN);
845844
REG_CLR_BIT(USB_MAMSK_REG, USB_M_EP0_NAK);
846845
}

0 commit comments

Comments
 (0)