[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / psp / 0013-usb-musb-cppi41-fix-zero-byte-OUT-issue.patch
1 From 4fbf77cebc6d141b9a74a92fd2b3f756908ef657 Mon Sep 17 00:00:00 2001
2 From: Ajay Kumar Gupta <ajay.gupta@ti.com>
3 Date: Wed, 18 Apr 2012 00:16:03 +0530
4 Subject: [PATCH 13/18] usb: musb: cppi41: fix zero byte OUT issue
6 Fixes ZERO byte transfer in tx direction which was not being done in DMA mode.
7 Used PIO mode for all zero byte tx transfer.
8 ---
9 drivers/usb/musb/musb_host.c | 12 +++++++++++-
10 1 files changed, 11 insertions(+), 1 deletions(-)
12 diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
13 index 7545a65..8981586 100644
14 --- a/drivers/usb/musb/musb_host.c
15 +++ b/drivers/usb/musb/musb_host.c
16 @@ -761,6 +761,8 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
17 void __iomem *epio = hw_ep->regs;
18 struct musb_qh *qh = musb_ep_get_qh(hw_ep, !is_out);
19 u16 packet_sz = qh->maxpacket;
20 + u8 use_dma = 1;
21 + u16 csr;
23 dev_dbg(musb->controller, "%s hw%d urb %p spd%d dev%d ep%d%s "
24 "h_addr%02x h_port%02x bytes %d\n",
25 @@ -772,9 +774,17 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
27 musb_ep_select(musb, mbase, epnum);
29 + if (is_out && !len) {
30 + use_dma = 0;
31 + csr = musb_readw(epio, MUSB_TXCSR);
32 + csr &= ~MUSB_TXCSR_DMAENAB;
33 + musb_writew(epio, MUSB_TXCSR, csr);
34 + hw_ep->tx_channel = NULL;
35 + }
36 +
37 /* candidate for DMA? */
38 dma_controller = musb->dma_controller;
39 - if (is_dma_capable() && epnum && dma_controller) {
40 + if (use_dma && is_dma_capable() && epnum && dma_controller) {
41 dma_channel = is_out ? hw_ep->tx_channel : hw_ep->rx_channel;
42 if (!dma_channel) {
43 dma_channel = dma_controller->channel_alloc(
44 --
45 1.7.7.6