diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-01-16 14:46:19 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-05-02 04:35:32 -0400 |
commit | 232eaf7f268f765b52170bec42bfa0c5825aa239 (patch) | |
tree | 972eb80dcb7d3b0d8ee10f83f307f1bc47b784a9 /arch/arm/common | |
parent | e73a46a3d3df22b379d8adcb59999eafea1d60d5 (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')
-rw-r--r-- | arch/arm/common/icst307.c | 18 | ||||
-rw-r--r-- | arch/arm/common/icst525.c | 18 |
2 files changed, 22 insertions, 14 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 | */ |
25 | static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 }; | 25 | const unsigned char icst307_s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 }; |
26 | |||
27 | EXPORT_SYMBOL(icst307_s2div); | ||
26 | 28 | ||
27 | unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco) | 29 | unsigned 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 | ||
32 | EXPORT_SYMBOL(icst307_hz); | 34 | EXPORT_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 | */ |
37 | static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 }; | 39 | const unsigned char icst307_idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 }; |
40 | |||
41 | EXPORT_SYMBOL(icst307_idx2s); | ||
38 | 42 | ||
39 | struct icst_vco | 43 | struct icst_vco |
40 | icst307_hz_to_vco(const struct icst_params *p, unsigned long freq) | 44 | icst307_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 |
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 | */ |
22 | static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 }; | 22 | const unsigned char icst525_s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 }; |
23 | |||
24 | EXPORT_SYMBOL(icst525_s2div); | ||
23 | 25 | ||
24 | unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco) | 26 | unsigned 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 | ||
29 | EXPORT_SYMBOL(icst525_hz); | 31 | EXPORT_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 | */ |
34 | static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 }; | 36 | const unsigned char icst525_idx2s[8] = { 1, 3, 4, 7, 5, 2, 6, 0 }; |
37 | |||
38 | EXPORT_SYMBOL(icst525_idx2s); | ||
35 | 39 | ||
36 | struct icst_vco | 40 | struct icst_vco |
37 | icst525_hz_to_vco(const struct icst_params *p, unsigned long freq) | 41 | icst525_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 |