linux-ti33x-psp 3.2: backport PM and USB fixes from PSP
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / psp / 0016-usb-musb-cppi41-tx-dma-completion-fixes.patch
1 From 2e3ec89c3e6cf54d83479d7437696343463c90e5 Mon Sep 17 00:00:00 2001
2 From: Ajay Kumar Gupta <ajay.gupta@ti.com>
3 Date: Thu, 24 May 2012 16:03:02 +0530
4 Subject: [PATCH 16/18] usb: musb: cppi41: tx dma completion fixes
6 Use spinlock_irqsave/restore only during txdma completion giveback.
8 Signed-off-by: Ravi B <ravibabu@ti.com>
9 ---
10  drivers/usb/musb/cppi41_dma.c |    5 +++--
11  1 files changed, 3 insertions(+), 2 deletions(-)
13 diff --git a/drivers/usb/musb/cppi41_dma.c b/drivers/usb/musb/cppi41_dma.c
14 index 4367e4f..ea83f9a 100644
15 --- a/drivers/usb/musb/cppi41_dma.c
16 +++ b/drivers/usb/musb/cppi41_dma.c
17 @@ -1354,7 +1354,6 @@ void txdma_completion_work(struct work_struct *data)
18                         u16 csr;
19  
20                         tx_ch = &cppi->tx_cppi_ch[index];
21 -                       spin_lock_irqsave(&musb->lock, flags);
22                         if (tx_ch->tx_complete) {
23                                 /* Sometimes a EP can unregister from a DMA
24                                  * channel while the data is still in the FIFO.
25 @@ -1384,10 +1383,12 @@ void txdma_completion_work(struct work_struct *data)
26                                         tx_ch->channel.status =
27                                                 MUSB_DMA_STATUS_FREE;
28                                         tx_ch->tx_complete = 0;
29 +                                       spin_lock_irqsave(&musb->lock, flags);
30                                         musb_dma_completion(musb, index+1, 1);
31 +                                       spin_unlock_irqrestore(&musb->lock,
32 +                                               flags);
33                                 }
34                         }
35 -                       spin_unlock_irqrestore(&musb->lock, flags);
36  
37                         if (!resched)
38                                 cond_resched();
39 -- 
40 1.7.7.6