synopsys-dwmac: Bugfixes

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit fd8d6f10a1581492619a765a5cb9eead20314e3b
Author: Solomon Peachy <[email protected]>
Date:   Tue Aug 11 07:42:43 2026 -0400

    synopsys-dwmac:  Bugfixes
    
     * Dedicated FIFO mode requires a non-zero multi-count for periodic INs
     * Add ISO frame polarity
     * Correct max packet size for high-speed ISOC operation
    
    Change-Id: I2c0d40b5f8d0e1e4cf43369631f17c7f80c6fab2

diff --git a/firmware/drivers/usb-designware.c b/firmware/drivers/usb-designware.c
index 3a46a367ee..d6030caceb 100644
--- a/firmware/drivers/usb-designware.c
+++ b/firmware/drivers/usb-designware.c
@@ -708,6 +708,12 @@ static void usb_dw_epstart(int epnum, enum usb_dw_epdir epdir,
 #endif
 #ifdef USB_DW_SHARED_FIFO
         eptsiz |= MCCNT((ep_periodic_msk >> epnum) & 1);
+#else
+        /* Dedicated FIFO mode still requires a non-zero multi-count for
+         * periodic IN endpoints. MCCNT(0) transmits no packets. */
+        uint32_t eptype = (DWC_DIEPCTL(epnum) >> 18) & 0x3;
+        if (eptype == EPTYP_ISOCHRONOUS || eptype == EPTYP_INTERRUPT)
+            eptsiz |= MCCNT(packets);  /* rarely, if ever, not 1 */
 #endif
 
     }
@@ -722,7 +728,18 @@ static void usb_dw_epstart(int epnum, enum usb_dw_epdir epdir,
     DWC_EPDMA(epnum, epdir) = USB_DW_PHYSADDR((uint32_t)buf);
 #endif
     DWC_EPTSIZ(epnum, epdir) = eptsiz;
-    DWC_EPCTL(epnum, epdir) |= EPENA | nak;
+    if (((DWC_EPCTL(epnum, epdir) >> 18) & 0x3) == EPTYP_ISOCHRONOUS)
+    {
+        /* Schedule the transfer for the next frame. */
+        if ((DWC_DSTS >> 8) & 1)
+            DWC_EPCTL(epnum, epdir) |= EPENA | nak | SETD0PIDEF;
+        else
+            DWC_EPCTL(epnum, epdir) |= EPENA | nak | SETD1PIDOF;
+    }
+    else
+    {
+        DWC_EPCTL(epnum, epdir) |= EPENA | nak;
+    }
 
 #ifdef USB_DW_ARCH_SLAVE
     /* Enable interrupts to start pushing data into the FIFO */
@@ -1444,7 +1461,7 @@ void usb_drv_ep_init(const struct usb_drv_ep_alloc_ctx* ctx, int ep)
     {
         if(type == EPTYP_ISOCHRONOUS)
         {
-            mps = 1023;
+            mps = usb_drv_port_speed() ? 1024 : 1023;
         }
         else
         {
-- 
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.