12 #include <linux/module.h>
13 #include <linux/types.h>
14 #include <linux/kernel.h>
16 #include <linux/sched.h>
21 #include <mach/hardware.h>
22 #include <mach/platform.h>
28 #define CM_ID __io_address(INTEGRATOR_HDR_ID)
29 #define CM_OSC __io_address(INTEGRATOR_HDR_OSC)
30 #define CM_STAT __io_address(INTEGRATOR_HDR_STAT)
31 #define CM_LOCK __io_address(INTEGRATOR_HDR_LOCK)
64 cpufreq_verify_within_limits(policy,
69 policy->
max =
icst_hz(&cclk_params, vco) / 1000;
72 policy->
min =
icst_hz(&cclk_params, vco) / 1000;
74 cpufreq_verify_within_limits(policy,
83 unsigned int target_freq,
84 unsigned int relation)
95 cpus_allowed =
current->cpus_allowed;
107 if (machine_is_integrator()) {
108 vco.s = (cm_osc >> 8) & 7;
109 }
else if (machine_is_cintegrator()) {
112 vco.v = cm_osc & 255;
114 freqs.old =
icst_hz(&cclk_params, vco) / 1000;
121 if (target_freq > policy->
max)
122 target_freq = policy->
max;
124 freqs.new =
icst_hz(&cclk_params, vco) / 1000;
126 freqs.cpu = policy->
cpu;
128 if (freqs.old == freqs.new) {
129 set_cpus_allowed(
current, cpus_allowed);
137 if (machine_is_integrator()) {
138 cm_osc &= 0xfffff800;
139 cm_osc |= vco.s << 8;
140 }
else if (machine_is_cintegrator()) {
141 cm_osc &= 0xffffff00;
152 set_cpus_allowed(
current, cpus_allowed);
159 static unsigned int integrator_get(
unsigned int cpu)
162 unsigned int current_freq;
166 cpus_allowed =
current->cpus_allowed;
174 if (machine_is_integrator()) {
175 vco.s = (cm_osc >> 8) & 7;
179 vco.v = cm_osc & 255;
182 current_freq =
icst_hz(&cclk_params, vco) / 1000;
184 set_cpus_allowed(
current, cpus_allowed);
193 policy->
cpuinfo.max_freq = 160000;
194 policy->
cpuinfo.min_freq = 12000;
195 policy->
cpuinfo.transition_latency = 1000000;
196 policy->
cur = policy->
min = policy->
max = integrator_get(policy->
cpu);
202 .verify = integrator_verify_policy,
203 .target = integrator_set_target,
204 .get = integrator_get,
205 .init = integrator_cpufreq_init,
206 .name =
"integrator",
209 static int __init integrator_cpu_init(
void)
214 static void __exit integrator_cpu_exit(
void)