linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Kevin Hilman <khilman@deeprootsystems.com>,
	linux-omap@vger.kernel.org,
	Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Subject: [PATCH 01/10] OMAP2/3/4: DMA: disable channel interrupts in omap_init_dma()
Date: Fri, 14 May 2010 14:27:47 -0700	[thread overview]
Message-ID: <20100514212747.25599.60817.stgit@baageli.muru.com> (raw)
In-Reply-To: <20100514212506.25599.98073.stgit@baageli.muru.com>

From: Mika Westerberg <ext-mika.1.westerberg@nokia.com>

If we are softbooting another kernel using kexec, DMA controller state is not
known when we are performing omap_init_dma(). It is possible that some DMA
channels are already active. For example after kexec we get:

<4>IRQ 0020 for non-allocated DMAchannel 5
<4>IRQ 0020 for non-allocated DMAchannel 5
<4>IRQ 0020 for non-allocated DMAchannel 5
<4>IRQ 0020 for non-allocated DMAchannel 5
<4>IRQ 0020 for non-allocated DMAchannel 5

To prevent any weird things happening, we disable all channel interrupts during
init.

Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/dma.c |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 1d95996..ad42ec3 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -709,6 +709,21 @@ static inline void omap2_enable_irq_lch(int lch)
 	spin_unlock_irqrestore(&dma_chan_lock, flags);
 }
 
+static inline void omap2_disable_irq_lch(int lch)
+{
+	u32 val;
+	unsigned long flags;
+
+	if (!cpu_class_is_omap2())
+		return;
+
+	spin_lock_irqsave(&dma_chan_lock, flags);
+	val = dma_read(IRQENABLE_L0);
+	val &= ~(1 << lch);
+	dma_write(val, IRQENABLE_L0);
+	spin_unlock_irqrestore(&dma_chan_lock, flags);
+}
+
 int omap_request_dma(int dev_id, const char *dev_name,
 		     void (*callback)(int lch, u16 ch_status, void *data),
 		     void *data, int *dma_ch_out)
@@ -807,14 +822,7 @@ void omap_free_dma(int lch)
 	}
 
 	if (cpu_class_is_omap2()) {
-		u32 val;
-
-		spin_lock_irqsave(&dma_chan_lock, flags);
-		/* Disable interrupts */
-		val = dma_read(IRQENABLE_L0);
-		val &= ~(1 << lch);
-		dma_write(val, IRQENABLE_L0);
-		spin_unlock_irqrestore(&dma_chan_lock, flags);
+		omap2_disable_irq_lch(lch);
 
 		/* Clear the CSR register and IRQ status register */
 		dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch));
@@ -2107,6 +2115,9 @@ static int __init omap_init_dma(void)
 
 	for (ch = 0; ch < dma_chan_count; ch++) {
 		omap_clear_dma(ch);
+		if (cpu_class_is_omap2())
+			omap2_disable_irq_lch(ch);
+
 		dma_chan[ch].dev_id = -1;
 		dma_chan[ch].next_lch = -1;
 


  reply	other threads:[~2010-05-14 21:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-14 21:27 [PATCH 00/10] omap platform init patches for 2.6.35 merge window Tony Lindgren
2010-05-14 21:27 ` Tony Lindgren [this message]
2010-05-14 21:27 ` [PATCH 02/10] omap: DMA: Fix multi-line comments Tony Lindgren
2010-05-14 21:27 ` [PATCH 03/10] omap: init the gpio pinmux for mmc Tony Lindgren
2010-05-14 21:27 ` [PATCH 04/10] omap: hsmmc: fix the hsmmc driver for am3517 Tony Lindgren
2010-05-14 21:28 ` [PATCH 05/10] OMAP4: SPI: Fix Driver Kconfig Tony Lindgren
2010-05-14 21:28 ` [PATCH 06/10] OMAP4: Ethernet: KS8851 Board Support Tony Lindgren
2010-05-14 21:28 ` [PATCH 07/10] OMAP4: Networking: Defconfig Support Tony Lindgren
2010-05-14 21:28 ` [PATCH 08/10] omap4: Move SOC specific code from board file Tony Lindgren
2010-05-14 21:28 ` [PATCH 09/10] omap: GPIO: Fix OMAP4 GPIO reg access issues Tony Lindgren
2010-05-14 21:28 ` [PATCH 10/10] AM3517: rename the i2c boardinfo to make it more readable Tony Lindgren

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=20100514212747.25599.60817.stgit@baageli.muru.com \
    --to=tony@atomide.com \
    --cc=ext-mika.1.westerberg@nokia.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).