Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1401361

[PATCH 09/10] dma: imx-sdma: disable channel 0 when it timeouts

From Jiada Wang <jiada_wang@mentor.com>
Newsgroups linux.kernel
Subject [PATCH 09/10] dma: imx-sdma: disable channel 0 when it timeouts
Date 2016-05-16 10:40 +0200
Message-ID <rzmed-4Dx-1@gated-at.bofh.it> (permalink)
References <rzmed-4Dx-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@mentor.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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 09/10] dma: imx-sdma: disable channel 0 when it timeouts Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200

csiph-web