From: Lars-Peter Clausen <lars@metafoo.de>
To: Ralf Baechle <ralf@linux-mips.org>,
Vinod Koul <vinod.koul@intel.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>
Cc: Maarten ter Huurne <maarten@treewalker.org>,
linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
alsa-devel@alsa-project.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 2/6] MIPS: jz4740: Acquire and enable DMA controller clock
Date: Thu, 23 May 2013 22:36:23 +0200 [thread overview]
Message-ID: <1369341387-19147-3-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1369341387-19147-1-git-send-email-lars@metafoo.de>
From: Maarten ter Huurne <maarten@treewalker.org>
Previously, it was assumed that the DMA controller clock is not gated
when the kernel starts running. While that is the power-on state, it is
safer to not rely on that.
Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
arch/mips/jz4740/dma.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/arch/mips/jz4740/dma.c b/arch/mips/jz4740/dma.c
index 317ec6f..0e34b97 100644
--- a/arch/mips/jz4740/dma.c
+++ b/arch/mips/jz4740/dma.c
@@ -16,6 +16,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/spinlock.h>
+#include <linux/clk.h>
#include <linux/interrupt.h>
#include <linux/dma-mapping.h>
@@ -268,6 +269,7 @@ static irqreturn_t jz4740_dma_irq(int irq, void *dev_id)
static int jz4740_dma_init(void)
{
+ struct clk *clk;
unsigned int ret;
jz4740_dma_base = ioremap(JZ4740_DMAC_BASE_ADDR, 0x400);
@@ -277,11 +279,29 @@ static int jz4740_dma_init(void)
spin_lock_init(&jz4740_dma_lock);
- ret = request_irq(JZ4740_IRQ_DMAC, jz4740_dma_irq, 0, "DMA", NULL);
+ clk = clk_get(NULL, "dma");
+ if (IS_ERR(clk)) {
+ ret = PTR_ERR(clk);
+ printk(KERN_ERR "JZ4740 DMA: Failed to request clock: %d\n",
+ ret);
+ goto err_iounmap;
+ }
- if (ret)
+ ret = request_irq(JZ4740_IRQ_DMAC, jz4740_dma_irq, 0, "DMA", NULL);
+ if (ret) {
printk(KERN_ERR "JZ4740 DMA: Failed to request irq: %d\n", ret);
+ goto err_clkput;
+ }
+
+ clk_prepare_enable(clk);
+
+ return 0;
+
+err_clkput:
+ clk_put(clk);
+err_iounmap:
+ iounmap(jz4740_dma_base);
return ret;
}
arch_initcall(jz4740_dma_init);
--
1.8.2.1
next prev parent reply other threads:[~2013-05-23 20:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-23 20:36 [PATCH 0/6] Convert JZ4740 to dmaengine Lars-Peter Clausen
2013-05-23 20:36 ` [PATCH 1/6] MIPS: jz4740: Correct clock gate bit for DMA controller Lars-Peter Clausen
2013-05-23 20:36 ` Lars-Peter Clausen [this message]
2013-05-23 20:36 ` [PATCH 3/6] dma: Add a jz4740 dmaengine driver Lars-Peter Clausen
2013-05-24 4:59 ` Vinod Koul
2013-05-24 5:58 ` Lars-Peter Clausen
2013-05-24 5:54 ` Vinod Koul
2013-05-24 6:41 ` Lars-Peter Clausen
2013-05-24 7:54 ` Vinod Koul
2013-05-24 8:39 ` [alsa-devel] " Lars-Peter Clausen
2013-05-23 20:36 ` [PATCH 4/6] MIPS: jz4740: Register jz4740 DMA device Lars-Peter Clausen
2013-05-23 20:36 ` [PATCH 5/6] ASoC: jz4740: Use the generic dmaengine PCM driver Lars-Peter Clausen
2013-05-25 15:16 ` Mark Brown
2013-05-23 20:36 ` [PATCH 6/6] MIPS: jz4740: Remove custom DMA API Lars-Peter Clausen
2013-05-29 9:31 ` [PATCH 0/6] Convert JZ4740 to dmaengine Ralf Baechle
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=1369341387-19147-3-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=maarten@treewalker.org \
--cc=ralf@linux-mips.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
all inboxes | Powered by JetHome®