提交 26a2dfde 编写于 作者: X Xiang Wang 提交者: Vinod Koul

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: NXiang Wang <wangx@marvell.com>
Signed-off-by: NVinod Koul <vinod.koul@intel.com>
上级 027f28b7
......@@ -252,10 +252,16 @@ static void mmp_pdma_free_phy(struct mmp_pdma_chan *pchan)
{
struct mmp_pdma_device *pdev = to_mmp_pdma_dev(pchan->chan.device);
unsigned long flags;
u32 reg;
if (!pchan->phy)
return;
/* clear the channel mapping in DRCMR */
reg = pchan->phy->vchan->drcmr;
reg = ((reg < 64) ? 0x0100 : 0x1100) + ((reg & 0x3f) << 2);
writel(0, pchan->phy->base + reg);
spin_lock_irqsave(&pdev->phy_lock, flags);
pchan->phy->vchan = NULL;
pchan->phy = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册