aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-01-16 12:28:44 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-05-02 04:35:31 -0400
commit64fceb1dcd1aa6a9f2e53cf8830b38bb007b375b (patch)
treeccf7b5a9fc9bbf65962b6bc7ba0d4adac0206c8e
parent4de2edbd15ff70c77e1d018611d06f7801fc2b72 (diff)
ARM: ICST: use Hz instead of kHz
This makes the ICST support fit more nicely with the clk API, eliminating the need to *1000 and /1000 in places. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/common/icst307.c8
-rw-r--r--arch/arm/common/icst525.c8
-rw-r--r--arch/arm/include/asm/hardware/icst307.h8
-rw-r--r--arch/arm/include/asm/hardware/icst525.h10
-rw-r--r--arch/arm/mach-integrator/clock.c8
-rw-r--r--arch/arm/mach-integrator/cpu.c22
-rw-r--r--arch/arm/mach-integrator/impd1.c6
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c2
-rw-r--r--arch/arm/mach-realview/clock.c8
-rw-r--r--arch/arm/mach-realview/core.c2
-rw-r--r--arch/arm/mach-versatile/clock.c8
-rw-r--r--arch/arm/mach-versatile/core.c2
12 files changed, 46 insertions, 46 deletions
diff --git a/arch/arm/common/icst307.c b/arch/arm/common/icst307.c
index f6063c95e25..66c69e597b7 100644
--- a/arch/arm/common/icst307.c
+++ b/arch/arm/common/icst307.c
@@ -24,12 +24,12 @@
24 */ 24 */
25static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 }; 25static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
26 26
27unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco) 27unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco)
28{ 28{
29 return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]); 29 return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
30} 30}
31 31
32EXPORT_SYMBOL(icst307_khz); 32EXPORT_SYMBOL(icst307_hz);
33 33
34/* 34/*
35 * Ascending divisor S values. 35 * Ascending divisor S values.
@@ -37,7 +37,7 @@ EXPORT_SYMBOL(icst307_khz);
37static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 }; 37static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
38 38
39struct icst_vco 39struct icst_vco
40icst307_khz_to_vco(const struct icst_params *p, unsigned long freq) 40icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
41{ 41{
42 struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max }; 42 struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
43 unsigned long f; 43 unsigned long f;
@@ -94,4 +94,4 @@ icst307_khz_to_vco(const struct icst_params *p, unsigned long freq)
94 return vco; 94 return vco;
95} 95}
96 96
97EXPORT_SYMBOL(icst307_khz_to_vco); 97EXPORT_SYMBOL(icst307_hz_to_vco);
diff --git a/arch/arm/common/icst525.c b/arch/arm/common/icst525.c
index 34dc2e1b9ef..c1d22b7c476 100644
--- a/arch/arm/common/icst525.c
+++ b/arch/arm/common/icst525.c
@@ -21,12 +21,12 @@
21 */ 21 */
22static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 }; 22static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
23 23
24unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco) 24unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco)
25{ 25{
26 return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]); 26 return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
27} 27}
28 28
29EXPORT_SYMBOL(icst525_khz); 29EXPORT_SYMBOL(icst525_hz);
30 30
31/* 31/*
32 * Ascending divisor S values. 32 * Ascending divisor S values.
@@ -34,7 +34,7 @@ EXPORT_SYMBOL(icst525_khz);
34static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 }; 34static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 };
35 35
36struct icst_vco 36struct icst_vco
37icst525_khz_to_vco(const struct icst_params *p, unsigned long freq) 37icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
38{ 38{
39 struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max }; 39 struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
40 unsigned long f; 40 unsigned long f;
@@ -92,4 +92,4 @@ icst525_khz_to_vco(const struct icst_params *p, unsigned long freq)
92 return vco; 92 return vco;
93} 93}
94 94
95EXPORT_SYMBOL(icst525_khz_to_vco); 95EXPORT_SYMBOL(icst525_hz_to_vco);
diff --git a/arch/arm/include/asm/hardware/icst307.h b/arch/arm/include/asm/hardware/icst307.h
index 0c4e37e3fde..0f096181e83 100644
--- a/arch/arm/include/asm/hardware/icst307.h
+++ b/arch/arm/include/asm/hardware/icst307.h
@@ -18,14 +18,14 @@
18 18
19#include <asm/hardware/icst.h> 19#include <asm/hardware/icst.h>
20 20
21unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco); 21unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco);
22struct icst_vco icst307_khz_to_vco(const struct icst_params *p, unsigned long freq); 22struct icst_vco icst307_hz_to_vco(const struct icst_params *p, unsigned long freq);
23 23
24/* 24/*
25 * ICST307 VCO frequency must be between 6MHz and 200MHz (3.3 or 5V). 25 * ICST307 VCO frequency must be between 6MHz and 200MHz (3.3 or 5V).
26 * This frequency is pre-output divider. 26 * This frequency is pre-output divider.
27 */ 27 */
28#define ICST307_VCO_MIN 6000 28#define ICST307_VCO_MIN 6000000
29#define ICST307_VCO_MAX 200000 29#define ICST307_VCO_MAX 200000000
30 30
31#endif 31#endif
diff --git a/arch/arm/include/asm/hardware/icst525.h b/arch/arm/include/asm/hardware/icst525.h
index 3b72c132e24..1000a6096fc 100644
--- a/arch/arm/include/asm/hardware/icst525.h
+++ b/arch/arm/include/asm/hardware/icst525.h
@@ -16,15 +16,15 @@
16 16
17#include <asm/hardware/icst.h> 17#include <asm/hardware/icst.h>
18 18
19unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco); 19unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco);
20struct icst_vco icst525_khz_to_vco(const struct icst_params *p, unsigned long freq); 20struct icst_vco icst525_hz_to_vco(const struct icst_params *p, unsigned long freq);
21 21
22/* 22/*
23 * ICST525 VCO frequency must be between 10MHz and 200MHz (3V) or 320MHz (5V). 23 * ICST525 VCO frequency must be between 10MHz and 200MHz (3V) or 320MHz (5V).
24 * This frequency is pre-output divider. 24 * This frequency is pre-output divider.
25 */ 25 */
26#define ICST525_VCO_MIN 10000 26#define ICST525_VCO_MIN 10000000
27#define ICST525_VCO_MAX_3V 200000 27#define ICST525_VCO_MAX_3V 200000000
28#define ICST525_VCO_MAX_5V 320000 28#define ICST525_VCO_MAX_5V 320000000
29 29
30#endif 30#endif
diff --git a/arch/arm/mach-integrator/clock.c b/arch/arm/mach-integrator/clock.c
index bb70b64a656..a4f80d33429 100644
--- a/arch/arm/mach-integrator/clock.c
+++ b/arch/arm/mach-integrator/clock.c
@@ -38,8 +38,8 @@ EXPORT_SYMBOL(clk_get_rate);
38long clk_round_rate(struct clk *clk, unsigned long rate) 38long clk_round_rate(struct clk *clk, unsigned long rate)
39{ 39{
40 struct icst_vco vco; 40 struct icst_vco vco;
41 vco = icst525_khz_to_vco(clk->params, rate / 1000); 41 vco = icst525_hz_to_vco(clk->params, rate);
42 return icst525_khz(clk->params, vco) * 1000; 42 return icst525_hz(clk->params, vco);
43} 43}
44EXPORT_SYMBOL(clk_round_rate); 44EXPORT_SYMBOL(clk_round_rate);
45 45
@@ -50,8 +50,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
50 if (clk->setvco) { 50 if (clk->setvco) {
51 struct icst_vco vco; 51 struct icst_vco vco;
52 52
53 vco = icst525_khz_to_vco(clk->params, rate / 1000); 53 vco = icst525_hz_to_vco(clk->params, rate);
54 clk->rate = icst525_khz(clk->params, vco) * 1000; 54 clk->rate = icst525_hz(clk->params, vco);
55 clk->setvco(clk, vco); 55 clk->setvco(clk, vco);
56 ret = 0; 56 ret = 0;
57 } 57 }
diff --git a/arch/arm/mach-integrator/cpu.c b/arch/arm/mach-integrator/cpu.c
index 1671b4a363b..3ebb785f30c 100644
--- a/arch/arm/mach-integrator/cpu.c
+++ b/arch/arm/mach-integrator/cpu.c
@@ -32,7 +32,7 @@ static struct cpufreq_driver integrator_driver;
32#define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK) 32#define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK)
33 33
34static const struct icst_params lclk_params = { 34static const struct icst_params lclk_params = {
35 .ref = 24000, 35 .ref = 24000000,
36 .vco_max = ICST525_VCO_MAX_5V, 36 .vco_max = ICST525_VCO_MAX_5V,
37 .vd_min = 8, 37 .vd_min = 8,
38 .vd_max = 132, 38 .vd_max = 132,
@@ -41,7 +41,7 @@ static const struct icst_params lclk_params = {
41}; 41};
42 42
43static const struct icst_params cclk_params = { 43static const struct icst_params cclk_params = {
44 .ref = 24000, 44 .ref = 24000000,
45 .vco_max = ICST525_VCO_MAX_5V, 45 .vco_max = ICST525_VCO_MAX_5V,
46 .vd_min = 12, 46 .vd_min = 12,
47 .vd_max = 160, 47 .vd_max = 160,
@@ -60,11 +60,11 @@ static int integrator_verify_policy(struct cpufreq_policy *policy)
60 policy->cpuinfo.min_freq, 60 policy->cpuinfo.min_freq,
61 policy->cpuinfo.max_freq); 61 policy->cpuinfo.max_freq);
62 62
63 vco = icst525_khz_to_vco(&cclk_params, policy->max); 63 vco = icst525_hz_to_vco(&cclk_params, policy->max * 1000);
64 policy->max = icst525_khz(&cclk_params, vco); 64 policy->max = icst525_hz(&cclk_params, vco) / 1000;
65 65
66 vco = icst525_khz_to_vco(&cclk_params, policy->min); 66 vco = icst525_hz_to_vco(&cclk_params, policy->min * 1000);
67 policy->min = icst525_khz(&cclk_params, vco); 67 policy->min = icst525_hz(&cclk_params, vco) / 1000;
68 68
69 cpufreq_verify_within_limits(policy, 69 cpufreq_verify_within_limits(policy,
70 policy->cpuinfo.min_freq, 70 policy->cpuinfo.min_freq,
@@ -106,17 +106,17 @@ static int integrator_set_target(struct cpufreq_policy *policy,
106 } 106 }
107 vco.v = cm_osc & 255; 107 vco.v = cm_osc & 255;
108 vco.r = 22; 108 vco.r = 22;
109 freqs.old = icst525_khz(&cclk_params, vco); 109 freqs.old = icst525_hz(&cclk_params, vco) / 1000;
110 110
111 /* icst525_khz_to_vco rounds down -- so we need the next 111 /* icst525_hz_to_vco rounds down -- so we need the next
112 * larger freq in case of CPUFREQ_RELATION_L. 112 * larger freq in case of CPUFREQ_RELATION_L.
113 */ 113 */
114 if (relation == CPUFREQ_RELATION_L) 114 if (relation == CPUFREQ_RELATION_L)
115 target_freq += 999; 115 target_freq += 999;
116 if (target_freq > policy->max) 116 if (target_freq > policy->max)
117 target_freq = policy->max; 117 target_freq = policy->max;
118 vco = icst525_khz_to_vco(&cclk_params, target_freq); 118 vco = icst525_hz_to_vco(&cclk_params, target_freq * 1000);
119 freqs.new = icst525_khz(&cclk_params, vco); 119 freqs.new = icst525_hz(&cclk_params, vco) / 1000;
120 120
121 freqs.cpu = policy->cpu; 121 freqs.cpu = policy->cpu;
122 122
@@ -174,7 +174,7 @@ static unsigned int integrator_get(unsigned int cpu)
174 vco.v = cm_osc & 255; 174 vco.v = cm_osc & 255;
175 vco.r = 22; 175 vco.r = 22;
176 176
177 current_freq = icst525_khz(&cclk_params, vco); /* current freq */ 177 current_freq = icst525_hz(&cclk_params, vco) / 1000; /* current freq */
178 178
179 set_cpus_allowed(current, cpus_allowed); 179 set_cpus_allowed(current, cpus_allowed);
180 180
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 5aca7ebea3c..ecce3eb8fe0 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -41,7 +41,7 @@ struct impd1_module {
41}; 41};
42 42
43static const struct icst_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 = ICST525_VCO_MAX_3V, 45 .vco_max = ICST525_VCO_MAX_3V,
46 .vd_min = 12, 46 .vd_min = 12,
47 .vd_max = 519, 47 .vd_max = 519,
@@ -73,8 +73,8 @@ static void impd1_setvco(struct clk *clk, struct icst_vco vco)
73 vco.r = (val >> 9) & 0x7f; 73 vco.r = (val >> 9) & 0x7f;
74 vco.s = (val >> 16) & 7; 74 vco.s = (val >> 16) & 7;
75 75
76 pr_debug("IM-PD1: VCO%d clock is %ld kHz\n", 76 pr_debug("IM-PD1: VCO%d clock is %ld Hz\n",
77 vconr, icst525_khz(&impd1_vco_params, vco)); 77 vconr, icst525_hz(&impd1_vco_params, vco));
78#endif 78#endif
79} 79}
80 80
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 27f95106b47..335af99acb7 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -269,7 +269,7 @@ static void __init intcp_init_irq(void)
269#define CM_AUXOSC IO_ADDRESS(INTEGRATOR_HDR_BASE + 0x1c) 269#define CM_AUXOSC IO_ADDRESS(INTEGRATOR_HDR_BASE + 0x1c)
270 270
271static const struct icst_params cp_auxvco_params = { 271static const struct icst_params cp_auxvco_params = {
272 .ref = 24000, 272 .ref = 24000000,
273 .vco_max = ICST525_VCO_MAX_5V, 273 .vco_max = ICST525_VCO_MAX_5V,
274 .vd_min = 8, 274 .vd_min = 8,
275 .vd_max = 263, 275 .vd_max = 263,
diff --git a/arch/arm/mach-realview/clock.c b/arch/arm/mach-realview/clock.c
index 83646579bc4..2ba0667d18f 100644
--- a/arch/arm/mach-realview/clock.c
+++ b/arch/arm/mach-realview/clock.c
@@ -42,8 +42,8 @@ EXPORT_SYMBOL(clk_get_rate);
42long clk_round_rate(struct clk *clk, unsigned long rate) 42long clk_round_rate(struct clk *clk, unsigned long rate)
43{ 43{
44 struct icst_vco vco; 44 struct icst_vco vco;
45 vco = icst307_khz_to_vco(clk->params, rate / 1000); 45 vco = icst307_hz_to_vco(clk->params, rate);
46 return icst307_khz(clk->params, vco) * 1000; 46 return icst307_hz(clk->params, vco);
47} 47}
48EXPORT_SYMBOL(clk_round_rate); 48EXPORT_SYMBOL(clk_round_rate);
49 49
@@ -54,8 +54,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
54 if (clk->setvco) { 54 if (clk->setvco) {
55 struct icst_vco vco; 55 struct icst_vco vco;
56 56
57 vco = icst307_khz_to_vco(clk->params, rate / 1000); 57 vco = icst307_hz_to_vco(clk->params, rate);
58 clk->rate = icst307_khz(clk->params, vco) * 1000; 58 clk->rate = icst307_hz(clk->params, vco);
59 clk->setvco(clk, vco); 59 clk->setvco(clk, vco);
60 ret = 0; 60 ret = 0;
61 } 61 }
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 5a850f0dc36..02d48371c09 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -274,7 +274,7 @@ struct mmci_platform_data realview_mmc1_plat_data = {
274 * Clock handling 274 * Clock handling
275 */ 275 */
276static const struct icst_params realview_oscvco_params = { 276static const struct icst_params realview_oscvco_params = {
277 .ref = 24000, 277 .ref = 24000000,
278 .vco_max = ICST307_VCO_MAX, 278 .vco_max = ICST307_VCO_MAX,
279 .vd_min = 4 + 8, 279 .vd_min = 4 + 8,
280 .vd_max = 511 + 8, 280 .vd_max = 511 + 8,
diff --git a/arch/arm/mach-versatile/clock.c b/arch/arm/mach-versatile/clock.c
index 530e16aa7ad..82753be453d 100644
--- a/arch/arm/mach-versatile/clock.c
+++ b/arch/arm/mach-versatile/clock.c
@@ -43,8 +43,8 @@ EXPORT_SYMBOL(clk_get_rate);
43long clk_round_rate(struct clk *clk, unsigned long rate) 43long clk_round_rate(struct clk *clk, unsigned long rate)
44{ 44{
45 struct icst_vco vco; 45 struct icst_vco vco;
46 vco = icst307_khz_to_vco(clk->params, rate / 1000); 46 vco = icst307_hz_to_vco(clk->params, rate);
47 return icst307_khz(clk->params, vco) * 1000; 47 return icst307_hz(clk->params, vco);
48} 48}
49EXPORT_SYMBOL(clk_round_rate); 49EXPORT_SYMBOL(clk_round_rate);
50 50
@@ -55,8 +55,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
55 if (clk->setvco) { 55 if (clk->setvco) {
56 struct icst_vco vco; 56 struct icst_vco vco;
57 57
58 vco = icst307_khz_to_vco(clk->params, rate / 1000); 58 vco = icst307_hz_to_vco(clk->params, rate);
59 clk->rate = icst307_khz(clk->params, vco) * 1000; 59 clk->rate = icst307_hz(clk->params, vco);
60 clk->setvco(clk, vco); 60 clk->setvco(clk, vco);
61 ret = 0; 61 ret = 0;
62 } 62 }
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index f8ed561ec69..ff5d24f80b2 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -380,7 +380,7 @@ static struct mmci_platform_data mmc0_plat_data = {
380 * Clock handling 380 * Clock handling
381 */ 381 */
382static const struct icst_params versatile_oscvco_params = { 382static const struct icst_params versatile_oscvco_params = {
383 .ref = 24000, 383 .ref = 24000000,
384 .vco_max = ICST307_VCO_MAX, 384 .vco_max = ICST307_VCO_MAX,
385 .vd_min = 4 + 8, 385 .vd_min = 4 + 8,
386 .vd_max = 511 + 8, 386 .vd_max = 511 + 8,