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