diff options
| author | Maarten ter Huurne <maarten@treewalker.org> | 2013-05-30 12:25:01 -0400 |
|---|---|---|
| committer | Vinod Koul <vinod.koul@intel.com> | 2013-07-05 02:10:49 -0400 |
| commit | c8c81f32eef1d77134c81810b17f282bd619fb0b (patch) | |
| tree | 30d1c22a1872b583b0185d8b87bb98d3dae0b1b4 | |
| parent | 8e3c518fba4f2ddd192171cbd7b23ec26900bf6b (diff) | |
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 <maarten@treewalker.org>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
| -rw-r--r-- | arch/mips/jz4740/dma.c | 24 |
1 files 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 @@ | |||
| 16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
| 19 | #include <linux/clk.h> | ||
| 19 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
| 20 | 21 | ||
| 21 | #include <linux/dma-mapping.h> | 22 | #include <linux/dma-mapping.h> |
| @@ -268,6 +269,7 @@ static irqreturn_t jz4740_dma_irq(int irq, void *dev_id) | |||
| 268 | 269 | ||
| 269 | static int jz4740_dma_init(void) | 270 | static int jz4740_dma_init(void) |
| 270 | { | 271 | { |
| 272 | struct clk *clk; | ||
| 271 | unsigned int ret; | 273 | unsigned int ret; |
| 272 | 274 | ||
| 273 | jz4740_dma_base = ioremap(JZ4740_DMAC_BASE_ADDR, 0x400); | 275 | jz4740_dma_base = ioremap(JZ4740_DMAC_BASE_ADDR, 0x400); |
| @@ -277,11 +279,29 @@ static int jz4740_dma_init(void) | |||
| 277 | 279 | ||
| 278 | spin_lock_init(&jz4740_dma_lock); | 280 | spin_lock_init(&jz4740_dma_lock); |
| 279 | 281 | ||
| 280 | ret = request_irq(JZ4740_IRQ_DMAC, jz4740_dma_irq, 0, "DMA", NULL); | 282 | clk = clk_get(NULL, "dma"); |
| 283 | if (IS_ERR(clk)) { | ||
| 284 | ret = PTR_ERR(clk); | ||
| 285 | printk(KERN_ERR "JZ4740 DMA: Failed to request clock: %d\n", | ||
| 286 | ret); | ||
| 287 | goto err_iounmap; | ||
| 288 | } | ||
| 281 | 289 | ||
| 282 | if (ret) | 290 | ret = request_irq(JZ4740_IRQ_DMAC, jz4740_dma_irq, 0, "DMA", NULL); |
| 291 | if (ret) { | ||
| 283 | printk(KERN_ERR "JZ4740 DMA: Failed to request irq: %d\n", ret); | 292 | printk(KERN_ERR "JZ4740 DMA: Failed to request irq: %d\n", ret); |
| 293 | goto err_clkput; | ||
| 294 | } | ||
| 295 | |||
| 296 | clk_prepare_enable(clk); | ||
| 297 | |||
| 298 | return 0; | ||
| 299 | |||
| 300 | err_clkput: | ||
| 301 | clk_put(clk); | ||
| 284 | 302 | ||
| 303 | err_iounmap: | ||
| 304 | iounmap(jz4740_dma_base); | ||
| 285 | return ret; | 305 | return ret; |
| 286 | } | 306 | } |
| 287 | arch_initcall(jz4740_dma_init); | 307 | arch_initcall(jz4740_dma_init); |
