Skip to contentSkip to conversation

USB: musb_udc: Make musb_peri_rx_ep check for MUSB_RXCSR_RXPKTRDY

PATCH Superseded Tom Rini 1 participant 2 messages Sep 13, 2012 – Oct 17, 2012

Subsystems (2)
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH v2 1/1 USB: musb_udc: Make musb_peri_rx_ep check for MUSB_RXCSR_RXPKTRDY

From: Pankaj Bharadiya <[email protected]>

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.

---
 drivers/usb/musb/musb_udc.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/usb/musb/musb_udc.c +10 -1
index 09cdec3..e0b4217 100644
@@ -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;
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v2 1/1 USB: musb_udc: Make musb_peri_rx_ep check for MUSB_RXCSR_RXPKTRDY

Quoted 11 lines · Tom Rini

From: Pankaj Bharadiya <[email protected]>

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.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121017/597103a9/attachment.pgp>