aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/musb
diff options
context:
space:
mode:
authorAjay Kumar Gupta2010-07-09 11:43:49 +0530
committerRemy Bohmer2010-08-12 16:40:00 +0200
commit5689f4b5b43d7beaf725d7cc82f9efea86d6f375 (patch)
tree77bee5613a9ac14dba63f268d15a4942c236f73c /drivers/usb/musb
parentdbea32420022be62116e1c49222be4d64af62c38 (diff)
musb: am35x: Workaround for fifo read issue
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>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/am35x.c32
-rw-r--r--drivers/usb/musb/musb_core.c6
2 files changed, 38 insertions, 0 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 2024940cdd8..1706c138bd5 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -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);
+ }
+}
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index dc740cf18e4..6fe2c39bce8 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -142,6 +142,11 @@ void write_fifo(u8 ep, u32 length, void *fifo_data)
}
/*
+ * 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
*
* ep - endpoint number
@@ -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 */