12 #include <linux/kernel.h>
13 #include <linux/module.h>
14 #include <linux/sched.h>
17 #include <linux/slab.h>
30 #define SMCFS_104M (2)
31 #define SMCFS_208M (5)
33 #define SFLFS_104M (0)
34 #define SFLFS_156M (1)
35 #define SFLFS_208M (2)
36 #define SFLFS_312M (3)
38 #define XSPCLK_156M (0)
39 #define XSPCLK_NONE (3)
42 #define DMCFS_260M (3)
58 #define OP(cpufreq, _xl, _xn, _hss, _dmc, _smc, _sfl, _dfi, vcore, vsram) \
60 .cpufreq_mhz = cpufreq, \
63 .hss = HSS_##_hss##M, \
64 .dmcfs = DMCFS_##_dmc##M, \
65 .smcfs = SMCFS_##_smc##M, \
66 .sflfs = SFLFS_##_sfl##M, \
74 OP(104, 8, 1, 104, 260, 78, 104, 3, 1000, 1100),
75 OP(208, 16, 1, 104, 260, 104, 156, 2, 1000, 1100),
76 OP(416, 16, 2, 156, 260, 104, 208, 2, 1100, 1200),
77 OP(624, 24, 2, 208, 260, 208, 312, 3, 1375, 1400),
82 OP(104, 8, 1, 104, 260, 78, 104, 3, 1000, 1100),
83 OP(208, 16, 1, 104, 260, 104, 156, 2, 1000, 1100),
84 OP(416, 16, 2, 156, 260, 104, 208, 2, 1100, 1200),
85 OP(624, 24, 2, 208, 260, 208, 312, 3, 1375, 1400),
86 OP(806, 31, 2, 208, 260, 208, 312, 3, 1400, 1400),
89 static unsigned int pxa3xx_freqs_num;
99 table = kzalloc((num + 1) *
sizeof(*table),
GFP_KERNEL);
103 for (i = 0; i < num; i++) {
110 pxa3xx_freqs = freqs;
111 pxa3xx_freqs_num = num;
112 pxa3xx_freqs_table =
table;
129 xclkcfg = (info->
core_xn == 2) ? 0x3 : 0x2;
132 __asm__(
"mcr p14, 0, %0, c6, c0, 0\n" : :
"r"(xclkcfg));
134 while ((
ACSR & mask) != (accr & mask))
152 while ((
ACSR & mask) != (accr & mask))
161 static unsigned int pxa3xx_cpufreq_get(
unsigned int cpu)
167 unsigned int target_freq,
168 unsigned int relation)
175 if (policy->
cpu != 0)
180 target_freq, relation, &idx))
183 next = &pxa3xx_freqs[
idx];
185 freqs.old = policy->
cur;
187 freqs.cpu = policy->
cpu;
189 pr_debug(
"CPU frequency from %d MHz to %d MHz%s\n",
190 freqs.old / 1000, freqs.new / 1000,
191 (freqs.old == freqs.new) ?
" (skipped)" :
"");
193 if (freqs.old == target_freq)
199 __update_core_freq(next);
200 __update_bus_freq(next);
213 policy->
cpuinfo.min_freq = 104000;
215 policy->
cpuinfo.transition_latency = 1000;
226 pr_err(
"failed to setup frequency table\n");
230 pr_info(
"CPUFREQ support for PXA3xx initialized\n");
235 .verify = pxa3xx_cpufreq_verify,
236 .target = pxa3xx_cpufreq_set,
237 .init = pxa3xx_cpufreq_init,
238 .get = pxa3xx_cpufreq_get,
239 .name =
"pxa3xx-cpufreq",
242 static int __init cpufreq_init(
void)
251 static void __exit cpufreq_exit(
void)