diff options
Diffstat (limited to 'arch/arm/mach-integrator/cpu.c')
-rw-r--r-- | arch/arm/mach-integrator/cpu.c | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/arch/arm/mach-integrator/cpu.c b/arch/arm/mach-integrator/cpu.c index 44d4c2e8207b..1cb222daa06d 100644 --- a/arch/arm/mach-integrator/cpu.c +++ b/arch/arm/mach-integrator/cpu.c | |||
@@ -20,32 +20,39 @@ | |||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | 21 | ||
22 | #include <mach/hardware.h> | 22 | #include <mach/hardware.h> |
23 | #include <mach/platform.h> | ||
23 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
24 | #include <asm/hardware/icst525.h> | 25 | #include <asm/hardware/icst.h> |
25 | 26 | ||
26 | static struct cpufreq_driver integrator_driver; | 27 | static struct cpufreq_driver integrator_driver; |
27 | 28 | ||
28 | #define CM_ID (IO_ADDRESS(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_ID_OFFSET) | 29 | #define CM_ID IO_ADDRESS(INTEGRATOR_HDR_ID) |
29 | #define CM_OSC (IO_ADDRESS(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_OSC_OFFSET) | 30 | #define CM_OSC IO_ADDRESS(INTEGRATOR_HDR_OSC) |
30 | #define CM_STAT (IO_ADDRESS(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_STAT_OFFSET) | 31 | #define CM_STAT IO_ADDRESS(INTEGRATOR_HDR_STAT) |
31 | #define CM_LOCK (IO_ADDRESS(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_LOCK_OFFSET) | 32 | #define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK) |
32 | 33 | ||
33 | static const struct icst525_params lclk_params = { | 34 | static const struct icst_params lclk_params = { |
34 | .ref = 24000, | 35 | .ref = 24000000, |
35 | .vco_max = 320000, | 36 | .vco_max = ICST525_VCO_MAX_5V, |
37 | .vco_min = ICST525_VCO_MIN, | ||
36 | .vd_min = 8, | 38 | .vd_min = 8, |
37 | .vd_max = 132, | 39 | .vd_max = 132, |
38 | .rd_min = 24, | 40 | .rd_min = 24, |
39 | .rd_max = 24, | 41 | .rd_max = 24, |
42 | .s2div = icst525_s2div, | ||
43 | .idx2s = icst525_idx2s, | ||
40 | }; | 44 | }; |
41 | 45 | ||
42 | static const struct icst525_params cclk_params = { | 46 | static const struct icst_params cclk_params = { |
43 | .ref = 24000, | 47 | .ref = 24000000, |
44 | .vco_max = 320000, | 48 | .vco_max = ICST525_VCO_MAX_5V, |
49 | .vco_min = ICST525_VCO_MIN, | ||
45 | .vd_min = 12, | 50 | .vd_min = 12, |
46 | .vd_max = 160, | 51 | .vd_max = 160, |
47 | .rd_min = 24, | 52 | .rd_min = 24, |
48 | .rd_max = 24, | 53 | .rd_max = 24, |
54 | .s2div = icst525_s2div, | ||
55 | .idx2s = icst525_idx2s, | ||
49 | }; | 56 | }; |
50 | 57 | ||
51 | /* | 58 | /* |
@@ -53,17 +60,17 @@ static const struct icst525_params cclk_params = { | |||
53 | */ | 60 | */ |
54 | static int integrator_verify_policy(struct cpufreq_policy *policy) | 61 | static int integrator_verify_policy(struct cpufreq_policy *policy) |
55 | { | 62 | { |
56 | struct icst525_vco vco; | 63 | struct icst_vco vco; |
57 | 64 | ||
58 | cpufreq_verify_within_limits(policy, | 65 | cpufreq_verify_within_limits(policy, |
59 | policy->cpuinfo.min_freq, | 66 | policy->cpuinfo.min_freq, |
60 | policy->cpuinfo.max_freq); | 67 | policy->cpuinfo.max_freq); |
61 | 68 | ||
62 | vco = icst525_khz_to_vco(&cclk_params, policy->max); | 69 | vco = icst_hz_to_vco(&cclk_params, policy->max * 1000); |
63 | policy->max = icst525_khz(&cclk_params, vco); | 70 | policy->max = icst_hz(&cclk_params, vco) / 1000; |
64 | 71 | ||
65 | vco = icst525_khz_to_vco(&cclk_params, policy->min); | 72 | vco = icst_hz_to_vco(&cclk_params, policy->min * 1000); |
66 | policy->min = icst525_khz(&cclk_params, vco); | 73 | policy->min = icst_hz(&cclk_params, vco) / 1000; |
67 | 74 | ||
68 | cpufreq_verify_within_limits(policy, | 75 | cpufreq_verify_within_limits(policy, |
69 | policy->cpuinfo.min_freq, | 76 | policy->cpuinfo.min_freq, |
@@ -79,7 +86,7 @@ static int integrator_set_target(struct cpufreq_policy *policy, | |||
79 | { | 86 | { |
80 | cpumask_t cpus_allowed; | 87 | cpumask_t cpus_allowed; |
81 | int cpu = policy->cpu; | 88 | int cpu = policy->cpu; |
82 | struct icst525_vco vco; | 89 | struct icst_vco vco; |
83 | struct cpufreq_freqs freqs; | 90 | struct cpufreq_freqs freqs; |
84 | u_int cm_osc; | 91 | u_int cm_osc; |
85 | 92 | ||
@@ -105,17 +112,17 @@ static int integrator_set_target(struct cpufreq_policy *policy, | |||
105 | } | 112 | } |
106 | vco.v = cm_osc & 255; | 113 | vco.v = cm_osc & 255; |
107 | vco.r = 22; | 114 | vco.r = 22; |
108 | freqs.old = icst525_khz(&cclk_params, vco); | 115 | freqs.old = icst_hz(&cclk_params, vco) / 1000; |
109 | 116 | ||
110 | /* icst525_khz_to_vco rounds down -- so we need the next | 117 | /* icst_hz_to_vco rounds down -- so we need the next |
111 | * larger freq in case of CPUFREQ_RELATION_L. | 118 | * larger freq in case of CPUFREQ_RELATION_L. |
112 | */ | 119 | */ |
113 | if (relation == CPUFREQ_RELATION_L) | 120 | if (relation == CPUFREQ_RELATION_L) |
114 | target_freq += 999; | 121 | target_freq += 999; |
115 | if (target_freq > policy->max) | 122 | if (target_freq > policy->max) |
116 | target_freq = policy->max; | 123 | target_freq = policy->max; |
117 | vco = icst525_khz_to_vco(&cclk_params, target_freq); | 124 | vco = icst_hz_to_vco(&cclk_params, target_freq * 1000); |
118 | freqs.new = icst525_khz(&cclk_params, vco); | 125 | freqs.new = icst_hz(&cclk_params, vco) / 1000; |
119 | 126 | ||
120 | freqs.cpu = policy->cpu; | 127 | freqs.cpu = policy->cpu; |
121 | 128 | ||
@@ -155,7 +162,7 @@ static unsigned int integrator_get(unsigned int cpu) | |||
155 | cpumask_t cpus_allowed; | 162 | cpumask_t cpus_allowed; |
156 | unsigned int current_freq; | 163 | unsigned int current_freq; |
157 | u_int cm_osc; | 164 | u_int cm_osc; |
158 | struct icst525_vco vco; | 165 | struct icst_vco vco; |
159 | 166 | ||
160 | cpus_allowed = current->cpus_allowed; | 167 | cpus_allowed = current->cpus_allowed; |
161 | 168 | ||
@@ -173,7 +180,7 @@ static unsigned int integrator_get(unsigned int cpu) | |||
173 | vco.v = cm_osc & 255; | 180 | vco.v = cm_osc & 255; |
174 | vco.r = 22; | 181 | vco.r = 22; |
175 | 182 | ||
176 | current_freq = icst525_khz(&cclk_params, vco); /* current freq */ | 183 | current_freq = icst_hz(&cclk_params, vco) / 1000; /* current freq */ |
177 | 184 | ||
178 | set_cpus_allowed(current, cpus_allowed); | 185 | set_cpus_allowed(current, cpus_allowed); |
179 | 186 | ||