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. 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. 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> --- 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 9038b08..9cfd18b 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -927,13 +927,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) @@ -969,10 +965,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 -- 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