RE: [PATCH 2/2] USB: musb: gadget: fix MUSB_TXMAXP and MUSB_RXMAXP configuration

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

 



 

>-----Original Message-----
>From: tom.leiming@xxxxxxxxx [mailto:tom.leiming@xxxxxxxxx] 
>Sent: Wednesday, September 29, 2010 8:56 PM
>To: greg@xxxxxxxxx; balbi@xxxxxx
>Cc: linux-usb@xxxxxxxxxxxxxxx; Ming Lei; Cai, Cliff; David 
>Brownell; Anand Gadiyar; Mike Frysinger; Sergei Shtylyov; 
>stable@xxxxxxxxxx
>Subject: [PATCH 2/2] USB: musb: gadget: fix MUSB_TXMAXP and 
>MUSB_RXMAXP configuration
>
>From: Ming Lei <tom.leiming@xxxxxxxxx>
>
>Commit 9f445cb29918dc488b7a9a92ef018599cce33df7[USB: musb: 
>disable double buffering for older RTL versions] tries to 
>disable double buffer mode by writing endpoint hw max packet 
>size to TXMAP/RXMAP.
>
>First this way taken is very wrong, which can break full speed 
>mode and cause overflow problem, and we should always set this 
>registers by the actual max packet size from endpoint descriptor.

Double buffering is the hw(musb) specific feature.I guess I don't
Understand your idea. 

>Secondly, I have fixed the double buffer mode problem already 
>in the previous patchset, and found the problem of 'infinite 
>hangs or data corruption' decribled in Commit 
>9f445cb29918dc488b7a9a92ef018599cce33df7
>is caused by musb gadget driver, nothing to do with older RTL chip.
>My beagle B5 uses RTL 1.4 musb IP core, but either 
>g_file_storage/g_ether /g_zero can work well in double buffer mode.

I'm not sure if your test cases cover the tests which will cause the
data
Corruption problem.

Bob, Could you take a look at this?


Thanks

Cliff 

>So, fix the problem by always using actual max packet size 
>from endpoint descriptor to config TXMAP/RXMAP.
>
>Cc: Cliff Cai <cliff.cai@xxxxxxxxxx>
>Cc: Felipe Balbi <balbi@xxxxxx>
>Cc: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
>Cc: Anand Gadiyar <gadiyar@xxxxxx>
>Cc: Mike Frysinger <vapier@xxxxxxxxxx>
>Cc: Sergei Shtylyov <sshtylyov@xxxxxxxxxxxxx>
>Cc: stable@xxxxxxxxxx
>Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx>
>---
>This one is against musb-next branch of Felipe's tree.
>---
> drivers/usb/musb/musb_gadget.c |   13 +++----------
> 1 files changed, 3 insertions(+), 10 deletions(-)
>
>diff --git a/drivers/usb/musb/musb_gadget.c 
>b/drivers/usb/musb/musb_gadget.c index 256e555..9668760 100644
>--- a/drivers/usb/musb/musb_gadget.c
>+++ b/drivers/usb/musb/musb_gadget.c
>@@ -985,13 +985,9 @@ static int musb_gadget_enable(struct usb_ep *ep,
> 		 * likewise high bandwidth periodic tx
> 		 */
> 		/* Set TXMAXP with the FIFO size of the endpoint
>-		 * to disable double buffering mode. Currently, 
>It seems that double
>-		 * buffering has problem if musb RTL revision 
>number < 2.0.
>+		 * to disable double buffering mode.
> 		 */
>-		if (musb->hwvers < MUSB_HWVERS_2000)
>-			musb_writew(regs, MUSB_TXMAXP, 
>hw_ep->max_packet_sz_tx);
>-		else
>-			musb_writew(regs, MUSB_TXMAXP, 
>musb_ep->packet_sz | (musb_ep->hb_mult << 11));
>+		musb_writew(regs, MUSB_TXMAXP, 
>musb_ep->packet_sz | (musb_ep->hb_mult 
>+<< 11));
> 
> 		csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG;
> 		if (musb_readw(regs, MUSB_TXCSR)
>@@ -1027,10 +1023,7 @@ static int musb_gadget_enable(struct usb_ep *ep,
> 		/* Set RXMAXP with the FIFO size of the endpoint
> 		 * to disable double buffering mode.
> 		 */
>-		if (musb->hwvers < MUSB_HWVERS_2000)
>-			musb_writew(regs, MUSB_RXMAXP, 
>hw_ep->max_packet_sz_rx);
>-		else
>-			musb_writew(regs, MUSB_RXMAXP, 
>musb_ep->packet_sz | (musb_ep->hb_mult << 11));
>+		musb_writew(regs, MUSB_RXMAXP, 
>musb_ep->packet_sz | (musb_ep->hb_mult 
>+<< 11));
> 
> 		/* force shared fifo to OUT-only mode */
> 		if (hw_ep->is_shared_fifo) {
>--
>1.6.2.5
>
>
--
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