1 From b1ab71156cd49b2389397d3be54b93fe394a1cb2 Mon Sep 17 00:00:00 2001
2 From: Maarten ter Huurne <maarten@treewalker.org>
3 Date: Tue, 9 Oct 2012 13:09:57 +0200
4 Subject: [PATCH 13/16] MIPS: JZ4740: Acquire and enable DMA controller clock
6 Previously, it was assumed that the DMA controller clock is not gated
7 when the kernel starts running. While that is the power-on state, it is
8 safer to not rely on that.
10 Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
12 arch/mips/jz4740/clock.c | 2 +-
13 arch/mips/jz4740/dma.c | 24 ++++++++++++++++++++++--
14 2 files changed, 23 insertions(+), 3 deletions(-)
16 diff --git a/arch/mips/jz4740/clock.c b/arch/mips/jz4740/clock.c
17 index 1b5f554..b3eba60 100644
18 --- a/arch/mips/jz4740/clock.c
19 +++ b/arch/mips/jz4740/clock.c
20 @@ -921,4 +921,4 @@ static int jz4740_clock_init(void)
24 -arch_initcall(jz4740_clock_init);
25 +postcore_initcall(jz4740_clock_init);
26 diff --git a/arch/mips/jz4740/dma.c b/arch/mips/jz4740/dma.c
27 index 317ec6f..fb5266c 100644
28 --- a/arch/mips/jz4740/dma.c
29 +++ b/arch/mips/jz4740/dma.c
31 #include <linux/kernel.h>
32 #include <linux/module.h>
33 #include <linux/spinlock.h>
34 +#include <linux/clk.h>
35 #include <linux/interrupt.h>
37 #include <linux/dma-mapping.h>
38 @@ -268,6 +269,7 @@ static irqreturn_t jz4740_dma_irq(int irq, void *dev_id)
40 static int jz4740_dma_init(void)
45 jz4740_dma_base = ioremap(JZ4740_DMAC_BASE_ADDR, 0x400);
46 @@ -277,11 +279,29 @@ static int jz4740_dma_init(void)
48 spin_lock_init(&jz4740_dma_lock);
50 - ret = request_irq(JZ4740_IRQ_DMAC, jz4740_dma_irq, 0, "DMA", NULL);
51 + clk = clk_get(NULL, "dma");
54 + printk(KERN_ERR "JZ4740 DMA: Failed to request clock: %d\n",
60 + ret = request_irq(JZ4740_IRQ_DMAC, jz4740_dma_irq, 0, "DMA", NULL);
62 printk(KERN_ERR "JZ4740 DMA: Failed to request irq: %d\n", ret);
74 + iounmap(jz4740_dma_base);
77 arch_initcall(jz4740_dma_init);