Re: [PATCH] USB: musb: clear RXCSR_AUTOCLEAR before PIO read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, Nov 16, 2010 at 11:37:37PM +0800, tom.leiming@xxxxxxxxx wrote:
From: Ming Lei <tom.leiming@xxxxxxxxx>

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@xxxxxxxxx>

applied, thanks.

I also updated the comment above the csr change to reflect what you did:

commit 76365a71c1c716c7a818d3927f604c2799429a38
Author: Ming Lei <tom.leiming@xxxxxxxxx>
Date:   Tue Nov 16 23:37:37 2010 +0800

    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@xxxxxxxxx>
    Signed-off-by: Felipe Balbi <balbi@xxxxxx>

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 0169dcf..363cfad 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)
                         if (is_dma_capable() && musb_ep->dma) {
                                unmap_dma_buffer(req, musb);
- /* Clear DMAENAB for the
+                               /*
+                                * Clear DMAENAB and AUTOCLEAR for the
                                 * PIO mode transfer
                                 */
-                               csr &= ~MUSB_RXCSR_DMAENAB;
+                               csr &= ~(MUSB_RXCSR_DMAENAB | MUSB_RXCSR_AUTOCLEAR);
                                musb_writew(epio, MUSB_RXCSR, csr);
                        }
--
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux