[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1463456876-10580-10-git-send-email-jiada_wang@mentor.com>
Date: Tue, 17 May 2016 12:47:55 +0900
From: Jiada Wang <jiada_wang@...tor.com>
To: <vinod.koul@...el.com>, <dan.j.williams@...el.com>
CC: <dmaengine@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<shawnguo@...nel.com>, <kernel@...gutronix.de>,
<george_davis@...tor.com>, <jiada_wang@...tor.com>
Subject: [PATCH 09/10] dma: imx-sdma: disable channel 0 when it timeouts
Previously when channel0 timeouts to finish its task,
sdma_run_channel0() just returns without disable channel0,
this will cause continuous interrupt later when channel0
finishs its task and set channel0 interrupt bit.
Signed-off-by: Jiada Wang <jiada_wang@...tor.com>
---
drivers/dma/imx-sdma.c | 43 ++++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index bc867e5..8b20bf4 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -572,6 +572,27 @@ static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
spin_unlock_irqrestore(&sdmac->lock, flags);
}
+static struct sdma_channel *to_sdma_chan(struct dma_chan *chan)
+{
+ return container_of(chan, struct sdma_channel, chan);
+}
+
+static int sdma_disable_channel(struct dma_chan *chan)
+{
+ struct sdma_channel *sdmac = to_sdma_chan(chan);
+ struct sdma_engine *sdma = sdmac->sdma;
+ int channel = sdmac->channel;
+ unsigned long flags;
+
+ spin_lock_irqsave(&sdmac->lock, flags);
+ sdmac->enabled = false;
+ writel_relaxed(BIT(channel), sdma->regs + SDMA_H_STATSTOP);
+ sdmac->status = DMA_ERROR;
+ spin_unlock_irqrestore(&sdmac->lock, flags);
+
+ return 0;
+}
+
/*
* sdma_run_channel0 - run a channel and wait till it's done
*/
@@ -592,6 +613,7 @@ static int sdma_run_channel0(struct sdma_engine *sdma)
/* Clear the interrupt status */
writel_relaxed(ret, sdma->regs + SDMA_H_INTR);
} else {
+ sdma_disable_channel(&sdma->channel[0].chan);
dev_err(sdma->dev, "Timeout waiting for CH0 ready\n");
}
@@ -916,27 +938,6 @@ static int sdma_load_context(struct sdma_channel *sdmac)
return ret;
}
-static struct sdma_channel *to_sdma_chan(struct dma_chan *chan)
-{
- return container_of(chan, struct sdma_channel, chan);
-}
-
-static int sdma_disable_channel(struct dma_chan *chan)
-{
- struct sdma_channel *sdmac = to_sdma_chan(chan);
- struct sdma_engine *sdma = sdmac->sdma;
- int channel = sdmac->channel;
- unsigned long flags;
-
- spin_lock_irqsave(&sdmac->lock, flags);
- sdmac->enabled = false;
- writel_relaxed(BIT(channel), sdma->regs + SDMA_H_STATSTOP);
- sdmac->status = DMA_ERROR;
- spin_unlock_irqrestore(&sdmac->lock, flags);
-
- return 0;
-}
-
static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac)
{
struct sdma_engine *sdma = sdmac->sdma;
--
2.4.5
Powered by blists - more mailing lists