aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/cpu-pxa.c
diff options
context:
space:
mode:
authorRobert Jarzmik <rjarzmik@free.fr>2008-05-07 15:39:06 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-05-07 16:47:40 -0400
commit592eb9997dc89cd0c8f89a505e5348bbddce70f6 (patch)
tree2f797e510ddfd3a2aa57b8de5946c846827abff3 /arch/arm/mach-pxa/cpu-pxa.c
parent3679389b880a318f9b9cfebab5714443796f2f71 (diff)
[ARM] 5032/1: Added cpufreq support for pxa27x CPU
PXA cpus maximum frequency depends on the cpu (624 for pxa270, 520 for pxa272, 416 for pxa271). It should be provided on kernel or module start (cpu-pxa pxa27x_maxfreq parameter). Make use of cpufreq_frequency_table_cpuinfo (patch by Bill Reese provided by Philipp Zabel). Some additionnal fixes from Philipp Zabel include : * rename PXA cpufreq driver to reflect added PXA27x support * remove unused variable ramstart from PXA cpufreq driver Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Robert Jarzmik <rjarzmik@free.fr> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/cpu-pxa.c')
-rw-r--r--arch/arm/mach-pxa/cpu-pxa.c266
1 files changed, 186 insertions, 80 deletions
diff --git a/arch/arm/mach-pxa/cpu-pxa.c b/arch/arm/mach-pxa/cpu-pxa.c
index 0f5660200bf9..fb9ba1ab2826 100644
--- a/arch/arm/mach-pxa/cpu-pxa.c
+++ b/arch/arm/mach-pxa/cpu-pxa.c
@@ -49,76 +49,170 @@ MODULE_PARM_DESC(freq_debug, "Set the debug messages to on=1/off=0");
49#define freq_debug 0 49#define freq_debug 0
50#endif 50#endif
51 51
52static unsigned int pxa27x_maxfreq;
53module_param(pxa27x_maxfreq, uint, 0);
54MODULE_PARM_DESC(pxa27x_maxfreq, "Set the pxa27x maxfreq in MHz"
55 "(typically 624=>pxa270, 416=>pxa271, 520=>pxa272)");
56
52typedef struct { 57typedef struct {
53 unsigned int khz; 58 unsigned int khz;
54 unsigned int membus; 59 unsigned int membus;
55 unsigned int cccr; 60 unsigned int cccr;
56 unsigned int div2; 61 unsigned int div2;
62 unsigned int cclkcfg;
57} pxa_freqs_t; 63} pxa_freqs_t;
58 64
59/* Define the refresh period in mSec for the SDRAM and the number of rows */ 65/* Define the refresh period in mSec for the SDRAM and the number of rows */
60#define SDRAM_TREF 64 /* standard 64ms SDRAM */ 66#define SDRAM_TREF 64 /* standard 64ms SDRAM */
61#define SDRAM_ROWS 4096 /* 64MB=8192 32MB=4096 */ 67#define SDRAM_ROWS 4096 /* 64MB=8192 32MB=4096 */
62#define MDREFR_DRI(x) (((x) * SDRAM_TREF) / (SDRAM_ROWS * 32))
63 68
64#define CCLKCFG_TURBO 0x1 69#define CCLKCFG_TURBO 0x1
65#define CCLKCFG_FCS 0x2 70#define CCLKCFG_FCS 0x2
66#define PXA25x_MIN_FREQ 99500 71#define CCLKCFG_HALFTURBO 0x4
67#define PXA25x_MAX_FREQ 398100 72#define CCLKCFG_FASTBUS 0x8
68#define MDREFR_DB2_MASK (MDREFR_K2DB2 | MDREFR_K1DB2) 73#define MDREFR_DB2_MASK (MDREFR_K2DB2 | MDREFR_K1DB2)
69#define MDREFR_DRI_MASK 0xFFF 74#define MDREFR_DRI_MASK 0xFFF
70 75
71 76/*
77 * PXA255 definitions
78 */
72/* Use the run mode frequencies for the CPUFREQ_POLICY_PERFORMANCE policy */ 79/* Use the run mode frequencies for the CPUFREQ_POLICY_PERFORMANCE policy */
80#define CCLKCFG CCLKCFG_TURBO | CCLKCFG_FCS
81
73static pxa_freqs_t pxa255_run_freqs[] = 82static pxa_freqs_t pxa255_run_freqs[] =
74{ 83{
75 /* CPU MEMBUS CCCR DIV2 run turbo PXbus SDRAM */ 84 /* CPU MEMBUS CCCR DIV2 CCLKCFG run turbo PXbus SDRAM */
76 { 99500, 99500, 0x121, 1}, /* 99, 99, 50, 50 */ 85 { 99500, 99500, 0x121, 1, CCLKCFG}, /* 99, 99, 50, 50 */
77 {132700, 132700, 0x123, 1}, /* 133, 133, 66, 66 */ 86 {132700, 132700, 0x123, 1, CCLKCFG}, /* 133, 133, 66, 66 */
78 {199100, 99500, 0x141, 0}, /* 199, 199, 99, 99 */ 87 {199100, 99500, 0x141, 0, CCLKCFG}, /* 199, 199, 99, 99 */
79 {265400, 132700, 0x143, 1}, /* 265, 265, 133, 66 */ 88 {265400, 132700, 0x143, 1, CCLKCFG}, /* 265, 265, 133, 66 */
80 {331800, 165900, 0x145, 1}, /* 331, 331, 166, 83 */ 89 {331800, 165900, 0x145, 1, CCLKCFG}, /* 331, 331, 166, 83 */
81 {398100, 99500, 0x161, 0}, /* 398, 398, 196, 99 */ 90 {398100, 99500, 0x161, 0, CCLKCFG}, /* 398, 398, 196, 99 */
82 {0,}
83}; 91};
84#define NUM_RUN_FREQS ARRAY_SIZE(pxa255_run_freqs)
85
86static struct cpufreq_frequency_table pxa255_run_freq_table[NUM_RUN_FREQS+1];
87 92
88/* Use the turbo mode frequencies for the CPUFREQ_POLICY_POWERSAVE policy */ 93/* Use the turbo mode frequencies for the CPUFREQ_POLICY_POWERSAVE policy */
89static pxa_freqs_t pxa255_turbo_freqs[] = 94static pxa_freqs_t pxa255_turbo_freqs[] =
90{ 95{
91 /* CPU MEMBUS CCCR DIV2 run turbo PXbus SDRAM */ 96 /* CPU MEMBUS CCCR DIV2 CCLKCFG run turbo PXbus SDRAM */
92 { 99500, 99500, 0x121, 1}, /* 99, 99, 50, 50 */ 97 { 99500, 99500, 0x121, 1, CCLKCFG}, /* 99, 99, 50, 50 */
93 {199100, 99500, 0x221, 0}, /* 99, 199, 50, 99 */ 98 {199100, 99500, 0x221, 0, CCLKCFG}, /* 99, 199, 50, 99 */
94 {298500, 99500, 0x321, 0}, /* 99, 287, 50, 99 */ 99 {298500, 99500, 0x321, 0, CCLKCFG}, /* 99, 287, 50, 99 */
95 {298600, 99500, 0x1c1, 0}, /* 199, 287, 99, 99 */ 100 {298600, 99500, 0x1c1, 0, CCLKCFG}, /* 199, 287, 99, 99 */
96 {398100, 99500, 0x241, 0}, /* 199, 398, 99, 99 */ 101 {398100, 99500, 0x241, 0, CCLKCFG}, /* 199, 398, 99, 99 */
97 {0,}
98}; 102};
99#define NUM_TURBO_FREQS ARRAY_SIZE(pxa255_turbo_freqs)
100 103
104#define NUM_PXA25x_RUN_FREQS ARRAY_SIZE(pxa255_run_freqs)
105#define NUM_PXA25x_TURBO_FREQS ARRAY_SIZE(pxa255_turbo_freqs)
106
107static struct cpufreq_frequency_table
108 pxa255_run_freq_table[NUM_PXA25x_RUN_FREQS+1];
101static struct cpufreq_frequency_table 109static struct cpufreq_frequency_table
102 pxa255_turbo_freq_table[NUM_TURBO_FREQS+1]; 110 pxa255_turbo_freq_table[NUM_PXA25x_TURBO_FREQS+1];
111
112/*
113 * PXA270 definitions
114 *
115 * For the PXA27x:
116 * Control variables are A, L, 2N for CCCR; B, HT, T for CLKCFG.
117 *
118 * A = 0 => memory controller clock from table 3-7,
119 * A = 1 => memory controller clock = system bus clock
120 * Run mode frequency = 13 MHz * L
121 * Turbo mode frequency = 13 MHz * L * N
122 * System bus frequency = 13 MHz * L / (B + 1)
123 *
124 * In CCCR:
125 * A = 1
126 * L = 16 oscillator to run mode ratio
127 * 2N = 6 2 * (turbo mode to run mode ratio)
128 *
129 * In CCLKCFG:
130 * B = 1 Fast bus mode
131 * HT = 0 Half-Turbo mode
132 * T = 1 Turbo mode
133 *
134 * For now, just support some of the combinations in table 3-7 of
135 * PXA27x Processor Family Developer's Manual to simplify frequency
136 * change sequences.
137 */
138#define PXA27x_CCCR(A, L, N2) (A << 25 | N2 << 7 | L)
139#define CCLKCFG2(B, HT, T) \
140 (CCLKCFG_FCS | \
141 ((B) ? CCLKCFG_FASTBUS : 0) | \
142 ((HT) ? CCLKCFG_HALFTURBO : 0) | \
143 ((T) ? CCLKCFG_TURBO : 0))
144
145static pxa_freqs_t pxa27x_freqs[] = {
146 {104000, 104000, PXA27x_CCCR(1, 8, 2), 0, CCLKCFG2(1, 0, 1)},
147 {156000, 104000, PXA27x_CCCR(1, 8, 6), 0, CCLKCFG2(1, 1, 1)},
148 {208000, 208000, PXA27x_CCCR(0, 16, 2), 1, CCLKCFG2(0, 0, 1)},
149 {312000, 208000, PXA27x_CCCR(1, 16, 3), 1, CCLKCFG2(1, 0, 1)},
150 {416000, 208000, PXA27x_CCCR(1, 16, 4), 1, CCLKCFG2(1, 0, 1)},
151 {520000, 208000, PXA27x_CCCR(1, 16, 5), 1, CCLKCFG2(1, 0, 1)},
152 {624000, 208000, PXA27x_CCCR(1, 16, 6), 1, CCLKCFG2(1, 0, 1)}
153};
154
155#define NUM_PXA27x_FREQS ARRAY_SIZE(pxa27x_freqs)
156static struct cpufreq_frequency_table
157 pxa27x_freq_table[NUM_PXA27x_FREQS+1];
103 158
104extern unsigned get_clk_frequency_khz(int info); 159extern unsigned get_clk_frequency_khz(int info);
105 160
161static void find_freq_tables(struct cpufreq_policy *policy,
162 struct cpufreq_frequency_table **freq_table,
163 pxa_freqs_t **pxa_freqs)
164{
165 if (cpu_is_pxa25x()) {
166 if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
167 *pxa_freqs = pxa255_run_freqs;
168 *freq_table = pxa255_run_freq_table;
169 } else if (policy->policy == CPUFREQ_POLICY_POWERSAVE) {
170 *pxa_freqs = pxa255_turbo_freqs;
171 *freq_table = pxa255_turbo_freq_table;
172 } else {
173 printk("CPU PXA: Unknown policy found. "
174 "Using CPUFREQ_POLICY_PERFORMANCE\n");
175 *pxa_freqs = pxa255_run_freqs;
176 *freq_table = pxa255_run_freq_table;
177 }
178 }
179 if (cpu_is_pxa27x()) {
180 *pxa_freqs = pxa27x_freqs;
181 *freq_table = pxa27x_freq_table;
182 }
183}
184
185static void pxa27x_guess_max_freq(void)
186{
187 if (!pxa27x_maxfreq) {
188 pxa27x_maxfreq = 416000;
189 printk(KERN_INFO "PXA CPU 27x max frequency not defined "
190 "(pxa27x_maxfreq), assuming pxa271 with %dkHz maxfreq\n",
191 pxa27x_maxfreq);
192 } else {
193 pxa27x_maxfreq *= 1000;
194 }
195}
196
197static u32 mdrefr_dri(unsigned int freq)
198{
199 u32 dri = 0;
200
201 if (cpu_is_pxa25x())
202 dri = ((freq * SDRAM_TREF) / (SDRAM_ROWS * 32));
203 if (cpu_is_pxa27x())
204 dri = ((freq * SDRAM_TREF) / (SDRAM_ROWS - 31)) / 32;
205 return dri;
206}
207
106/* find a valid frequency point */ 208/* find a valid frequency point */
107static int pxa_verify_policy(struct cpufreq_policy *policy) 209static int pxa_verify_policy(struct cpufreq_policy *policy)
108{ 210{
109 struct cpufreq_frequency_table *pxa_freqs_table; 211 struct cpufreq_frequency_table *pxa_freqs_table;
212 pxa_freqs_t *pxa_freqs;
110 int ret; 213 int ret;
111 214
112 if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) { 215 find_freq_tables(policy, &pxa_freqs_table, &pxa_freqs);
113 pxa_freqs_table = pxa255_run_freq_table;
114 } else if (policy->policy == CPUFREQ_POLICY_POWERSAVE) {
115 pxa_freqs_table = pxa255_turbo_freq_table;
116 } else {
117 printk("CPU PXA: Unknown policy found. "
118 "Using CPUFREQ_POLICY_PERFORMANCE\n");
119 pxa_freqs_table = pxa255_run_freq_table;
120 }
121
122 ret = cpufreq_frequency_table_verify(policy, pxa_freqs_table); 216 ret = cpufreq_frequency_table_verify(policy, pxa_freqs_table);
123 217
124 if (freq_debug) 218 if (freq_debug)
@@ -128,6 +222,11 @@ static int pxa_verify_policy(struct cpufreq_policy *policy)
128 return ret; 222 return ret;
129} 223}
130 224
225static unsigned int pxa_cpufreq_get(unsigned int cpu)
226{
227 return get_clk_frequency_khz(0);
228}
229
131static int pxa_set_target(struct cpufreq_policy *policy, 230static int pxa_set_target(struct cpufreq_policy *policy,
132 unsigned int target_freq, 231 unsigned int target_freq,
133 unsigned int relation) 232 unsigned int relation)
@@ -137,22 +236,11 @@ static int pxa_set_target(struct cpufreq_policy *policy,
137 struct cpufreq_freqs freqs; 236 struct cpufreq_freqs freqs;
138 unsigned int idx; 237 unsigned int idx;
139 unsigned long flags; 238 unsigned long flags;
140 unsigned int unused, preset_mdrefr, postset_mdrefr; 239 unsigned int new_freq_cpu, new_freq_mem;
141 void *ramstart = phys_to_virt(0xa0000000); 240 unsigned int unused, preset_mdrefr, postset_mdrefr, cclkcfg;
142 241
143 /* Get the current policy */ 242 /* Get the current policy */
144 if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) { 243 find_freq_tables(policy, &pxa_freqs_table, &pxa_freq_settings);
145 pxa_freq_settings = pxa255_run_freqs;
146 pxa_freqs_table = pxa255_run_freq_table;
147 } else if (policy->policy == CPUFREQ_POLICY_POWERSAVE) {
148 pxa_freq_settings = pxa255_turbo_freqs;
149 pxa_freqs_table = pxa255_turbo_freq_table;
150 } else {
151 printk("CPU PXA: Unknown policy found. "
152 "Using CPUFREQ_POLICY_PERFORMANCE\n");
153 pxa_freq_settings = pxa255_run_freqs;
154 pxa_freqs_table = pxa255_run_freq_table;
155 }
156 244
157 /* Lookup the next frequency */ 245 /* Lookup the next frequency */
158 if (cpufreq_frequency_table_target(policy, pxa_freqs_table, 246 if (cpufreq_frequency_table_target(policy, pxa_freqs_table,
@@ -160,16 +248,17 @@ static int pxa_set_target(struct cpufreq_policy *policy,
160 return -EINVAL; 248 return -EINVAL;
161 } 249 }
162 250
251 new_freq_cpu = pxa_freq_settings[idx].khz;
252 new_freq_mem = pxa_freq_settings[idx].membus;
163 freqs.old = policy->cur; 253 freqs.old = policy->cur;
164 freqs.new = pxa_freq_settings[idx].khz; 254 freqs.new = new_freq_cpu;
165 freqs.cpu = policy->cpu; 255 freqs.cpu = policy->cpu;
166 256
167 if (freq_debug) 257 if (freq_debug)
168 pr_debug(KERN_INFO "Changing CPU frequency to %d Mhz, " 258 pr_debug(KERN_INFO "Changing CPU frequency to %d Mhz, "
169 "(SDRAM %d Mhz)\n", 259 "(SDRAM %d Mhz)\n",
170 freqs.new / 1000, (pxa_freq_settings[idx].div2) ? 260 freqs.new / 1000, (pxa_freq_settings[idx].div2) ?
171 (pxa_freq_settings[idx].membus / 2000) : 261 (new_freq_mem / 2000) : (new_freq_mem / 1000));
172 (pxa_freq_settings[idx].membus / 1000));
173 262
174 /* 263 /*
175 * Tell everyone what we're about to do... 264 * Tell everyone what we're about to do...
@@ -183,13 +272,12 @@ static int pxa_set_target(struct cpufreq_policy *policy,
183 * speeding up we need to set the larger DRI value after the change. 272 * speeding up we need to set the larger DRI value after the change.
184 */ 273 */
185 preset_mdrefr = postset_mdrefr = MDREFR; 274 preset_mdrefr = postset_mdrefr = MDREFR;
186 if ((MDREFR & MDREFR_DRI_MASK) > 275 if ((MDREFR & MDREFR_DRI_MASK) > mdrefr_dri(new_freq_mem)) {
187 MDREFR_DRI(pxa_freq_settings[idx].membus)) { 276 preset_mdrefr = (preset_mdrefr & ~MDREFR_DRI_MASK);
188 preset_mdrefr = (preset_mdrefr & ~MDREFR_DRI_MASK) | 277 preset_mdrefr |= mdrefr_dri(new_freq_mem);
189 MDREFR_DRI(pxa_freq_settings[idx].membus);
190 } 278 }
191 postset_mdrefr = (postset_mdrefr & ~MDREFR_DRI_MASK) | 279 postset_mdrefr =
192 MDREFR_DRI(pxa_freq_settings[idx].membus); 280 (postset_mdrefr & ~MDREFR_DRI_MASK) | mdrefr_dri(new_freq_mem);
193 281
194 /* If we're dividing the memory clock by two for the SDRAM clock, this 282 /* If we're dividing the memory clock by two for the SDRAM clock, this
195 * must be set prior to the change. Clearing the divide must be done 283 * must be set prior to the change. Clearing the divide must be done
@@ -204,25 +292,26 @@ static int pxa_set_target(struct cpufreq_policy *policy,
204 292
205 local_irq_save(flags); 293 local_irq_save(flags);
206 294
207 /* Set new the CCCR */ 295 /* Set new the CCCR and prepare CCLKCFG */
208 CCCR = pxa_freq_settings[idx].cccr; 296 CCCR = pxa_freq_settings[idx].cccr;
297 cclkcfg = pxa_freq_settings[idx].cclkcfg;
209 298
210 asm volatile(" \n\ 299 asm volatile(" \n\
211 ldr r4, [%1] /* load MDREFR */ \n\ 300 ldr r4, [%1] /* load MDREFR */ \n\
212 b 2f \n\ 301 b 2f \n\
213 .align 5 \n\ 302 .align 5 \n\
2141: \n\ 3031: \n\
215 str %4, [%1] /* preset the MDREFR */ \n\ 304 str %3, [%1] /* preset the MDREFR */ \n\
216 mcr p14, 0, %2, c6, c0, 0 /* set CCLKCFG[FCS] */ \n\ 305 mcr p14, 0, %2, c6, c0, 0 /* set CCLKCFG[FCS] */ \n\
217 str %5, [%1] /* postset the MDREFR */ \n\ 306 str %4, [%1] /* postset the MDREFR */ \n\
218 \n\ 307 \n\
219 b 3f \n\ 308 b 3f \n\
2202: b 1b \n\ 3092: b 1b \n\
2213: nop \n\ 3103: nop \n\
222 " 311 "
223 : "=&r" (unused) 312 : "=&r" (unused)
224 : "r" (&MDREFR), "r" (CCLKCFG_TURBO|CCLKCFG_FCS), "r" (ramstart), 313 : "r" (&MDREFR), "r" (cclkcfg),
225 "r" (preset_mdrefr), "r" (postset_mdrefr) 314 "r" (preset_mdrefr), "r" (postset_mdrefr)
226 : "r4", "r5"); 315 : "r4", "r5");
227 local_irq_restore(flags); 316 local_irq_restore(flags);
228 317
@@ -236,39 +325,57 @@ static int pxa_set_target(struct cpufreq_policy *policy,
236 return 0; 325 return 0;
237} 326}
238 327
239static unsigned int pxa_cpufreq_get(unsigned int cpu) 328static __init int pxa_cpufreq_init(struct cpufreq_policy *policy)
240{
241 return get_clk_frequency_khz(0);
242}
243
244static int pxa_cpufreq_init(struct cpufreq_policy *policy)
245{ 329{
246 int i; 330 int i;
331 unsigned int freq;
332
333 /* try to guess pxa27x cpu */
334 if (cpu_is_pxa27x())
335 pxa27x_guess_max_freq();
247 336
248 /* set default policy and cpuinfo */ 337 /* set default policy and cpuinfo */
249 policy->governor = CPUFREQ_DEFAULT_GOVERNOR; 338 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
250 policy->policy = CPUFREQ_POLICY_PERFORMANCE; 339 if (cpu_is_pxa25x())
251 policy->cpuinfo.max_freq = PXA25x_MAX_FREQ; 340 policy->policy = CPUFREQ_POLICY_PERFORMANCE;
252 policy->cpuinfo.min_freq = PXA25x_MIN_FREQ;
253 policy->cpuinfo.transition_latency = 1000; /* FIXME: 1 ms, assumed */ 341 policy->cpuinfo.transition_latency = 1000; /* FIXME: 1 ms, assumed */
254 policy->cur = get_clk_frequency_khz(0); /* current freq */ 342 policy->cur = get_clk_frequency_khz(0); /* current freq */
255 policy->min = policy->max = policy->cur; 343 policy->min = policy->max = policy->cur;
256 344
257 /* Generate the run cpufreq_frequency_table struct */ 345 /* Generate pxa25x the run cpufreq_frequency_table struct */
258 for (i = 0; i < NUM_RUN_FREQS; i++) { 346 for (i = 0; i < NUM_PXA25x_RUN_FREQS; i++) {
259 pxa255_run_freq_table[i].frequency = pxa255_run_freqs[i].khz; 347 pxa255_run_freq_table[i].frequency = pxa255_run_freqs[i].khz;
260 pxa255_run_freq_table[i].index = i; 348 pxa255_run_freq_table[i].index = i;
261 } 349 }
262
263 pxa255_run_freq_table[i].frequency = CPUFREQ_TABLE_END; 350 pxa255_run_freq_table[i].frequency = CPUFREQ_TABLE_END;
264 /* Generate the turbo cpufreq_frequency_table struct */ 351
265 for (i = 0; i < NUM_TURBO_FREQS; i++) { 352 /* Generate pxa25x the turbo cpufreq_frequency_table struct */
353 for (i = 0; i < NUM_PXA25x_TURBO_FREQS; i++) {
266 pxa255_turbo_freq_table[i].frequency = 354 pxa255_turbo_freq_table[i].frequency =
267 pxa255_turbo_freqs[i].khz; 355 pxa255_turbo_freqs[i].khz;
268 pxa255_turbo_freq_table[i].index = i; 356 pxa255_turbo_freq_table[i].index = i;
269 } 357 }
270 pxa255_turbo_freq_table[i].frequency = CPUFREQ_TABLE_END; 358 pxa255_turbo_freq_table[i].frequency = CPUFREQ_TABLE_END;
271 359
360 /* Generate the pxa27x cpufreq_frequency_table struct */
361 for (i = 0; i < NUM_PXA27x_FREQS; i++) {
362 freq = pxa27x_freqs[i].khz;
363 if (freq > pxa27x_maxfreq)
364 break;
365 pxa27x_freq_table[i].frequency = freq;
366 pxa27x_freq_table[i].index = i;
367 }
368 pxa27x_freq_table[i].frequency = CPUFREQ_TABLE_END;
369
370 /*
371 * Set the policy's minimum and maximum frequencies from the tables
372 * just constructed. This sets cpuinfo.mxx_freq, min and max.
373 */
374 if (cpu_is_pxa25x())
375 cpufreq_frequency_table_cpuinfo(policy, pxa255_run_freq_table);
376 else if (cpu_is_pxa27x())
377 cpufreq_frequency_table_cpuinfo(policy, pxa27x_freq_table);
378
272 printk(KERN_INFO "PXA CPU frequency change support initialized\n"); 379 printk(KERN_INFO "PXA CPU frequency change support initialized\n");
273 380
274 return 0; 381 return 0;
@@ -279,21 +386,20 @@ static struct cpufreq_driver pxa_cpufreq_driver = {
279 .target = pxa_set_target, 386 .target = pxa_set_target,
280 .init = pxa_cpufreq_init, 387 .init = pxa_cpufreq_init,
281 .get = pxa_cpufreq_get, 388 .get = pxa_cpufreq_get,
282 .name = "PXA25x", 389 .name = "PXA2xx",
283}; 390};
284 391
285static int __init pxa_cpu_init(void) 392static int __init pxa_cpu_init(void)
286{ 393{
287 int ret = -ENODEV; 394 int ret = -ENODEV;
288 if (cpu_is_pxa25x()) 395 if (cpu_is_pxa25x() || cpu_is_pxa27x())
289 ret = cpufreq_register_driver(&pxa_cpufreq_driver); 396 ret = cpufreq_register_driver(&pxa_cpufreq_driver);
290 return ret; 397 return ret;
291} 398}
292 399
293static void __exit pxa_cpu_exit(void) 400static void __exit pxa_cpu_exit(void)
294{ 401{
295 if (cpu_is_pxa25x()) 402 cpufreq_unregister_driver(&pxa_cpufreq_driver);
296 cpufreq_unregister_driver(&pxa_cpufreq_driver);
297} 403}
298 404
299 405