From: Jiada Wang <jiada_wang@mentor.com>
To: <vinod.koul@intel.com>, <dan.j.williams@intel.com>
Cc: <dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<george_davis@mentor.com>, <jiada_wang@mentor.com>
Subject: [PATCH 09/10] dma: imx-sdma: disable channel 0 when it timeouts
Date: Mon, 16 May 2016 17:37:57 +0900 [thread overview]
Message-ID: <1463387878-7643-10-git-send-email-jiada_wang@mentor.com> (raw)
In-Reply-To: <1463387878-7643-1-git-send-email-jiada_wang@mentor.com>
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
next prev parent reply other threads:[~2016-05-16 8:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-16 8:37 [PATCH v1 00/10] *** imx-sdma: misc fix *** Jiada Wang
2016-05-16 8:37 ` [PATCH 01/10] dma: imx-sdma: use chn_real_count to report residue for UART Jiada Wang
2016-05-16 8:37 ` [PATCH 02/10] dma: imx-sdma: don't update BD in isr routine Jiada Wang
2016-05-16 8:37 ` [PATCH 03/10] dma: imx-sdma: clear BD_RROR flag before pass it to sdma script Jiada Wang
2016-05-16 8:37 ` [PATCH 04/10] dma: imx-sdma: update sdma channel status for cyclic dma Jiada Wang
2016-05-16 8:37 ` [PATCH 05/10] dma: imx-sdma: add flag to indicate SDMA channel state Jiada Wang
2016-05-16 8:37 ` [PATCH 06/10] dma: imx-sdma: add terminate_all support Jiada Wang
2016-05-16 8:37 ` [PATCH 07/10] dma: imx-sdma: Add synchronization support Jiada Wang
2016-05-16 8:37 ` [PATCH 08/10] dma: imx-sdma: abort updating channel when it has been terminated Jiada Wang
2016-05-16 8:37 ` Jiada Wang [this message]
2016-05-16 8:37 ` [PATCH 10/10] dma: imx-sdma: clear channel0 interrupt bit in irq routine Jiada Wang
2016-05-16 11:00 ` [PATCH v1 00/10] *** imx-sdma: misc fix *** Vladimir Zapolskiy
2016-05-17 3:47 Jiada Wang
2016-05-17 3:47 ` [PATCH 09/10] dma: imx-sdma: disable channel 0 when it timeouts Jiada Wang
2016-05-17 3:48 [PATCH v1 00/10] *** imx-sdma: misc fix *** Jiada Wang
2016-05-17 3:48 ` [PATCH 09/10] dma: imx-sdma: disable channel 0 when it timeouts Jiada Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1463387878-7643-10-git-send-email-jiada_wang@mentor.com \
--to=jiada_wang@mentor.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=george_davis@mentor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).