aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorCliff Cai <cliff.cai@analog.com>2010-01-28 20:44:18 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 17:54:48 -0500
commit9f445cb29918dc488b7a9a92ef018599cce33df7 (patch)
tree912365e85cc2b0f75dfc20a011c9d7e2db195362 /drivers/usb
parent0ded2f146acfaf71e5f4c15b80cf89b3af48134c (diff)
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: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/musb/musb_gadget.c17
-rw-r--r--drivers/usb/musb/musb_host.c10
2 files changed, 23 insertions, 4 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index cbcf14a236e6..41de3a903152 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -895,7 +895,14 @@ static int musb_gadget_enable(struct usb_ep *ep,
895 /* REVISIT if can_bulk_split(), use by updating "tmp"; 895 /* REVISIT if can_bulk_split(), use by updating "tmp";
896 * likewise high bandwidth periodic tx 896 * likewise high bandwidth periodic tx
897 */ 897 */
898 musb_writew(regs, MUSB_TXMAXP, tmp); 898 /* Set TXMAXP with the FIFO size of the endpoint
899 * to disable double buffering mode. Currently, It seems that double
900 * buffering has problem if musb RTL revision number < 2.0.
901 */
902 if (musb->hwvers < MUSB_HWVERS_2000)
903 musb_writew(regs, MUSB_TXMAXP, hw_ep->max_packet_sz_tx);
904 else
905 musb_writew(regs, MUSB_TXMAXP, tmp);
899 906
900 csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG; 907 csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG;
901 if (musb_readw(regs, MUSB_TXCSR) 908 if (musb_readw(regs, MUSB_TXCSR)
@@ -925,7 +932,13 @@ static int musb_gadget_enable(struct usb_ep *ep,
925 /* REVISIT if can_bulk_combine() use by updating "tmp" 932 /* REVISIT if can_bulk_combine() use by updating "tmp"
926 * likewise high bandwidth periodic rx 933 * likewise high bandwidth periodic rx
927 */ 934 */
928 musb_writew(regs, MUSB_RXMAXP, tmp); 935 /* Set RXMAXP with the FIFO size of the endpoint
936 * to disable double buffering mode.
937 */
938 if (musb->hwvers < MUSB_HWVERS_2000)
939 musb_writew(regs, MUSB_RXMAXP, hw_ep->max_packet_sz_rx);
940 else
941 musb_writew(regs, MUSB_RXMAXP, tmp);
929 942
930 /* force shared fifo to OUT-only mode */ 943 /* force shared fifo to OUT-only mode */
931 if (hw_ep->is_shared_fifo) { 944 if (hw_ep->is_shared_fifo) {
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index c3fdd6d69f5e..3421cf9858b5 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -605,8 +605,14 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, struct musb_hw_ep *ep)
605 musb_writeb(ep->regs, MUSB_RXTYPE, qh->type_reg); 605 musb_writeb(ep->regs, MUSB_RXTYPE, qh->type_reg);
606 musb_writeb(ep->regs, MUSB_RXINTERVAL, qh->intv_reg); 606 musb_writeb(ep->regs, MUSB_RXINTERVAL, qh->intv_reg);
607 /* NOTE: bulk combining rewrites high bits of maxpacket */ 607 /* NOTE: bulk combining rewrites high bits of maxpacket */
608 musb_writew(ep->regs, MUSB_RXMAXP, 608 /* Set RXMAXP with the FIFO size of the endpoint
609 qh->maxpacket | ((qh->hb_mult - 1) << 11)); 609 * to disable double buffer mode.
610 */
611 if (musb->hwvers < MUSB_HWVERS_2000)
612 musb_writew(ep->regs, MUSB_RXMAXP, ep->max_packet_sz_rx);
613 else
614 musb_writew(ep->regs, MUSB_RXMAXP,
615 qh->maxpacket | ((qh->hb_mult - 1) << 11));
610 616
611 ep->rx_reinit = 0; 617 ep->rx_reinit = 0;
612} 618}