summaryrefslogtreecommitdiff
path: root/drivers/usb/musb
diff options
context:
space:
mode:
authorPankaj Bharadiya <pankaj.bharadiya@ti.com>2012-09-13 09:38:16 +0000
committerTom Rini <trini@ti.com>2012-10-23 08:33:17 -0700
commit3f0be8ea9217311ec41156fd89e3e23a0308f3b2 (patch)
treeba21021eefcd5ca701b0b689b272f06689df633b /drivers/usb/musb
parent39826f09978a0a7070999acc15babf88f03e4051 (diff)
downloadu-boot-imx-3f0be8ea9217311ec41156fd89e3e23a0308f3b2.zip
u-boot-imx-3f0be8ea9217311ec41156fd89e3e23a0308f3b2.tar.gz
u-boot-imx-3f0be8ea9217311ec41156fd89e3e23a0308f3b2.tar.bz2
USB: musb_udc: Make musb_peri_rx_ep check for MUSB_RXCSR_RXPKTRDY
The endpoint rx count register value will be zero if it is read before receive packet ready bit (PERI_RXCSR:RXPKTRDY) is set. Check for the receive packet ready bit (PERI_RXCSR:RXPKTRDY) before reading endpoint rx count register. Proceed with rx count read and FIFO read only if RXPKTRDY bit is set. Signed-off-by: Pankaj Bharadiya <pankaj.bharadiya@ti.com> Signed-off-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/musb_udc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/usb/musb/musb_udc.c b/drivers/usb/musb/musb_udc.c
index 09cdec3..e0b4217 100644
--- a/drivers/usb/musb/musb_udc.c
+++ b/drivers/usb/musb/musb_udc.c
@@ -640,8 +640,17 @@ static void musb_peri_ep0(void)
static void musb_peri_rx_ep(unsigned int ep)
{
- u16 peri_rxcount = readw(&musbr->ep[ep].epN.rxcount);
+ u16 peri_rxcount;
+ u8 peri_rxcsr = readw(&musbr->ep[ep].epN.rxcsr);
+ if (!(peri_rxcsr & MUSB_RXCSR_RXPKTRDY)) {
+ if (debug_level > 0)
+ serial_printf("ERROR : %s %d without MUSB_RXCSR_RXPKTRDY set\n",
+ __PRETTY_FUNCTION__, ep);
+ return;
+ }
+
+ peri_rxcount = readw(&musbr->ep[ep].epN.rxcount);
if (peri_rxcount) {
struct usb_endpoint_instance *endpoint;
u32 length;