aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorBen Dooks <ben@simtec.co.uk>2009-02-25 00:41:22 +0000
committerAndy Green <agreen@octopus.localdomain>2009-02-25 00:41:22 +0000
commit1a2a8e066213a147657eb490a1b0da9d031ee688 (patch)
tree7035a48570a1e5cacb61285d1f0fb34a55d7c3c8 /arch
parent5202146f521b560cbf3065762d3b894771e6f863 (diff)
S3C64XX: Add DMA clock enable
Ensure the DMA channels have the controller clock enabled before they are used. Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/plat-s3c64xx/dma.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/arch/arm/plat-s3c64xx/dma.c b/arch/arm/plat-s3c64xx/dma.c
index 644501bfb99..d1aab7da408 100644
--- a/arch/arm/plat-s3c64xx/dma.c
+++ b/arch/arm/plat-s3c64xx/dma.c
@@ -19,6 +19,8 @@
#include <linux/sysdev.h>
#include <linux/errno.h>
#include <linux/delay.h>
+#include <linux/clk.h>
+#include <linux/err.h>
#include <linux/io.h>
#include <mach/dma.h>
@@ -40,9 +42,10 @@
struct s3c64xx_dmac {
struct sys_device sysdev;
+ struct clk *clk;
void __iomem *regs;
struct s3c2410_dma_chan *channels;
- enum dma_ch chanbase;
+ enum dma_ch chanbase;
};
/* pool to provide LLI buffers */
@@ -614,6 +617,7 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
{
struct s3c2410_dma_chan *chptr = &s3c2410_chans[chno];
struct s3c64xx_dmac *dmac;
+ char clkname[16];
void __iomem *regs;
void __iomem *regptr;
int err, ch;
@@ -640,6 +644,17 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
goto err_dev;
}
+ snprintf(clkname, sizeof(clkname), "dma%d", dmac->sysdev.id);
+
+ dmac->clk = clk_get(NULL, clkname);
+ if (IS_ERR(dmac->clk)) {
+ printk(KERN_ERR "%s: failed to get clock %s\n", __func__, clkname);
+ err = PTR_ERR(dmac->clk);
+ goto err_map;
+ }
+
+ clk_enable(dmac->clk);
+
dmac->regs = regs;
dmac->chanbase = chbase;
dmac->channels = chptr;
@@ -647,7 +662,7 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
err = request_irq(irq, s3c64xx_dma_irq, 0, "DMA", dmac);
if (err < 0) {
printk(KERN_ERR "%s: failed to get irq\n", __func__);
- goto err_map;
+ goto err_clk;
}
regptr = regs + PL080_Cx_BASE(0);
@@ -670,6 +685,9 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
return 0;
+err_clk:
+ clk_disable(dmac->clk);
+ clk_put(dmac->clk);
err_map:
iounmap(regs);
err_dev: