Commit 9f445cb2 authored by Cliff Cai's avatar Cliff Cai Committed by Greg Kroah-Hartman

USB: musb: disable double buffering for older RTL versions

Trying to use double buffer modes in RTL versions <2.0 may result in
infinite hangs or data corruption.  So avoid them with older versions.
Signed-off-by: default avatarCliff Cai <cliff.cai@analog.com>
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0ded2f14
...@@ -895,6 +895,13 @@ static int musb_gadget_enable(struct usb_ep *ep, ...@@ -895,6 +895,13 @@ static int musb_gadget_enable(struct usb_ep *ep,
/* REVISIT if can_bulk_split(), use by updating "tmp"; /* REVISIT if can_bulk_split(), use by updating "tmp";
* likewise high bandwidth periodic tx * 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.
*/
if (musb->hwvers < MUSB_HWVERS_2000)
musb_writew(regs, MUSB_TXMAXP, hw_ep->max_packet_sz_tx);
else
musb_writew(regs, MUSB_TXMAXP, tmp); musb_writew(regs, MUSB_TXMAXP, tmp);
csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG; csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG;
...@@ -925,6 +932,12 @@ static int musb_gadget_enable(struct usb_ep *ep, ...@@ -925,6 +932,12 @@ static int musb_gadget_enable(struct usb_ep *ep,
/* REVISIT if can_bulk_combine() use by updating "tmp" /* REVISIT if can_bulk_combine() use by updating "tmp"
* likewise high bandwidth periodic rx * likewise high bandwidth periodic rx
*/ */
/* 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, tmp); musb_writew(regs, MUSB_RXMAXP, tmp);
/* force shared fifo to OUT-only mode */ /* force shared fifo to OUT-only mode */
......
...@@ -605,6 +605,12 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, struct musb_hw_ep *ep) ...@@ -605,6 +605,12 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, struct musb_hw_ep *ep)
musb_writeb(ep->regs, MUSB_RXTYPE, qh->type_reg); musb_writeb(ep->regs, MUSB_RXTYPE, qh->type_reg);
musb_writeb(ep->regs, MUSB_RXINTERVAL, qh->intv_reg); musb_writeb(ep->regs, MUSB_RXINTERVAL, qh->intv_reg);
/* NOTE: bulk combining rewrites high bits of maxpacket */ /* NOTE: bulk combining rewrites high bits of maxpacket */
/* Set RXMAXP with the FIFO size of the endpoint
* to disable double buffer mode.
*/
if (musb->hwvers < MUSB_HWVERS_2000)
musb_writew(ep->regs, MUSB_RXMAXP, ep->max_packet_sz_rx);
else
musb_writew(ep->regs, MUSB_RXMAXP, musb_writew(ep->regs, MUSB_RXMAXP,
qh->maxpacket | ((qh->hb_mult - 1) << 11)); qh->maxpacket | ((qh->hb_mult - 1) << 11));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment