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