16 #include <linux/kernel.h>
17 #include <linux/module.h>
22 #include <linux/timex.h>
28 #define MMCR_BASE 0xfffef000
29 #define OFFS_CPUCTL 0x2
33 #define PFX "sc520_freq: "
41 static unsigned int sc520_freq_get_cpu_frequency(
unsigned int cpu)
43 u8 clockspeed_reg = *cpuctl;
45 switch (clockspeed_reg & 0x03) {
48 "value %02x\n", clockspeed_reg);
56 static void sc520_freq_set_cpu_state(
unsigned int state)
62 freqs.
old = sc520_freq_get_cpu_frequency(0);
68 pr_debug(
"attempting to set frequency to %i kHz\n",
73 clockspeed_reg = *cpuctl & ~0x03;
74 *cpuctl = clockspeed_reg | sc520_freq_table[
state].
index;
87 unsigned int target_freq,
88 unsigned int relation)
90 unsigned int newstate = 0;
93 target_freq, relation, &newstate))
96 sc520_freq_set_cpu_state(newstate);
117 policy->
cpuinfo.transition_latency = 1000000;
118 policy->
cur = sc520_freq_get_cpu_frequency(0);
137 static struct freq_attr *sc520_freq_attr[] = {
144 .get = sc520_freq_get_cpu_frequency,
145 .verify = sc520_freq_verify,
146 .target = sc520_freq_target,
147 .init = sc520_freq_cpu_init,
148 .exit = sc520_freq_cpu_exit,
149 .name =
"sc520_freq",
151 .attr = sc520_freq_attr,
154 static const struct x86_cpu_id sc520_ids[] = {
160 static int __init sc520_freq_init(
void)
181 static void __exit sc520_freq_exit(
void)