Commit 87171037 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Ben Hutchings

usb: musb: tusb6010_omap: Do not reset the other direction's packet size

commit 6df2b42f upstream.

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: 550a7375 ("USB: Add MUSB and TUSB support")
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarBin Liu <b-liu@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 08860e17
...@@ -220,6 +220,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, ...@@ -220,6 +220,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
u32 dma_remaining; u32 dma_remaining;
int src_burst, dst_burst; int src_burst, dst_burst;
u16 csr; u16 csr;
u32 psize;
int ch; int ch;
s8 dmareq; s8 dmareq;
s8 sync_dev; s8 sync_dev;
...@@ -391,15 +392,19 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, ...@@ -391,15 +392,19 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
if (chdat->tx) { if (chdat->tx) {
/* Send transfer_packet_sz packets at a time */ /* Send transfer_packet_sz packets at a time */
musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, psize = musb_readl(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET);
chdat->transfer_packet_sz); 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, musb_writel(ep_conf, TUSB_EP_TX_OFFSET,
TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len)); TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len));
} else { } else {
/* Receive transfer_packet_sz packets at a time */ /* Receive transfer_packet_sz packets at a time */
musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, psize = musb_readl(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET);
chdat->transfer_packet_sz << 16); 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, musb_writel(ep_conf, TUSB_EP_RX_OFFSET,
TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len)); TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len));
......
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