]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
musb: am35x: Workaround for fifo read issue
authorAjay Kumar Gupta <ajay.gupta@ti.com>
Fri, 9 Jul 2010 06:13:49 +0000 (11:43 +0530)
committerRemy Bohmer <linux@bohmer.net>
Thu, 12 Aug 2010 14:40:00 +0000 (16:40 +0200)
AM35x supports only 32bit read operations so we need to have
workaround for 8bit and 16bit read operations.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
drivers/usb/musb/am35x.c
drivers/usb/musb/musb_core.c

index 2024940cdd83809cd86efba7326b17ce99c526cb..1706c138bd56f984affc2b9aea73b40e833643cf 100644 (file)
@@ -116,3 +116,35 @@ void musb_platform_deinit(void)
        /* Turn off the phy */
        phy_off();
 }
+
+/*
+ * This function reads data from endpoint fifo for AM35x
+ * which supports only 32bit read operation.
+ *
+ * ep           - endpoint number
+ * length       - number of bytes to read from FIFO
+ * fifo_data    - pointer to data buffer into which data is read
+ */
+__attribute__((weak))
+void read_fifo(u8 ep, u32 length, void *fifo_data)
+{
+       u8  *data = (u8 *)fifo_data;
+       u32 val;
+       int i;
+
+       /* select the endpoint index */
+       writeb(ep, &musbr->index);
+
+       if (length > 4) {
+               for (i = 0; i < (length >> 2); i++) {
+                       val = readl(&musbr->fifox[ep]);
+                       memcpy(data, &val, 4);
+                       data += 4;
+               }
+               length %= 4;
+       }
+       if (length > 0) {
+               val = readl(&musbr->fifox[ep]);
+               memcpy(data, &val, length);
+       }
+}
index dc740cf18e475e9806683561feb39f2e93771dc3..6fe2c39bce800cb6eac58008431f8c3a2fb36f10 100644 (file)
@@ -141,6 +141,11 @@ void write_fifo(u8 ep, u32 length, void *fifo_data)
                writeb(*data++, &musbr->fifox[ep]);
 }
 
+/*
+ * AM35x supports only 32bit read operations so
+ * use seperate read_fifo() function for it.
+ */
+#ifndef CONFIG_USB_AM35X
 /*
  * This function reads data from endpoint fifo
  *
@@ -160,3 +165,4 @@ void read_fifo(u8 ep, u32 length, void *fifo_data)
        while (length--)
                *data++ = readb(&musbr->fifox[ep]);
 }
+#endif /* CONFIG_USB_AM35X */