aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common/icst307.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/icst307.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/icst307.c')
-rw-r--r--arch/arm/common/icst307.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/arch/arm/common/icst307.c b/arch/arm/common/icst307.c
index 312485fab4a6..8332c0726e73 100644
--- a/arch/arm/common/icst307.c
+++ b/arch/arm/common/icst307.c
@@ -22,11 +22,13 @@
22/* 22/*
23 * Divisors for each OD setting. 23 * Divisors for each OD setting.
24 */ 24 */
25static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 }; 25const unsigned char icst307_s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
26
27EXPORT_SYMBOL(icst307_s2div);
26 28
27unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco) 29unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco)
28{ 30{
29 return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]); 31 return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * p->s2div[vco.s]);
30} 32}
31 33
32EXPORT_SYMBOL(icst307_hz); 34EXPORT_SYMBOL(icst307_hz);
@@ -34,7 +36,9 @@ EXPORT_SYMBOL(icst307_hz);
34/* 36/*
35 * Ascending divisor S values. 37 * Ascending divisor S values.
36 */ 38 */
37static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 }; 39const unsigned char icst307_idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
40
41EXPORT_SYMBOL(icst307_idx2s);
38 42
39struct icst_vco 43struct icst_vco
40icst307_hz_to_vco(const struct icst_params *p, unsigned long freq) 44icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
@@ -48,19 +52,19 @@ icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
48 * that the PLL output is within spec. 52 * that the PLL output is within spec.
49 */ 53 */
50 do { 54 do {
51 f = freq * s2div[idx2s[i]]; 55 f = freq * p->s2div[p->idx2s[i]];
52 56
53 /* 57 /*
54 * f must be between 6MHz and 200MHz (3.3 or 5V) 58 * f must be between 6MHz and 200MHz (3.3 or 5V)
55 */ 59 */
56 if (f > p->vco_min && f <= p->vco_max) 60 if (f > p->vco_min && f <= p->vco_max)
57 break; 61 break;
58 } while (i < ARRAY_SIZE(idx2s)); 62 } while (i < 8);
59 63
60 if (i >= ARRAY_SIZE(idx2s)) 64 if (i >= 8)
61 return vco; 65 return vco;
62 66
63 vco.s = idx2s[i]; 67 vco.s = p->idx2s[i];
64 68
65 /* 69 /*
66 * Now find the closest divisor combination 70 * Now find the closest divisor combination