aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common/icst525.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-01-16 14:46:19 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-05-02 04:35:32 -0400
commit232eaf7f268f765b52170bec42bfa0c5825aa239 (patch)
tree972eb80dcb7d3b0d8ee10f83f307f1bc47b784a9 /arch/arm/common/icst525.c
parente73a46a3d3df22b379d8adcb59999eafea1d60d5 (diff)
ARM: ICST: indirect s2div and idx2s arrays via icst_params
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/common/icst525.c')
-rw-r--r--arch/arm/common/icst525.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/arch/arm/common/icst525.c b/arch/arm/common/icst525.c
index da58965da311..4180255eb078 100644
--- a/arch/arm/common/icst525.c
+++ b/arch/arm/common/icst525.c
@@ -19,11 +19,13 @@
19/* 19/*
20 * Divisors for each OD setting. 20 * Divisors for each OD setting.
21 */ 21 */
22static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 }; 22const unsigned char icst525_s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
23
24EXPORT_SYMBOL(icst525_s2div);
23 25
24unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco) 26unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco)
25{ 27{
26 return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]); 28 return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * p->s2div[vco.s]);
27} 29}
28 30
29EXPORT_SYMBOL(icst525_hz); 31EXPORT_SYMBOL(icst525_hz);
@@ -31,7 +33,9 @@ EXPORT_SYMBOL(icst525_hz);
31/* 33/*
32 * Ascending divisor S values. 34 * Ascending divisor S values.
33 */ 35 */
34static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 }; 36const unsigned char icst525_idx2s[8] = { 1, 3, 4, 7, 5, 2, 6, 0 };
37
38EXPORT_SYMBOL(icst525_idx2s);
35 39
36struct icst_vco 40struct icst_vco
37icst525_hz_to_vco(const struct icst_params *p, unsigned long freq) 41icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
@@ -45,7 +49,7 @@ icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
45 * that the PLL output is within spec. 49 * that the PLL output is within spec.
46 */ 50 */
47 do { 51 do {
48 f = freq * s2div[idx2s[i]]; 52 f = freq * p->s2div[p->idx2s[i]];
49 53
50 /* 54 /*
51 * f must be between 10MHz and 55 * f must be between 10MHz and
@@ -53,12 +57,12 @@ icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
53 */ 57 */
54 if (f > p->vco_min && f <= p->vco_max) 58 if (f > p->vco_min && f <= p->vco_max)
55 break; 59 break;
56 } while (i < ARRAY_SIZE(idx2s)); 60 } while (i < 8);
57 61
58 if (i >= ARRAY_SIZE(idx2s)) 62 if (i >= 8)
59 return vco; 63 return vco;
60 64
61 vco.s = idx2s[i]; 65 vco.s = p->idx2s[i];
62 66
63 /* 67 /*
64 * Now find the closest divisor combination 68 * Now find the closest divisor combination