Skip to content

Commit

Permalink
usb: musb: tusb6010_omap: Do not reset the other direction's packet size
Browse files Browse the repository at this point in the history
We have one register for each EP to set the maximum packet size for both
TX and RX.
If for example an RX programming would happen before the previous TX
transfer finishes we would reset the TX packet side.

To fix this issue, only modify the TX or RX part of the register.

Fixes: 550a737 ("USB: Add MUSB and TUSB support")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Ujfalusi authored and Greg Kroah-Hartman committed May 18, 2017
1 parent 3c50ffe commit 6df2b42
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions drivers/usb/musb/tusb6010_omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
u32 dma_remaining;
int src_burst, dst_burst;
u16 csr;
u32 psize;
int ch;
s8 dmareq;
s8 sync_dev;
Expand Down Expand Up @@ -390,15 +391,19 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,

if (chdat->tx) {
/* Send transfer_packet_sz packets at a time */
musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET,
chdat->transfer_packet_sz);
psize = musb_readl(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET);
psize &= ~0x7ff;
psize |= chdat->transfer_packet_sz;
musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, psize);

musb_writel(ep_conf, TUSB_EP_TX_OFFSET,
TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len));
} else {
/* Receive transfer_packet_sz packets at a time */
musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET,
chdat->transfer_packet_sz << 16);
psize = musb_readl(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET);
psize &= ~(0x7ff << 16);
psize |= (chdat->transfer_packet_sz << 16);
musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, psize);

musb_writel(ep_conf, TUSB_EP_RX_OFFSET,
TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len));
Expand Down

0 comments on commit 6df2b42

Please sign in to comment.