aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-integrator
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-01-14 15:09:34 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-05-02 04:35:37 -0400
commitd1914c7e75cff736e2c2dac13ad2fe20c2567e68 (patch)
treea9913c63b86caf9122b6b1246e8045b9b436c98e /arch/arm/mach-integrator
parentf5fc00826d1e60af0e22cb9f65b933d823a8ed84 (diff)
ARM: Make Integrator/Versatile/Reaview VCO code similar
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-integrator')
-rw-r--r--arch/arm/mach-integrator/impd1.c16
-rw-r--r--arch/arm/mach-integrator/include/mach/clkdev.h3
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c9
3 files changed, 11 insertions, 17 deletions
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 3e2110216851..2f9de622d1fa 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -55,20 +55,10 @@ static const struct icst_params impd1_vco_params = {
55static void impd1_setvco(struct clk *clk, struct icst_vco vco) 55static void impd1_setvco(struct clk *clk, struct icst_vco vco)
56{ 56{
57 struct impd1_module *impd1 = clk->data; 57 struct impd1_module *impd1 = clk->data;
58 int vconr = clk - impd1->vcos; 58 u32 val = vco.v | (vco.r << 9) | (vco.s << 16);
59 u32 val;
60
61 val = vco.v | (vco.r << 9) | (vco.s << 16);
62 59
63 writel(0xa05f, impd1->base + IMPD1_LOCK); 60 writel(0xa05f, impd1->base + IMPD1_LOCK);
64 switch (vconr) { 61 writel(val, clk->vcoreg);
65 case 0:
66 writel(val, impd1->base + IMPD1_OSC1);
67 break;
68 case 1:
69 writel(val, impd1->base + IMPD1_OSC2);
70 break;
71 }
72 writel(0, impd1->base + IMPD1_LOCK); 62 writel(0, impd1->base + IMPD1_LOCK);
73 63
74#ifdef DEBUG 64#ifdef DEBUG
@@ -381,6 +371,8 @@ static int impd1_probe(struct lm_device *dev)
381 impd1->vcos[i].data = impd1, 371 impd1->vcos[i].data = impd1,
382 impd1->vcos[i].setvco = impd1_setvco; 372 impd1->vcos[i].setvco = impd1_setvco;
383 } 373 }
374 impd1->vcos[0].vcoreg = impd1->base + IMPD1_OSC1;
375 impd1->vcos[1].vcoreg = impd1->base + IMPD1_OSC2;
384 376
385 impd1->clks[0] = clkdev_alloc(&impd1->vcos[0], NULL, "lm%x:01000", 377 impd1->clks[0] = clkdev_alloc(&impd1->vcos[0], NULL, "lm%x:01000",
386 dev->id); 378 dev->id);
diff --git a/arch/arm/mach-integrator/include/mach/clkdev.h b/arch/arm/mach-integrator/include/mach/clkdev.h
index 89ea93803998..ed67e8edc0d1 100644
--- a/arch/arm/mach-integrator/include/mach/clkdev.h
+++ b/arch/arm/mach-integrator/include/mach/clkdev.h
@@ -8,8 +8,9 @@ struct clk {
8 unsigned long rate; 8 unsigned long rate;
9 struct module *owner; 9 struct module *owner;
10 const struct icst_params *params; 10 const struct icst_params *params;
11 void *data; 11 void __iomem *vcoreg;
12 void (*setvco)(struct clk *, struct icst_vco vco); 12 void (*setvco)(struct clk *, struct icst_vco vco);
13 void *data;
13}; 14};
14 15
15static inline int __clk_get(struct clk *clk) 16static inline int __clk_get(struct clk *clk)
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 5a5a8c1c087f..590858004ef6 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -266,8 +266,8 @@ static void __init intcp_init_irq(void)
266/* 266/*
267 * Clock handling 267 * Clock handling
268 */ 268 */
269#define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK) 269#define CM_LOCK (__io_address(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_LOCK_OFFSET)
270#define CM_AUXOSC IO_ADDRESS(INTEGRATOR_HDR_BASE + 0x1c) 270#define CM_AUXOSC (__io_address(INTEGRATOR_HDR_BASE)+0x1c)
271 271
272static const struct icst_params cp_auxvco_params = { 272static const struct icst_params cp_auxvco_params = {
273 .ref = 24000000, 273 .ref = 24000000,
@@ -285,16 +285,17 @@ static void cp_auxvco_set(struct clk *clk, struct icst_vco vco)
285{ 285{
286 u32 val; 286 u32 val;
287 287
288 val = readl(CM_AUXOSC) & ~0x7ffff; 288 val = readl(clk->vcoreg) & ~0x7ffff;
289 val |= vco.v | (vco.r << 9) | (vco.s << 16); 289 val |= vco.v | (vco.r << 9) | (vco.s << 16);
290 290
291 writel(0xa05f, CM_LOCK); 291 writel(0xa05f, CM_LOCK);
292 writel(val, CM_AUXOSC); 292 writel(val, clk->vcoreg);
293 writel(0, CM_LOCK); 293 writel(0, CM_LOCK);
294} 294}
295 295
296static struct clk cp_auxclk = { 296static struct clk cp_auxclk = {
297 .params = &cp_auxvco_params, 297 .params = &cp_auxvco_params,
298 .vcoreg = CM_AUXOSC,
298 .setvco = cp_auxvco_set, 299 .setvco = cp_auxvco_set,
299}; 300};
300 301