aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiang Wang <wangx@marvell.com>2013-06-18 02:55:59 -0400
committerVinod Koul <vinod.koul@intel.com>2013-08-05 00:02:27 -0400
commit26a2dfdeb9b93b82735d2227a118afa0ddd912dd (patch)
tree3ad7c738040a7c7851cc032ca60f5017f5bfa8cb
parent027f28b7bb589d726e3b6274a7d9272336522c65 (diff)
dma: mmp_pdma: clear DRCMR when free a phy channel
In mmp pdma, phy channels are allocated/freed dynamically. The mapping from DMA request to DMA channel number in DRCMR should be cleared when a phy channel is freed. Otherwise conflicts will happen when: 1. A is using channel 2 and free it after finished, but A still maps to channel 2 in DRCMR of A. 2. Now another one B gets channel 2. So B maps to channel 2 too in DRCMR of B. In the datasheet, it is described that "Do not map two active requests to the same channel since it produces unpredictable results" and we can observe that during test. Signed-off-by: Xiang Wang <wangx@marvell.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--drivers/dma/mmp_pdma.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index b1a260002cf8..9a32f2d174b0 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -252,10 +252,16 @@ static void mmp_pdma_free_phy(struct mmp_pdma_chan *pchan)
252{ 252{
253 struct mmp_pdma_device *pdev = to_mmp_pdma_dev(pchan->chan.device); 253 struct mmp_pdma_device *pdev = to_mmp_pdma_dev(pchan->chan.device);
254 unsigned long flags; 254 unsigned long flags;
255 u32 reg;
255 256
256 if (!pchan->phy) 257 if (!pchan->phy)
257 return; 258 return;
258 259
260 /* clear the channel mapping in DRCMR */
261 reg = pchan->phy->vchan->drcmr;
262 reg = ((reg < 64) ? 0x0100 : 0x1100) + ((reg & 0x3f) << 2);
263 writel(0, pchan->phy->base + reg);
264
259 spin_lock_irqsave(&pdev->phy_lock, flags); 265 spin_lock_irqsave(&pdev->phy_lock, flags);
260 pchan->phy->vchan = NULL; 266 pchan->phy->vchan = NULL;
261 pchan->phy = NULL; 267 pchan->phy = NULL;