Re: [PATCH 2/3] USB: musb: workaround Blackfin FIFO anomalies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

Mike Frysinger wrote:

From: Bryan Wu <cooloney@xxxxxxxxxx>

Some of these workarounds are already in place, but labeled as affecting
all BF52x parts.  Since we have official anomaly numbers now, use those
defines. And since writing to the FIFO has a similar hang issue as reading
from the FIFO, implement the workaround there too when necessary.

Signed-off-by: Bryan Wu <cooloney@xxxxxxxxxx>
Signed-off-by: Cliff Cai <cliff.cai@xxxxxxxxxx>
Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
[...]
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index fe4934d..ad26e65 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
[...]
@@ -39,67 +41,113 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src) dump_fifo_data(src, len); - if (unlikely((unsigned long)src & 0x01))
-        outsw_8((unsigned long)fifo, src,
-            len & 0x01 ? (len >> 1) + 1 : len >> 1);
-    else
-        outsw((unsigned long)fifo, src,
-            len & 0x01 ? (len >> 1) + 1 : len >> 1);
-}
+    if (!ANOMALY_05000380 && epnum != 0) {
+        flush_dcache_range((unsigned int)src,
+            (unsigned int)(src + len));
+
+        /* Setup DMA address register */
+        dma_reg = (u16) ((u32) src & 0xFFFF);

  Hm, virtual address has the same value as a physical one?

+        bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg);
+        SSYNC();
+
+        dma_reg = (u16) (((u32) src >> 16) & 0xFFFF);

  Masking with 0xFFFF is not needed after shift...

+        bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg);
+        SSYNC();
+
[...]
+    } else {
+        SSYNC();
+
+        if (unlikely((unsigned long)src & 0x01))
+            outsw_8((unsigned long)fifo, src,
+                len & 0x01 ? (len >> 1) + 1 : len >> 1);

  Why not simply (len + 1) >> 1, without ?: at all?

+        else
+            outsw((unsigned long)fifo, src,
+                len & 0x01 ? (len >> 1) + 1 : len >> 1);

  Same here...

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux