aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--arch/arm/mach-realview/core.c16
-rw-r--r--arch/arm/mach-realview/include/mach/clkdev.h2
-rw-r--r--arch/arm/mach-versatile/core.c10
-rw-r--r--arch/arm/mach-versatile/include/mach/clkdev.h2
7 files changed, 26 insertions, 32 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
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index f97f001e874b..043b93bab7df 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -271,19 +271,13 @@ static const struct icst_params realview_oscvco_params = {
271static void realview_oscvco_set(struct clk *clk, struct icst_vco vco) 271static void realview_oscvco_set(struct clk *clk, struct icst_vco vco)
272{ 272{
273 void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET; 273 void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET;
274 void __iomem *sys_osc;
275 u32 val; 274 u32 val;
276 275
277 if (machine_is_realview_pb1176()) 276 val = readl(clk->vcoreg) & ~0x7ffff;
278 sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC0_OFFSET;
279 else
280 sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC4_OFFSET;
281
282 val = readl(sys_osc) & ~0x7ffff;
283 val |= vco.v | (vco.r << 9) | (vco.s << 16); 277 val |= vco.v | (vco.r << 9) | (vco.s << 16);
284 278
285 writel(0xa05f, sys_lock); 279 writel(0xa05f, sys_lock);
286 writel(val, sys_osc); 280 writel(val, clk->vcoreg);
287 writel(0, sys_lock); 281 writel(0, sys_lock);
288} 282}
289 283
@@ -332,7 +326,13 @@ static struct clk_lookup lookups[] = {
332 326
333static int __init clk_init(void) 327static int __init clk_init(void)
334{ 328{
329 if (machine_is_realview_pb1176())
330 oscvco_clk.vcoreg = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC0_OFFSET;
331 else
332 oscvco_clk.vcoreg = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC4_OFFSET;
333
335 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 334 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
335
336 return 0; 336 return 0;
337} 337}
338arch_initcall(clk_init); 338arch_initcall(clk_init);
diff --git a/arch/arm/mach-realview/include/mach/clkdev.h b/arch/arm/mach-realview/include/mach/clkdev.h
index fefe4671255c..baea03c9ad45 100644
--- a/arch/arm/mach-realview/include/mach/clkdev.h
+++ b/arch/arm/mach-realview/include/mach/clkdev.h
@@ -6,7 +6,7 @@
6struct clk { 6struct clk {
7 unsigned long rate; 7 unsigned long rate;
8 const struct icst_params *params; 8 const struct icst_params *params;
9 u32 oscoff; 9 void __iomem *vcoreg;
10 void (*setvco)(struct clk *, struct icst_vco vco); 10 void (*setvco)(struct clk *, struct icst_vco vco);
11}; 11};
12 12
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 490fc7597bb6..957bbde83d34 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -370,21 +370,19 @@ static const struct icst_params versatile_oscvco_params = {
370 370
371static void versatile_oscvco_set(struct clk *clk, struct icst_vco vco) 371static void versatile_oscvco_set(struct clk *clk, struct icst_vco vco)
372{ 372{
373 void __iomem *sys = __io_address(VERSATILE_SYS_BASE); 373 void __iomem *sys_lock = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LOCK_OFFSET;
374 void __iomem *sys_lock = sys + VERSATILE_SYS_LOCK_OFFSET;
375 u32 val; 374 u32 val;
376 375
377 val = readl(sys + clk->oscoff) & ~0x7ffff; 376 val = readl(clk->vcoreg) & ~0x7ffff;
378 val |= vco.v | (vco.r << 9) | (vco.s << 16); 377 val |= vco.v | (vco.r << 9) | (vco.s << 16);
379 378
380 writel(0xa05f, sys_lock); 379 writel(0xa05f, sys_lock);
381 writel(val, sys + clk->oscoff); 380 writel(val, clk->vcoreg);
382 writel(0, sys_lock); 381 writel(0, sys_lock);
383} 382}
384 383
385static struct clk osc4_clk = { 384static struct clk osc4_clk = {
386 .params = &versatile_oscvco_params, 385 .params = &versatile_oscvco_params,
387 .oscoff = VERSATILE_SYS_OSCCLCD_OFFSET,
388 .setvco = versatile_oscvco_set, 386 .setvco = versatile_oscvco_set,
389}; 387};
390 388
@@ -831,6 +829,8 @@ void __init versatile_init(void)
831{ 829{
832 int i; 830 int i;
833 831
832 osc4_clk.vcoreg = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSCCLCD_OFFSET;
833
834 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 834 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
835 835
836 platform_device_register(&versatile_flash_device); 836 platform_device_register(&versatile_flash_device);
diff --git a/arch/arm/mach-versatile/include/mach/clkdev.h b/arch/arm/mach-versatile/include/mach/clkdev.h
index fefe4671255c..baea03c9ad45 100644
--- a/arch/arm/mach-versatile/include/mach/clkdev.h
+++ b/arch/arm/mach-versatile/include/mach/clkdev.h
@@ -6,7 +6,7 @@
6struct clk { 6struct clk {
7 unsigned long rate; 7 unsigned long rate;
8 const struct icst_params *params; 8 const struct icst_params *params;
9 u32 oscoff; 9 void __iomem *vcoreg;
10 void (*setvco)(struct clk *, struct icst_vco vco); 10 void (*setvco)(struct clk *, struct icst_vco vco);
11}; 11};
12 12