diff options
author | Ming Lei <tom.leiming@gmail.com> | 2010-11-16 10:37:37 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2010-11-22 05:36:49 -0500 |
commit | e75df37165c639b06213ec88b4763c3e50a7f079 (patch) | |
tree | 100a2a07cccb4c1d2e956b3ec4182fda40777772 /drivers/usb/musb/musb_gadget.c | |
parent | 92d2711f5dc15bf956546923a5718e74853f9912 (diff) |
usb: musb: clear RXCSR_AUTOCLEAR before PIO read
If RXCSR_AUTOCLEAR flag is not cleard before PIO reading, one packet
may be recieved by musb fifo, but no chance to notify
software, so cause packet loss, follows the detailed process:
- PIO read one packet
- musb fifo auto clear the MUSB_RXCSR_RXPKTRDY
- musb continue to recieve the next packet, and MUSB_RXCSR_RXPKTRDY
is set
- software clear the MUSB_RXCSR_RXPKTRDY, so there is no chance for
musb to notify software that the 2nd recieved packet.
The patch does fix the g_ether issue below:
- use fifo_mode 3 to enable double buffer
- 'ping -s 1024 IP_OF_BEAGLE_XM'
- one usb packet of 512 byte is lost, so ping failed,
which can be observed by wireshark
note:
Beagle xm takes musb rtl1.8 and may fallback to pio mode
for unaligned buffer.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/musb_gadget.c')
-rw-r--r-- | drivers/usb/musb/musb_gadget.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 0169dcf3a6ff..363cfad003f8 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -765,10 +765,11 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
765 | if (is_dma_capable() && musb_ep->dma) { | 765 | if (is_dma_capable() && musb_ep->dma) { |
766 | unmap_dma_buffer(req, musb); | 766 | unmap_dma_buffer(req, musb); |
767 | 767 | ||
768 | /* Clear DMAENAB for the | 768 | /* |
769 | * Clear DMAENAB and AUTOCLEAR for the | ||
769 | * PIO mode transfer | 770 | * PIO mode transfer |
770 | */ | 771 | */ |
771 | csr &= ~MUSB_RXCSR_DMAENAB; | 772 | csr &= ~(MUSB_RXCSR_DMAENAB | MUSB_RXCSR_AUTOCLEAR); |
772 | musb_writew(epio, MUSB_RXCSR, csr); | 773 | musb_writew(epio, MUSB_RXCSR, csr); |
773 | } | 774 | } |
774 | 775 | ||