From c8c81f32eef1d77134c81810b17f282bd619fb0b Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Thu, 30 May 2013 18:25:01 +0200 Subject: [PATCH] MIPS: jz4740: Acquire and enable DMA controller clock 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 Signed-off-by: Lars-Peter Clausen Acked-by: Ralf Baechle Signed-off-by: Vinod Koul --- 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 317ec6fffb12..0e34b97efa8c 100644 --- a/arch/mips/jz4740/dma.c +++ b/arch/mips/jz4740/dma.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -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); -- 2.39.5