]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ARM: ICST: merge common ICST VCO structures
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 16 Jan 2010 16:27:28 +0000 (16:27 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 2 May 2010 08:35:29 +0000 (09:35 +0100)
The structures for the ICST307 and ICST525 VCO devices are
identical, so merge them together.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
16 files changed:
arch/arm/common/icst307.c
arch/arm/common/icst525.c
arch/arm/include/asm/hardware/icst.h [new file with mode: 0644]
arch/arm/include/asm/hardware/icst307.h
arch/arm/include/asm/hardware/icst525.h
arch/arm/mach-integrator/clock.c
arch/arm/mach-integrator/cpu.c
arch/arm/mach-integrator/impd1.c
arch/arm/mach-integrator/include/mach/clkdev.h
arch/arm/mach-integrator/integrator_cp.c
arch/arm/mach-realview/clock.c
arch/arm/mach-realview/clock.h
arch/arm/mach-realview/core.c
arch/arm/mach-versatile/clock.c
arch/arm/mach-versatile/clock.h
arch/arm/mach-versatile/core.c

index 6d094c1575400d0487b754ecb6a723ee474435dd..2eebd960c01b7a9786b3a6b1ac13758c218587de 100644 (file)
@@ -24,7 +24,7 @@
  */
 static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
 
-unsigned long icst307_khz(const struct icst307_params *p, struct icst307_vco vco)
+unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco)
 {
        return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
 }
@@ -36,10 +36,10 @@ EXPORT_SYMBOL(icst307_khz);
  */
 static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
 
-struct icst307_vco
-icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq)
+struct icst_vco
+icst307_khz_to_vco(const struct icst_params *p, unsigned long freq)
 {
-       struct icst307_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
+       struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
        unsigned long f;
        unsigned int i = 0, rd, best = (unsigned int)-1;
 
@@ -96,10 +96,10 @@ icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq)
 
 EXPORT_SYMBOL(icst307_khz_to_vco);
 
-struct icst307_vco
-icst307_ps_to_vco(const struct icst307_params *p, unsigned long period)
+struct icst_vco
+icst307_ps_to_vco(const struct icst_params *p, unsigned long period)
 {
-       struct icst307_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
+       struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
        unsigned long f, ps;
        unsigned int i = 0, rd, best = (unsigned int)-1;
 
index 3d377c5bdef6299332c068974753a0c41e8c939d..fd5c2e7ed176c3507b4c1b2b98a82a3d7aa15351 100644 (file)
@@ -21,7 +21,7 @@
  */
 static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
 
-unsigned long icst525_khz(const struct icst525_params *p, struct icst525_vco vco)
+unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco)
 {
        return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
 }
@@ -33,10 +33,10 @@ EXPORT_SYMBOL(icst525_khz);
  */
 static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 };
 
-struct icst525_vco
-icst525_khz_to_vco(const struct icst525_params *p, unsigned long freq)
+struct icst_vco
+icst525_khz_to_vco(const struct icst_params *p, unsigned long freq)
 {
-       struct icst525_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
+       struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
        unsigned long f;
        unsigned int i = 0, rd, best = (unsigned int)-1;
 
@@ -94,10 +94,10 @@ icst525_khz_to_vco(const struct icst525_params *p, unsigned long freq)
 
 EXPORT_SYMBOL(icst525_khz_to_vco);
 
-struct icst525_vco
-icst525_ps_to_vco(const struct icst525_params *p, unsigned long period)
+struct icst_vco
+icst525_ps_to_vco(const struct icst_params *p, unsigned long period)
 {
-       struct icst525_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
+       struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
        unsigned long f, ps;
        unsigned int i = 0, rd, best = (unsigned int)-1;
 
diff --git a/arch/arm/include/asm/hardware/icst.h b/arch/arm/include/asm/hardware/icst.h
new file mode 100644 (file)
index 0000000..65b1edd
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  arch/arm/include/asm/hardware/icst.h
+ *
+ *  Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ *  Support functions for calculating clocks/divisors for the ICST
+ *  clock generators.  See http://www.icst.com/ for more information
+ *  on these devices.
+ */
+#ifndef ASMARM_HARDWARE_ICST_H
+#define ASMARM_HARDWARE_ICST_H
+
+struct icst_params {
+       unsigned long   ref;
+       unsigned long   vco_max;        /* inclusive */
+       unsigned short  vd_min;         /* inclusive */
+       unsigned short  vd_max;         /* inclusive */
+       unsigned char   rd_min;         /* inclusive */
+       unsigned char   rd_max;         /* inclusive */
+};
+
+struct icst_vco {
+       unsigned short  v;
+       unsigned char   r;
+       unsigned char   s;
+};
+
+#endif
index 554f128a104641aed7b4c2b747276c0f339173bf..85932e902e9994cf9c781c0e847248d8b72c6a73 100644 (file)
 #ifndef ASMARM_HARDWARE_ICST307_H
 #define ASMARM_HARDWARE_ICST307_H
 
-struct icst307_params {
-       unsigned long   ref;
-       unsigned long   vco_max;        /* inclusive */
-       unsigned short  vd_min;         /* inclusive */
-       unsigned short  vd_max;         /* inclusive */
-       unsigned char   rd_min;         /* inclusive */
-       unsigned char   rd_max;         /* inclusive */
-};
+#include <asm/hardware/icst.h>
 
-struct icst307_vco {
-       unsigned short  v;
-       unsigned char   r;
-       unsigned char   s;
-};
-
-unsigned long icst307_khz(const struct icst307_params *p, struct icst307_vco vco);
-struct icst307_vco icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq);
-struct icst307_vco icst307_ps_to_vco(const struct icst307_params *p, unsigned long period);
+unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco);
+struct icst_vco icst307_khz_to_vco(const struct icst_params *p, unsigned long freq);
+struct icst_vco icst307_ps_to_vco(const struct icst_params *p, unsigned long period);
 
 #endif
index 58f0dc43e2edb82bbed9a193bfe370db8f2a544a..170deb2b605be27f21977e980764a340bb59ade1 100644 (file)
 #ifndef ASMARM_HARDWARE_ICST525_H
 #define ASMARM_HARDWARE_ICST525_H
 
-struct icst525_params {
-       unsigned long   ref;
-       unsigned long   vco_max;        /* inclusive */
-       unsigned short  vd_min;         /* inclusive */
-       unsigned short  vd_max;         /* inclusive */
-       unsigned char   rd_min;         /* inclusive */
-       unsigned char   rd_max;         /* inclusive */
-};
+#include <asm/hardware/icst.h>
 
-struct icst525_vco {
-       unsigned short  v;
-       unsigned char   r;
-       unsigned char   s;
-};
-
-unsigned long icst525_khz(const struct icst525_params *p, struct icst525_vco vco);
-struct icst525_vco icst525_khz_to_vco(const struct icst525_params *p, unsigned long freq);
-struct icst525_vco icst525_ps_to_vco(const struct icst525_params *p, unsigned long period);
+unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco);
+struct icst_vco icst525_khz_to_vco(const struct icst_params *p, unsigned long freq);
+struct icst_vco icst525_ps_to_vco(const struct icst_params *p, unsigned long period);
 
 #endif
index 989ecf5f5c4685a9b8afedf0677e8e0a88d63f82..bb70b64a65635e1721b8b97275e1a1e509926f12 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/clk.h>
 #include <linux/mutex.h>
 
+#include <asm/hardware/icst525.h>
 #include <asm/clkdev.h>
 #include <mach/clkdev.h>
 
@@ -36,7 +37,7 @@ EXPORT_SYMBOL(clk_get_rate);
 
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
-       struct icst525_vco vco;
+       struct icst_vco vco;
        vco = icst525_khz_to_vco(clk->params, rate / 1000);
        return icst525_khz(clk->params, vco) * 1000;
 }
@@ -47,7 +48,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
        int ret = -EIO;
 
        if (clk->setvco) {
-               struct icst525_vco vco;
+               struct icst_vco vco;
 
                vco = icst525_khz_to_vco(clk->params, rate / 1000);
                clk->rate = icst525_khz(clk->params, vco) * 1000;
index 7f1b73b776a7ca23a8359ed561a6908339de884a..c4e5debeb48c9f6230270d0bbc25c4cd03545c29 100644 (file)
@@ -31,7 +31,7 @@ static struct cpufreq_driver integrator_driver;
 #define CM_STAT IO_ADDRESS(INTEGRATOR_HDR_STAT)
 #define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK)
 
-static const struct icst525_params lclk_params = {
+static const struct icst_params lclk_params = {
        .ref            = 24000,
        .vco_max        = 320000,
        .vd_min         = 8,
@@ -40,7 +40,7 @@ static const struct icst525_params lclk_params = {
        .rd_max         = 24,
 };
 
-static const struct icst525_params cclk_params = {
+static const struct icst_params cclk_params = {
        .ref            = 24000,
        .vco_max        = 320000,
        .vd_min         = 12,
@@ -54,7 +54,7 @@ static const struct icst525_params cclk_params = {
  */
 static int integrator_verify_policy(struct cpufreq_policy *policy)
 {
-       struct icst525_vco vco;
+       struct icst_vco vco;
 
        cpufreq_verify_within_limits(policy, 
                                     policy->cpuinfo.min_freq, 
@@ -80,7 +80,7 @@ static int integrator_set_target(struct cpufreq_policy *policy,
 {
        cpumask_t cpus_allowed;
        int cpu = policy->cpu;
-       struct icst525_vco vco;
+       struct icst_vco vco;
        struct cpufreq_freqs freqs;
        u_int cm_osc;
 
@@ -156,7 +156,7 @@ static unsigned int integrator_get(unsigned int cpu)
        cpumask_t cpus_allowed;
        unsigned int current_freq;
        u_int cm_osc;
-       struct icst525_vco vco;
+       struct icst_vco vco;
 
        cpus_allowed = current->cpus_allowed;
 
index 0058c937719ed7f7400fe8a1388e9c9e8f73e777..dfb961b67afa52d9bbb746fde10c5e36ae99a476 100644 (file)
@@ -40,7 +40,7 @@ struct impd1_module {
        struct clk_lookup *clks[3];
 };
 
-static const struct icst525_params impd1_vco_params = {
+static const struct icst_params impd1_vco_params = {
        .ref            = 24000,        /* 24 MHz */
        .vco_max        = 200000,       /* 200 MHz */
        .vd_min         = 12,
@@ -49,7 +49,7 @@ static const struct icst525_params impd1_vco_params = {
        .rd_max         = 120,
 };
 
-static void impd1_setvco(struct clk *clk, struct icst525_vco vco)
+static void impd1_setvco(struct clk *clk, struct icst_vco vco)
 {
        struct impd1_module *impd1 = clk->data;
        int vconr = clk - impd1->vcos;
index 9293e410832a76f52db88d59486f658f194adad8..89ea93803998c6a77d08c5f15511d6613acd82f9 100644 (file)
@@ -2,14 +2,14 @@
 #define __ASM_MACH_CLKDEV_H
 
 #include <linux/module.h>
-#include <asm/hardware/icst525.h>
+#include <asm/hardware/icst.h>
 
 struct clk {
        unsigned long           rate;
        struct module           *owner;
-       const struct icst525_params *params;
+       const struct icst_params *params;
        void                    *data;
-       void                    (*setvco)(struct clk *, struct icst525_vco vco);
+       void                    (*setvco)(struct clk *, struct icst_vco vco);
 };
 
 static inline int __clk_get(struct clk *clk)
index c0161df9d9a248030df29fbbb02231e41d5d49dc..15bfbe2e1df8f0a90fb1a85038f8e863cbe4f1bd 100644 (file)
@@ -268,7 +268,7 @@ static void __init intcp_init_irq(void)
 #define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK)
 #define CM_AUXOSC IO_ADDRESS(INTEGRATOR_HDR_BASE + 0x1c)
 
-static const struct icst525_params cp_auxvco_params = {
+static const struct icst_params cp_auxvco_params = {
        .ref            = 24000,
        .vco_max        = 320000,
        .vd_min         = 8,
@@ -277,7 +277,7 @@ static const struct icst525_params cp_auxvco_params = {
        .rd_max         = 65,
 };
 
-static void cp_auxvco_set(struct clk *clk, struct icst525_vco vco)
+static void cp_auxvco_set(struct clk *clk, struct icst_vco vco)
 {
        u32 val;
 
index a7043115de72638022aefa73f7a829a49e515302..83646579bc450243c875e68470de7cc99b9c00aa 100644 (file)
@@ -41,7 +41,7 @@ EXPORT_SYMBOL(clk_get_rate);
 
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
-       struct icst307_vco vco;
+       struct icst_vco vco;
        vco = icst307_khz_to_vco(clk->params, rate / 1000);
        return icst307_khz(clk->params, vco) * 1000;
 }
@@ -52,7 +52,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
        int ret = -EIO;
 
        if (clk->setvco) {
-               struct icst307_vco vco;
+               struct icst_vco vco;
 
                vco = icst307_khz_to_vco(clk->params, rate / 1000);
                clk->rate = icst307_khz(clk->params, vco) * 1000;
index ebbb0f06b6007860802116670fe8dca9e2fb2e4e..fa64c854258defa2dd6d8f4eaf617976470a3d4f 100644 (file)
@@ -8,12 +8,13 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <asm/hardware/icst.h>
+
 struct module;
-struct icst307_params;
 
 struct clk {
        unsigned long           rate;
-       const struct icst307_params *params;
+       const struct icst_params *params;
        void                    *data;
-       void                    (*setvco)(struct clk *, struct icst307_vco vco);
+       void                    (*setvco)(struct clk *, struct icst_vco vco);
 };
index 90bd4ef71b2cae9b426d0bf5e707c2a441a35e1c..ac504745fed1a0c3772e8e07ee559ea8fe0459c0 100644 (file)
@@ -273,7 +273,7 @@ struct mmci_platform_data realview_mmc1_plat_data = {
 /*
  * Clock handling
  */
-static const struct icst307_params realview_oscvco_params = {
+static const struct icst_params realview_oscvco_params = {
        .ref            = 24000,
        .vco_max        = 200000,
        .vd_min         = 4 + 8,
@@ -282,7 +282,7 @@ static const struct icst307_params realview_oscvco_params = {
        .rd_max         = 127 + 2,
 };
 
-static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco)
+static void realview_oscvco_set(struct clk *clk, struct icst_vco vco)
 {
        void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET;
        void __iomem *sys_osc;
index c50a44ea7ee6d4c3fa947f53062373092d417455..530e16aa7ad6655edca9f44dfefc88bfc565252e 100644 (file)
@@ -42,7 +42,7 @@ EXPORT_SYMBOL(clk_get_rate);
 
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
-       struct icst307_vco vco;
+       struct icst_vco vco;
        vco = icst307_khz_to_vco(clk->params, rate / 1000);
        return icst307_khz(clk->params, vco) * 1000;
 }
@@ -53,7 +53,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
        int ret = -EIO;
 
        if (clk->setvco) {
-               struct icst307_vco vco;
+               struct icst_vco vco;
 
                vco = icst307_khz_to_vco(clk->params, rate / 1000);
                clk->rate = icst307_khz(clk->params, vco) * 1000;
index 03468fdc3e58f7b1fc4a8071d5cd1234678ebbb8..aed7e22d102b5fd47857b32de06a89e4949c7197 100644 (file)
@@ -8,13 +8,14 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <asm/hardware/icst.h>
+
 struct module;
-struct icst307_params;
 
 struct clk {
        unsigned long           rate;
-       const struct icst307_params *params;
+       const struct icst_params *params;
        u32                     oscoff;
        void                    *data;
-       void                    (*setvco)(struct clk *, struct icst307_vco vco);
+       void                    (*setvco)(struct clk *, struct icst_vco vco);
 };
index b77bc407b77dfa6ef0413aa843968a60a05c5811..ded71343553f0ff124bbcad4b28863c1f39757f7 100644 (file)
@@ -379,7 +379,7 @@ static struct mmci_platform_data mmc0_plat_data = {
 /*
  * Clock handling
  */
-static const struct icst307_params versatile_oscvco_params = {
+static const struct icst_params versatile_oscvco_params = {
        .ref            = 24000,
        .vco_max        = 200000,
        .vd_min         = 4 + 8,
@@ -388,7 +388,7 @@ static const struct icst307_params versatile_oscvco_params = {
        .rd_max         = 127 + 2,
 };
 
-static void versatile_oscvco_set(struct clk *clk, struct icst307_vco vco)
+static void versatile_oscvco_set(struct clk *clk, struct icst_vco vco)
 {
        void __iomem *sys = __io_address(VERSATILE_SYS_BASE);
        void __iomem *sys_lock = sys + VERSATILE_SYS_LOCK_OFFSET;