diff options
author | Ming Lei <tom.leiming@gmail.com> | 2010-10-19 20:08:25 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2010-11-05 07:56:17 -0400 |
commit | 31c9909b512aa4c97cffc40627c255070fe0bc78 (patch) | |
tree | e01b78d1ac0cdb7acc99d41f9b968d3dc6529f68 /drivers/usb | |
parent | 120d074c58172cd44887d86c9acc44882818c7e7 (diff) |
USB: musb: gadget: fix MUSB_TXMAXP and MUSB_RXMAXP configuration
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@analog.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Anand Gadiyar <gadiyar@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: stable@kernel.org
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | 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 ba22e4a20f95..f37b8594edeb 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, | |||
926 | * likewise high bandwidth periodic tx | 926 | * likewise high bandwidth periodic tx |
927 | */ | 927 | */ |
928 | /* Set TXMAXP with the FIFO size of the endpoint | 928 | /* Set TXMAXP with the FIFO size of the endpoint |
929 | * to disable double buffering mode. Currently, It seems that double | 929 | * to disable double buffering mode. |
930 | * buffering has problem if musb RTL revision number < 2.0. | ||
931 | */ | 930 | */ |
932 | if (musb->hwvers < MUSB_HWVERS_2000) | 931 | musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11)); |
933 | musb_writew(regs, MUSB_TXMAXP, hw_ep->max_packet_sz_tx); | ||
934 | else | ||
935 | musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11)); | ||
936 | 932 | ||
937 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG; | 933 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG; |
938 | if (musb_readw(regs, MUSB_TXCSR) | 934 | if (musb_readw(regs, MUSB_TXCSR) |
@@ -968,10 +964,7 @@ static int musb_gadget_enable(struct usb_ep *ep, | |||
968 | /* Set RXMAXP with the FIFO size of the endpoint | 964 | /* Set RXMAXP with the FIFO size of the endpoint |
969 | * to disable double buffering mode. | 965 | * to disable double buffering mode. |
970 | */ | 966 | */ |
971 | if (musb->hwvers < MUSB_HWVERS_2000) | 967 | musb_writew(regs, MUSB_RXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11)); |
972 | musb_writew(regs, MUSB_RXMAXP, hw_ep->max_packet_sz_rx); | ||
973 | else | ||
974 | musb_writew(regs, MUSB_RXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11)); | ||
975 | 968 | ||
976 | /* force shared fifo to OUT-only mode */ | 969 | /* force shared fifo to OUT-only mode */ |
977 | if (hw_ep->is_shared_fifo) { | 970 | if (hw_ep->is_shared_fifo) { |