Commit ba58b4ace6a3dc60a62474a8176929c9adb13a28

Authored by Eric Lee
1 parent c239208a68

usb: musb: cppi41: fix not transmitting zero length packet issue

Showing 2 changed files with 16 additions and 4 deletions Side-by-side Diff

arch/arm/configs/smarc_t335x_defconfig
... ... @@ -963,8 +963,7 @@
963 963 CONFIG_PREVENT_FIRMWARE_BUILD=y
964 964 CONFIG_FW_LOADER=y
965 965 CONFIG_FIRMWARE_IN_KERNEL=y
966   -CONFIG_EXTRA_FIRMWARE="am335x-pm-firmware.elf"
967   -CONFIG_EXTRA_FIRMWARE_DIR="firmware"
  966 +CONFIG_EXTRA_FIRMWARE=""
968 967 CONFIG_FW_LOADER_USER_HELPER=y
969 968 # CONFIG_DEBUG_DRIVER is not set
970 969 # CONFIG_DEBUG_DEVRES is not set
drivers/usb/musb/musb_cppi41.c
... ... @@ -39,6 +39,7 @@
39 39 u32 transferred;
40 40 u32 packet_sz;
41 41 struct list_head tx_check;
  42 + int tx_zlp;
42 43 };
43 44  
44 45 #define MUSB_DMA_NUM_CHANNELS 15
... ... @@ -122,6 +123,8 @@
122 123 {
123 124 struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep;
124 125 struct musb *musb = hw_ep->musb;
  126 + void __iomem *epio = hw_ep->regs;
  127 + u16 csr;
125 128  
126 129 if (!cppi41_channel->prog_len) {
127 130  
128 131  
129 132  
... ... @@ -130,15 +133,24 @@
130 133 cppi41_channel->transferred;
131 134 cppi41_channel->channel.status = MUSB_DMA_STATUS_FREE;
132 135 cppi41_channel->channel.rx_packet_done = true;
  136 +
  137 + /*
  138 + * transmit ZLP using PIO mode for transfers which size is
  139 + * multiple of EP packet size.
  140 + */
  141 + if (cppi41_channel->tx_zlp && (cppi41_channel->transferred %
  142 + cppi41_channel->packet_sz) == 0) {
  143 + musb_ep_select(musb->mregs, hw_ep->epnum);
  144 + csr = MUSB_TXCSR_MODE | MUSB_TXCSR_TXPKTRDY;
  145 + musb_writew(epio, MUSB_TXCSR, csr);
  146 + }
133 147 musb_dma_completion(musb, hw_ep->epnum, cppi41_channel->is_tx);
134 148 } else {
135 149 /* next iteration, reload */
136 150 struct dma_chan *dc = cppi41_channel->dc;
137 151 struct dma_async_tx_descriptor *dma_desc;
138 152 enum dma_transfer_direction direction;
139   - u16 csr;
140 153 u32 remain_bytes;
141   - void __iomem *epio = cppi41_channel->hw_ep->regs;
142 154  
143 155 cppi41_channel->buf_addr += cppi41_channel->packet_sz;
144 156  
... ... @@ -371,6 +383,7 @@
371 383 cppi41_channel->total_len = len;
372 384 cppi41_channel->transferred = 0;
373 385 cppi41_channel->packet_sz = packet_sz;
  386 + cppi41_channel->tx_zlp = (cppi41_channel->is_tx && mode) ? 1 : 0;
374 387  
375 388 /*
376 389 * Due to AM335x' Advisory 1.0.13 we are not allowed to transfer more