30 #include <linux/module.h>
32 #include <asm/hw_irq.h>
38 #define SDCASR_REG 0x0100
39 #define SDCASR_REG_STRIDE 0x1000
40 #define SDCPWR_CFGA0_REG 0x0100
41 #define SDCPWR_PWST0_REG 0x0000
42 #define SDCPWR_GIZTIME_REG 0x0440
45 #define SDCPWR_GIZTIME_GR 0x80000000
46 #define SDCPWR_GIZTIME_LONGLOCK 0x000000ff
49 #define SDCASR_OFFSET 0x120000
51 static void __iomem *sdcpwr_mapbase;
52 static void __iomem *sdcasr_mapbase;
60 static int current_astate;
72 static struct freq_attr *pas_cpu_freqs_attr[] = {
81 static int get_astate_freq(
int astate)
89 static int get_cur_astate(
int cpu)
94 ret = (ret >> (cpu * 4)) & 0x7;
99 static int get_gizmo_latency(
void)
114 static void set_astate(
int cpu,
unsigned int astate)
136 set_astate(cpu, current_astate);
145 const u32 *max_freqp;
160 "pasemi,pwrficient-sdc");
168 if (!sdcasr_mapbase) {
176 "pasemi,pwrficient-gizmo");
179 goto out_unmap_sdcasr;
184 goto out_unmap_sdcasr;
186 if (!sdcpwr_mapbase) {
188 goto out_unmap_sdcasr;
196 goto out_unmap_sdcpwr;
200 max_freq = *max_freqp / 1000;
202 pr_debug(
"max clock-frequency is at %u kHz\n", max_freq);
203 pr_debug(
"initializing frequency table\n");
211 policy->
cpuinfo.transition_latency = get_gizmo_latency();
213 cur_astate = get_cur_astate(policy->
cpu);
214 pr_debug(
"current astate is at %d\n",cur_astate);
217 cpumask_copy(policy->
cpus, cpu_online_mask);
254 unsigned int target_freq,
255 unsigned int relation)
267 freqs.old = policy->
cur;
268 freqs.new = pas_freqs[pas_astate_new].
frequency;
269 freqs.cpu = policy->
cpu;
274 pr_debug(
"setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n",
277 pas_freqs[pas_astate_new].
index);
279 current_astate = pas_astate_new;
282 set_astate(i, pas_astate_new);
292 .
name =
"pas-cpufreq",
295 .init = pas_cpufreq_cpu_init,
296 .exit = pas_cpufreq_cpu_exit,
297 .verify = pas_cpufreq_verify,
298 .target = pas_cpufreq_target,
299 .attr = pas_cpu_freqs_attr,
306 static int __init pas_cpufreq_init(
void)
315 static void __exit pas_cpufreq_exit(
void)