]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ARM: ICST: indirect s2div and idx2s arrays via icst_params
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 16 Jan 2010 19:46:19 +0000 (19:46 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 2 May 2010 08:35:32 +0000 (09:35 +0100)
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/common/icst307.c
arch/arm/common/icst525.c
arch/arm/include/asm/hardware/icst.h
arch/arm/include/asm/hardware/icst307.h
arch/arm/include/asm/hardware/icst525.h
arch/arm/mach-integrator/cpu.c
arch/arm/mach-integrator/impd1.c
arch/arm/mach-integrator/integrator_cp.c
arch/arm/mach-realview/core.c
arch/arm/mach-versatile/core.c

index 312485fab4a6f52cedd02679dea7ada77895176b..8332c0726e731c16c9f17a1d01245e87509d8fa9 100644 (file)
 /*
  * Divisors for each OD setting.
  */
-static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
+const unsigned char icst307_s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
+
+EXPORT_SYMBOL(icst307_s2div);
 
 unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco)
 {
-       return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
+       return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * p->s2div[vco.s]);
 }
 
 EXPORT_SYMBOL(icst307_hz);
@@ -34,7 +36,9 @@ EXPORT_SYMBOL(icst307_hz);
 /*
  * Ascending divisor S values.
  */
-static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
+const unsigned char icst307_idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
+
+EXPORT_SYMBOL(icst307_idx2s);
 
 struct icst_vco
 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)
         * that the PLL output is within spec.
         */
        do {
-               f = freq * s2div[idx2s[i]];
+               f = freq * p->s2div[p->idx2s[i]];
 
                /*
                 * f must be between 6MHz and 200MHz (3.3 or 5V)
                 */
                if (f > p->vco_min && f <= p->vco_max)
                        break;
-       } while (i < ARRAY_SIZE(idx2s));
+       } while (i < 8);
 
-       if (i >= ARRAY_SIZE(idx2s))
+       if (i >= 8)
                return vco;
 
-       vco.s = idx2s[i];
+       vco.s = p->idx2s[i];
 
        /*
         * Now find the closest divisor combination
index da58965da31135982bc95b2e3ee84eb4dc76c51f..4180255eb078c2ea0298082603d096b65fd5d03a 100644 (file)
 /*
  * Divisors for each OD setting.
  */
-static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
+const unsigned char icst525_s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
+
+EXPORT_SYMBOL(icst525_s2div);
 
 unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco)
 {
-       return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
+       return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * p->s2div[vco.s]);
 }
 
 EXPORT_SYMBOL(icst525_hz);
@@ -31,7 +33,9 @@ EXPORT_SYMBOL(icst525_hz);
 /*
  * Ascending divisor S values.
  */
-static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 };
+const unsigned char icst525_idx2s[8] = { 1, 3, 4, 7, 5, 2, 6, 0 };
+
+EXPORT_SYMBOL(icst525_idx2s);
 
 struct icst_vco
 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)
         * that the PLL output is within spec.
         */
        do {
-               f = freq * s2div[idx2s[i]];
+               f = freq * p->s2div[p->idx2s[i]];
 
                /*
                 * f must be between 10MHz and
@@ -53,12 +57,12 @@ icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
                 */
                if (f > p->vco_min && f <= p->vco_max)
                        break;
-       } while (i < ARRAY_SIZE(idx2s));
+       } while (i < 8);
 
-       if (i >= ARRAY_SIZE(idx2s))
+       if (i >= 8)
                return vco;
 
-       vco.s = idx2s[i];
+       vco.s = p->idx2s[i];
 
        /*
         * Now find the closest divisor combination
index 6707c6a9132f5f36c07225f29db6ee87b3187b95..4d403680fa4716547648a776301b9a909bb7ddfd 100644 (file)
@@ -22,6 +22,8 @@ struct icst_params {
        unsigned short  vd_max;         /* inclusive */
        unsigned char   rd_min;         /* inclusive */
        unsigned char   rd_max;         /* inclusive */
+       const unsigned char *s2div;     /* chip specific s2div array */
+       const unsigned char *idx2s;     /* chip specific idx2s array */
 };
 
 struct icst_vco {
index 0f096181e8327a1b188e6ce903af84a88e6152d5..d76fc6e09e47980f978b8f63e13f8a26bf763c69 100644 (file)
@@ -28,4 +28,7 @@ struct icst_vco icst307_hz_to_vco(const struct icst_params *p, unsigned long fre
 #define ICST307_VCO_MIN        6000000
 #define ICST307_VCO_MAX        200000000
 
+extern const unsigned char icst307_s2div[];
+extern const unsigned char icst307_idx2s[];
+
 #endif
index 1000a6096fcb1efdd46bbd1a0b7608d96567d851..2f9b95386b1ba625ef421e3f456fe885e67da16f 100644 (file)
@@ -27,4 +27,7 @@ struct icst_vco icst525_hz_to_vco(const struct icst_params *p, unsigned long fre
 #define ICST525_VCO_MAX_3V     200000000
 #define ICST525_VCO_MAX_5V     320000000
 
+extern const unsigned char icst525_s2div[];
+extern const unsigned char icst525_idx2s[];
+
 #endif
index 569306b8fdb5e4802253bbfe9d700911f6df026d..9481c5408bf840e9d650e071ec0605791db9909c 100644 (file)
@@ -39,6 +39,8 @@ static const struct icst_params lclk_params = {
        .vd_max         = 132,
        .rd_min         = 24,
        .rd_max         = 24,
+       .s2div          = icst525_s2div,
+       .idx2s          = icst525_idx2s,
 };
 
 static const struct icst_params cclk_params = {
@@ -49,6 +51,8 @@ static const struct icst_params cclk_params = {
        .vd_max         = 160,
        .rd_min         = 24,
        .rd_max         = 24,
+       .s2div          = icst525_s2div,
+       .idx2s          = icst525_idx2s,
 };
 
 /*
index 036cfb45273554a94da8a217ed29134d7e101c50..e24cfc357ffb68853a39d2bc5efc38ee156b70a9 100644 (file)
@@ -48,6 +48,8 @@ static const struct icst_params impd1_vco_params = {
        .vd_max         = 519,
        .rd_min         = 3,
        .rd_max         = 120,
+       .s2div          = icst525_s2div,
+       .idx2s          = icst525_idx2s,
 };
 
 static void impd1_setvco(struct clk *clk, struct icst_vco vco)
index 34c120ad12926922dfdc20425b7169bcd888e5a2..9997d1f6c184b7d7ac9e9fae3822e6d058032354 100644 (file)
@@ -276,6 +276,8 @@ static const struct icst_params cp_auxvco_params = {
        .vd_max         = 263,
        .rd_min         = 3,
        .rd_max         = 65,
+       .s2div          = icst525_s2div,
+       .idx2s          = icst525_idx2s,
 };
 
 static void cp_auxvco_set(struct clk *clk, struct icst_vco vco)
index 3ac44138bf755cf250e4b28563b4553202c2bfd0..26d44caad54004ce0db57430c41b099c4f2b64b8 100644 (file)
@@ -281,6 +281,8 @@ static const struct icst_params realview_oscvco_params = {
        .vd_max         = 511 + 8,
        .rd_min         = 1 + 2,
        .rd_max         = 127 + 2,
+       .s2div          = icst307_s2div,
+       .idx2s          = icst307_idx2s,
 };
 
 static void realview_oscvco_set(struct clk *clk, struct icst_vco vco)
index c4bf6802df5b159d010226b1e17dbe051ce93163..51d7aeb6a507466edb3a5131e9a3135b5a5e5252 100644 (file)
@@ -387,6 +387,8 @@ static const struct icst_params versatile_oscvco_params = {
        .vd_max         = 511 + 8,
        .rd_min         = 1 + 2,
        .rd_max         = 127 + 2,
+       .s2div          = icst307_s2div,
+       .idx2s          = icst307_idx2s,
 };
 
 static void versatile_oscvco_set(struct clk *clk, struct icst_vco vco)