On Fri, Nov 5, 2010 at 8:58 PM, Felipe Balbi <balbi@xxxxxx> wrote: > 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 the approach can break full speed and cause overflow problems. > We should always set those registers with the actual max packet size > from endpoint descriptor. > > Second, the problem describe by commit 9f445cb29918dc488b7a9a92ef018599cce33df7 > was caused by musb gadget driver; nothing to do with RTL revision as > originaly suspected. > > The real fix to the problem is to always use actual max packet > size from endpoint descriptor to config TXMAP/RXMAP registers. > > Cc: Cliff Cai <cliff.cai@xxxxxxxxxx> > 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> > Signed-off-by: Felipe Balbi <balbi@xxxxxx> > --- > Â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 ba22e4a..f37b859 100644 > --- a/drivers/usb/musb/musb_gadget.c > +++ b/drivers/usb/musb/musb_gadget.c > @@ -926,13 +926,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) > @@ -968,10 +964,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.7.3.2.146.gca209 > > -- > 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 > Hi, Felipe After apply this patch, we will still get data corruption on blackfin platform(g_zero test) even following all of MingLei's suggestion. As you said "NAK. I have observed data corruption when using double buffering on tusb6010, omap3430 and omap3630." when cliff first upload patch "USB: musb: disable double buffering for older RTL versions". link:http://marc.info/?l=linux-usb&m=126472940418964&w=2 So could you please confirm this issue? This patch won't cause data corruption on tusb6010, omap3430 and omap3630 any more? Thanks. -- --Bob -- 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