aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-s3c24xx
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-01-28 07:01:35 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-01-28 08:20:52 -0500
commit06dbbd69f94e97751782ef6f1a9bb19da60efd1c (patch)
tree2c50a4707af379184ac9e6e6802b58223f77a38a /arch/arm/plat-s3c24xx
parent3a38e4be76e86c7b94c36dc8f3ce489987da24e4 (diff)
[ARM] 4795/1: S3C244X: Add armclk and setparent call
Add armclk to the supported clocks on the S3C2440 and S3C2442 to better represent the DVS state which controls whether FCLK or HCLK is fed to the ARM core. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-s3c24xx')
-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");