usb-designware: fix incorrect cache discard with DMA disabled

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 361cd46a088d64c2d0679b8589ef958ac5f96a0c
Author: Aidan MacDonald <[email protected]>
Date:   Sat Jan 10 14:30:21 2026 +0000

    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

diff --git a/firmware/drivers/usb-designware.c b/firmware/drivers/usb-designware.c
index 8a797eaf73..d892b91efb 100644
--- a/firmware/drivers/usb-designware.c
+++ b/firmware/drivers/usb-designware.c
@@ -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;
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.