usb-designware: fix incorrect cache discard with DMA disabled

Two cache discards for targets with POST_DMA_FLUSH were
not properly guarded by USB_DW_ARCH_SLAVE, which causes
data loss when DMA is disabled.

Change-Id: If14ffdc5662f77b3ff57a04c5b9f94d4cac7e514
This commit is contained in:
Aidan MacDonald 2026-01-10 14:30:21 +00:00
parent 047871c58a
commit 361cd46a08

View file

@ -1018,7 +1018,7 @@ static void usb_dw_handle_xfer_complete(int epnum, enum usb_dw_epdir epdir)
if(is_ep0out)
{
#if defined(NO_UNCACHED_ADDR) && defined(POST_DMA_FLUSH)
#if !defined(USB_DW_ARCH_SLAVE) && defined(NO_UNCACHED_ADDR) && defined(POST_DMA_FLUSH)
DISCARD_DCACHE_RANGE(ep0_buffer, 64);
#endif
memcpy(dw_ep->addr, ep0_buffer, transferred);
@ -1084,7 +1084,7 @@ static void usb_dw_handle_xfer_complete(int epnum, enum usb_dw_epdir epdir)
static void usb_dw_handle_setup_received(void)
{
#if defined(NO_UNCACHED_ADDR) && defined(POST_DMA_FLUSH)
#if !defined(USB_DW_ARCH_SLAVE) && defined(NO_UNCACHED_ADDR) && defined(POST_DMA_FLUSH)
DISCARD_DCACHE_RANGE(ep0_buffer, 64);
#endif
struct usb_ctrlrequest req;