mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ira W. Snyder" <iws@ovro.caltech.edu>
To: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org, leoli@freescale.com,
	dan.j.williams@intel.com, "Ira W. Snyder" <iws@ovro.caltech.edu>
Subject: [PATCH v2 9/9] fsldma: make halt behave nicely on all supported controllers
Date: Wed,  2 Mar 2011 14:23:21 -0800	[thread overview]
Message-ID: <1299104601-15447-10-git-send-email-iws@ovro.caltech.edu> (raw)
In-Reply-To: <1299104601-15447-1-git-send-email-iws@ovro.caltech.edu>

The original dma_halt() function set the CA (channel abort) bit on both
the 83xx and 85xx controllers. This is incorrect on the 83xx, where this
bit means TEM (transfer error mask) instead. The 83xx doesn't support
channel abort, so we only do this operation on 85xx.

Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
---
 drivers/dma/fsldma.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 40babc1..eb7bc24 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -216,13 +216,26 @@ static void dma_halt(struct fsldma_chan *chan)
 	u32 mode;
 	int i;
 
+	/* read the mode register */
 	mode = DMA_IN(chan, &chan->regs->mr, 32);
-	mode |= FSL_DMA_MR_CA;
-	DMA_OUT(chan, &chan->regs->mr, mode, 32);
 
-	mode &= ~(FSL_DMA_MR_CS | FSL_DMA_MR_EMS_EN | FSL_DMA_MR_CA);
+	/*
+	 * The 85xx controller supports channel abort, which will stop
+	 * the current transfer. On 83xx, this bit is the transfer error
+	 * mask bit, which should not be changed.
+	 */
+	if ((chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX) {
+		mode |= FSL_DMA_MR_CA;
+		DMA_OUT(chan, &chan->regs->mr, mode, 32);
+
+		mode &= ~FSL_DMA_MR_CA;
+	}
+
+	/* stop the DMA controller */
+	mode &= ~(FSL_DMA_MR_CS | FSL_DMA_MR_EMS_EN);
 	DMA_OUT(chan, &chan->regs->mr, mode, 32);
 
+	/* wait for the DMA controller to become idle */
 	for (i = 0; i < 100; i++) {
 		if (dma_is_idle(chan))
 			return;
-- 
1.7.3.4


      parent reply	other threads:[~2011-03-02 22:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-02 22:23 [PATCH v2 0/9] fsldma: lockup fixes Ira W. Snyder
2011-03-02 22:23 ` [PATCH v2 1/9] dmatest: fix automatic buffer unmap type Ira W. Snyder
2011-03-02 22:23 ` [PATCH v2 2/9] fsldma: move related helper functions near each other Ira W. Snyder
2011-03-02 22:23 ` [PATCH v2 3/9] fsldma: use channel name in printk output Ira W. Snyder
2011-03-02 23:17   ` Joe Perches
2011-03-02 22:23 ` [PATCH v2 4/9] fsldma: improve link descriptor debugging Ira W. Snyder
2011-03-02 22:23 ` [PATCH v2 5/9] fsldma: minor codingstyle and consistency fixes Ira W. Snyder
2011-03-02 22:23 ` [PATCH v2 6/9] fsldma: fix controller lockups Ira W. Snyder
2011-03-02 22:23 ` [PATCH v2 7/9] fsldma: support async_tx dependencies and automatic unmapping Ira W. Snyder
2011-03-02 22:23 ` [PATCH v2 8/9] fsldma: reduce locking during descriptor cleanup Ira W. Snyder
2011-03-02 22:23 ` Ira W. Snyder [this message]

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=1299104601-15447-10-git-send-email-iws@ovro.caltech.edu \
    --to=iws@ovro.caltech.edu \
    --cc=dan.j.williams@intel.com \
    --cc=leoli@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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

all inboxes | Powered by JetHome®