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 --- a/arch/mips/jz4740/clock.c
17 +++ b/arch/mips/jz4740/clock.c
18 @@ -921,4 +921,4 @@ static int jz4740_clock_init(void)
22 -arch_initcall(jz4740_clock_init);
23 +postcore_initcall(jz4740_clock_init);
24 --- a/arch/mips/jz4740/dma.c
25 +++ b/arch/mips/jz4740/dma.c
27 #include <linux/kernel.h>
28 #include <linux/module.h>
29 #include <linux/spinlock.h>
30 +#include <linux/clk.h>
31 #include <linux/interrupt.h>
33 #include <linux/dma-mapping.h>
34 @@ -268,6 +269,7 @@ static irqreturn_t jz4740_dma_irq(int ir
36 static int jz4740_dma_init(void)
41 jz4740_dma_base = ioremap(JZ4740_DMAC_BASE_ADDR, 0x400);
42 @@ -277,11 +279,29 @@ static int jz4740_dma_init(void)
44 spin_lock_init(&jz4740_dma_lock);
46 - ret = request_irq(JZ4740_IRQ_DMAC, jz4740_dma_irq, 0, "DMA", NULL);
47 + clk = clk_get(NULL, "dma");
50 + printk(KERN_ERR "JZ4740 DMA: Failed to request clock: %d\n",
56 + ret = request_irq(JZ4740_IRQ_DMAC, jz4740_dma_irq, 0, "DMA", NULL);
58 printk(KERN_ERR "JZ4740 DMA: Failed to request irq: %d\n", ret);
70 + iounmap(jz4740_dma_base);
73 arch_initcall(jz4740_dma_init);