aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x-clock.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/arm/plat-s3c24xx/s3c244x-clock.c b/arch/arm/plat-s3c24xx/s3c244x-clock.c
index 0bf5e7fbb2bf..faf3e0f9f4e2 100644
--- a/arch/arm/plat-s3c24xx/s3c244x-clock.c
+++ b/arch/arm/plat-s3c24xx/s3c244x-clock.c
@@ -44,15 +44,52 @@
44#include <asm/plat-s3c24xx/clock.h> 44#include <asm/plat-s3c24xx/clock.h>
45#include <asm/plat-s3c24xx/cpu.h> 45#include <asm/plat-s3c24xx/cpu.h>
46 46
47static int s3c2440_setparent_armclk(struct clk *clk, struct clk *parent)
48{
49 unsigned long camdivn;
50 unsigned long dvs;
51
52 if (parent == &clk_f)
53 dvs = 0;
54 else if (parent == &clk_h)
55 dvs = S3C2440_CAMDIVN_DVSEN;
56 else
57 return -EINVAL;
58
59 clk->parent = parent;
60
61 camdivn = __raw_readl(S3C2440_CAMDIVN);
62 camdivn &= ~S3C2440_CAMDIVN_DVSEN;
63 camdivn |= dvs;
64 __raw_writel(camdivn, S3C2440_CAMDIVN);
65
66 return 0;
67}
68
69static struct clk clk_arm = {
70 .name = "armclk",
71 .id = -1,
72 .set_parent = s3c2440_setparent_armclk,
73};
74
47static int s3c244x_clk_add(struct sys_device *sysdev) 75static int s3c244x_clk_add(struct sys_device *sysdev)
48{ 76{
49 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); 77 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
50 unsigned long clkdivn; 78 unsigned long clkdivn;
51 struct clk *clock_upll; 79 struct clk *clock_upll;
80 int ret;
52 81
53 printk("S3C244X: Clock Support, DVS %s\n", 82 printk("S3C244X: Clock Support, DVS %s\n",
54 (camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off"); 83 (camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off");
55 84
85 clk_arm.parent = (camdivn & S3C2440_CAMDIVN_DVSEN) ? &clk_h : &clk_f;
86
87 ret = s3c24xx_register_clock(&clk_arm);
88 if (ret < 0) {
89 printk(KERN_ERR "S3C24XX: Failed to add armclk (%d)\n", ret);
90 return ret;
91 }
92
56 clock_upll = clk_get(NULL, "upll"); 93 clock_upll = clk_get(NULL, "upll");
57 if (IS_ERR(clock_upll)) { 94 if (IS_ERR(clock_upll)) {
58 printk(KERN_ERR "S3C244X: Failed to get upll clock\n"); 95 printk(KERN_ERR "S3C244X: Failed to get upll clock\n");