Skip to content

Commit 1beae74

Browse files
Peter Ujfalusigregkh
authored andcommitted
usb: musb: tusb6010_omap: Do not reset the other direction's packet size
commit 6df2b42f7c040d57d9ecb67244e04e905ab87ac6 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: 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5cbfae4 commit 1beae74

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

drivers/usb/musb/tusb6010_omap.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
220220
u32 dma_remaining;
221221
int src_burst, dst_burst;
222222
u16 csr;
223+
u32 psize;
223224
int ch;
224225
s8 dmareq;
225226
s8 sync_dev;
@@ -391,15 +392,19 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
391392

392393
if (chdat->tx) {
393394
/* Send transfer_packet_sz packets at a time */
394-
musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET,
395-
chdat->transfer_packet_sz);
395+
psize = musb_readl(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET);
396+
psize &= ~0x7ff;
397+
psize |= chdat->transfer_packet_sz;
398+
musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, psize);
396399

397400
musb_writel(ep_conf, TUSB_EP_TX_OFFSET,
398401
TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len));
399402
} else {
400403
/* Receive transfer_packet_sz packets at a time */
401-
musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET,
402-
chdat->transfer_packet_sz << 16);
404+
psize = musb_readl(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET);
405+
psize &= ~(0x7ff << 16);
406+
psize |= (chdat->transfer_packet_sz << 16);
407+
musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, psize);
403408

404409
musb_writel(ep_conf, TUSB_EP_RX_OFFSET,
405410
TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len));

0 commit comments

Comments
 (0)