aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-integrator/impd1.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-integrator/impd1.c')
-rw-r--r--arch/arm/mach-integrator/impd1.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 0058c937719e..1a0ee93e4519 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -24,7 +24,7 @@
24 24
25#include <asm/clkdev.h> 25#include <asm/clkdev.h>
26#include <mach/clkdev.h> 26#include <mach/clkdev.h>
27#include <asm/hardware/icst525.h> 27#include <asm/hardware/icst.h>
28#include <mach/lm.h> 28#include <mach/lm.h>
29#include <mach/impd1.h> 29#include <mach/impd1.h>
30#include <asm/sizes.h> 30#include <asm/sizes.h>
@@ -40,32 +40,25 @@ struct impd1_module {
40 struct clk_lookup *clks[3]; 40 struct clk_lookup *clks[3];
41}; 41};
42 42
43static const struct icst525_params impd1_vco_params = { 43static const struct icst_params impd1_vco_params = {
44 .ref = 24000, /* 24 MHz */ 44 .ref = 24000000, /* 24 MHz */
45 .vco_max = 200000, /* 200 MHz */ 45 .vco_max = ICST525_VCO_MAX_3V,
46 .vco_min = ICST525_VCO_MIN,
46 .vd_min = 12, 47 .vd_min = 12,
47 .vd_max = 519, 48 .vd_max = 519,
48 .rd_min = 3, 49 .rd_min = 3,
49 .rd_max = 120, 50 .rd_max = 120,
51 .s2div = icst525_s2div,
52 .idx2s = icst525_idx2s,
50}; 53};
51 54
52static void impd1_setvco(struct clk *clk, struct icst525_vco vco) 55static void impd1_setvco(struct clk *clk, struct icst_vco vco)
53{ 56{
54 struct impd1_module *impd1 = clk->data; 57 struct impd1_module *impd1 = clk->data;
55 int vconr = clk - impd1->vcos; 58 u32 val = vco.v | (vco.r << 9) | (vco.s << 16);
56 u32 val;
57
58 val = vco.v | (vco.r << 9) | (vco.s << 16);
59 59
60 writel(0xa05f, impd1->base + IMPD1_LOCK); 60 writel(0xa05f, impd1->base + IMPD1_LOCK);
61 switch (vconr) { 61 writel(val, clk->vcoreg);
62 case 0:
63 writel(val, impd1->base + IMPD1_OSC1);
64 break;
65 case 1:
66 writel(val, impd1->base + IMPD1_OSC2);
67 break;
68 }
69 writel(0, impd1->base + IMPD1_LOCK); 62 writel(0, impd1->base + IMPD1_LOCK);
70 63
71#ifdef DEBUG 64#ifdef DEBUG
@@ -73,11 +66,17 @@ static void impd1_setvco(struct clk *clk, struct icst525_vco vco)
73 vco.r = (val >> 9) & 0x7f; 66 vco.r = (val >> 9) & 0x7f;
74 vco.s = (val >> 16) & 7; 67 vco.s = (val >> 16) & 7;
75 68
76 pr_debug("IM-PD1: VCO%d clock is %ld kHz\n", 69 pr_debug("IM-PD1: VCO%d clock is %ld Hz\n",
77 vconr, icst525_khz(&impd1_vco_params, vco)); 70 vconr, icst525_hz(&impd1_vco_params, vco));
78#endif 71#endif
79} 72}
80 73
74static const struct clk_ops impd1_clk_ops = {
75 .round = icst_clk_round,
76 .set = icst_clk_set,
77 .setvco = impd1_setvco,
78};
79
81void impd1_tweak_control(struct device *dev, u32 mask, u32 val) 80void impd1_tweak_control(struct device *dev, u32 mask, u32 val)
82{ 81{
83 struct impd1_module *impd1 = dev_get_drvdata(dev); 82 struct impd1_module *impd1 = dev_get_drvdata(dev);
@@ -373,11 +372,13 @@ static int impd1_probe(struct lm_device *dev)
373 (unsigned long)dev->resource.start); 372 (unsigned long)dev->resource.start);
374 373
375 for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) { 374 for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) {
375 impd1->vcos[i].ops = &impd1_clk_ops,
376 impd1->vcos[i].owner = THIS_MODULE, 376 impd1->vcos[i].owner = THIS_MODULE,
377 impd1->vcos[i].params = &impd1_vco_params, 377 impd1->vcos[i].params = &impd1_vco_params,
378 impd1->vcos[i].data = impd1, 378 impd1->vcos[i].data = impd1;
379 impd1->vcos[i].setvco = impd1_setvco;
380 } 379 }
380 impd1->vcos[0].vcoreg = impd1->base + IMPD1_OSC1;
381 impd1->vcos[1].vcoreg = impd1->base + IMPD1_OSC2;
381 382
382 impd1->clks[0] = clkdev_alloc(&impd1->vcos[0], NULL, "lm%x:01000", 383 impd1->clks[0] = clkdev_alloc(&impd1->vcos[0], NULL, "lm%x:01000",
383 dev->id); 384 dev->id);