aboutsummaryrefslogtreecommitdiffstats
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
parente73a46a3d3df22b379d8adcb59999eafea1d60d5 (diff)
ARM: ICST: indirect s2div and idx2s arrays via icst_params
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/common/icst307.c18
-rw-r--r--arch/arm/common/icst525.c18
-rw-r--r--arch/arm/include/asm/hardware/icst.h2
-rw-r--r--arch/arm/include/asm/hardware/icst307.h3
-rw-r--r--arch/arm/include/asm/hardware/icst525.h3
-rw-r--r--arch/arm/mach-integrator/cpu.c4
-rw-r--r--arch/arm/mach-integrator/impd1.c2
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c2
-rw-r--r--arch/arm/mach-realview/core.c2
-rw-r--r--arch/arm/mach-versatile/core.c2
10 files changed, 42 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 */
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
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
diff --git a/arch/arm/include/asm/hardware/icst.h b/arch/arm/include/asm/hardware/icst.h
index 6707c6a9132f..4d403680fa47 100644
--- a/arch/arm/include/asm/hardware/icst.h
+++ b/arch/arm/include/asm/hardware/icst.h
@@ -22,6 +22,8 @@ struct icst_params {
22 unsigned short vd_max; /* inclusive */ 22 unsigned short vd_max; /* inclusive */
23 unsigned char rd_min; /* inclusive */ 23 unsigned char rd_min; /* inclusive */
24 unsigned char rd_max; /* inclusive */ 24 unsigned char rd_max; /* inclusive */
25 const unsigned char *s2div; /* chip specific s2div array */
26 const unsigned char *idx2s; /* chip specific idx2s array */
25}; 27};
26 28
27struct icst_vco { 29struct icst_vco {
diff --git a/arch/arm/include/asm/hardware/icst307.h b/arch/arm/include/asm/hardware/icst307.h
index 0f096181e832..d76fc6e09e47 100644
--- a/arch/arm/include/asm/hardware/icst307.h
+++ b/arch/arm/include/asm/hardware/icst307.h
@@ -28,4 +28,7 @@ struct icst_vco icst307_hz_to_vco(const struct icst_params *p, unsigned long fre
28#define ICST307_VCO_MIN 6000000 28#define ICST307_VCO_MIN 6000000
29#define ICST307_VCO_MAX 200000000 29#define ICST307_VCO_MAX 200000000
30 30
31extern const unsigned char icst307_s2div[];
32extern const unsigned char icst307_idx2s[];
33
31#endif 34#endif
diff --git a/arch/arm/include/asm/hardware/icst525.h b/arch/arm/include/asm/hardware/icst525.h
index 1000a6096fcb..2f9b95386b1b 100644
--- a/arch/arm/include/asm/hardware/icst525.h
+++ b/arch/arm/include/asm/hardware/icst525.h
@@ -27,4 +27,7 @@ struct icst_vco icst525_hz_to_vco(const struct icst_params *p, unsigned long fre
27#define ICST525_VCO_MAX_3V 200000000 27#define ICST525_VCO_MAX_3V 200000000
28#define ICST525_VCO_MAX_5V 320000000 28#define ICST525_VCO_MAX_5V 320000000
29 29
30extern const unsigned char icst525_s2div[];
31extern const unsigned char icst525_idx2s[];
32
30#endif 33#endif
diff --git a/arch/arm/mach-integrator/cpu.c b/arch/arm/mach-integrator/cpu.c
index 569306b8fdb5..9481c5408bf8 100644
--- a/arch/arm/mach-integrator/cpu.c
+++ b/arch/arm/mach-integrator/cpu.c
@@ -39,6 +39,8 @@ static const struct icst_params lclk_params = {
39 .vd_max = 132, 39 .vd_max = 132,
40 .rd_min = 24, 40 .rd_min = 24,
41 .rd_max = 24, 41 .rd_max = 24,
42 .s2div = icst525_s2div,
43 .idx2s = icst525_idx2s,
42}; 44};
43 45
44static const struct icst_params cclk_params = { 46static const struct icst_params cclk_params = {
@@ -49,6 +51,8 @@ static const struct icst_params cclk_params = {
49 .vd_max = 160, 51 .vd_max = 160,
50 .rd_min = 24, 52 .rd_min = 24,
51 .rd_max = 24, 53 .rd_max = 24,
54 .s2div = icst525_s2div,
55 .idx2s = icst525_idx2s,
52}; 56};
53 57
54/* 58/*
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 036cfb452735..e24cfc357ffb 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -48,6 +48,8 @@ static const struct icst_params impd1_vco_params = {
48 .vd_max = 519, 48 .vd_max = 519,
49 .rd_min = 3, 49 .rd_min = 3,
50 .rd_max = 120, 50 .rd_max = 120,
51 .s2div = icst525_s2div,
52 .idx2s = icst525_idx2s,
51}; 53};
52 54
53static void impd1_setvco(struct clk *clk, struct icst_vco vco) 55static void impd1_setvco(struct clk *clk, struct icst_vco vco)
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 34c120ad1292..9997d1f6c184 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -276,6 +276,8 @@ static const struct icst_params cp_auxvco_params = {
276 .vd_max = 263, 276 .vd_max = 263,
277 .rd_min = 3, 277 .rd_min = 3,
278 .rd_max = 65, 278 .rd_max = 65,
279 .s2div = icst525_s2div,
280 .idx2s = icst525_idx2s,
279}; 281};
280 282
281static void cp_auxvco_set(struct clk *clk, struct icst_vco vco) 283static void cp_auxvco_set(struct clk *clk, struct icst_vco vco)
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 3ac44138bf75..26d44caad540 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -281,6 +281,8 @@ static const struct icst_params realview_oscvco_params = {
281 .vd_max = 511 + 8, 281 .vd_max = 511 + 8,
282 .rd_min = 1 + 2, 282 .rd_min = 1 + 2,
283 .rd_max = 127 + 2, 283 .rd_max = 127 + 2,
284 .s2div = icst307_s2div,
285 .idx2s = icst307_idx2s,
284}; 286};
285 287
286static void realview_oscvco_set(struct clk *clk, struct icst_vco vco) 288static void realview_oscvco_set(struct clk *clk, struct icst_vco vco)
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index c4bf6802df5b..51d7aeb6a507 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -387,6 +387,8 @@ static const struct icst_params versatile_oscvco_params = {
387 .vd_max = 511 + 8, 387 .vd_max = 511 + 8,
388 .rd_min = 1 + 2, 388 .rd_min = 1 + 2,
389 .rd_max = 127 + 2, 389 .rd_max = 127 + 2,
390 .s2div = icst307_s2div,
391 .idx2s = icst307_idx2s,
390}; 392};
391 393
392static void versatile_oscvco_set(struct clk *clk, struct icst_vco vco) 394static void versatile_oscvco_set(struct clk *clk, struct icst_vco vco)