aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorVaibhav Hiremath <hvaibhav@ti.com>2011-12-19 05:20:14 -0500
committerTony Lindgren <tony@atomide.com>2011-12-19 18:40:54 -0500
commit50a01e6440020877c2f71bc5ac4d818d9b8f31c1 (patch)
tree51be55e6d91180b570d221de2472ce261a40815c /arch
parent4390f5b2cb1f568c1d4b3e5bbf57158f6809627a (diff)
ARM: OMAP2+: Make cpu_rev static global variable
As part of omap revision code cleanup, make cpu_rev variable static global to the file (id.c). This is needed so we can split the SoC detection from SoC feature detection in the following patch. Also move omap3_cpuinfo function a bit as that will be shared by other omap3 like SoCs. Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com> [tony@atomide.com: updated comments] Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/id.c146
1 files changed, 72 insertions, 74 deletions
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 6c5826605eae..752dcae8f78a 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -29,7 +29,7 @@
29#include "control.h" 29#include "control.h"
30 30
31static unsigned int omap_revision; 31static unsigned int omap_revision;
32 32static const char *cpu_rev;
33u32 omap_features; 33u32 omap_features;
34 34
35unsigned int omap_rev(void) 35unsigned int omap_rev(void)
@@ -166,6 +166,56 @@ static void __init omap24xx_check_revision(void)
166 pr_info("\n"); 166 pr_info("\n");
167} 167}
168 168
169#define OMAP3_SHOW_FEATURE(feat) \
170 if (omap3_has_ ##feat()) \
171 printk(#feat" ");
172
173static void __init omap3_cpuinfo(void)
174{
175 const char *cpu_name;
176
177 /*
178 * OMAP3430 and OMAP3530 are assumed to be same.
179 *
180 * OMAP3525, OMAP3515 and OMAP3503 can be detected only based
181 * on available features. Upon detection, update the CPU id
182 * and CPU class bits.
183 */
184 if (cpu_is_omap3630()) {
185 cpu_name = "OMAP3630";
186 } else if (cpu_is_omap3517()) {
187 /* AM35xx devices */
188 cpu_name = (omap3_has_sgx()) ? "AM3517" : "AM3505";
189 } else if (cpu_is_ti816x()) {
190 cpu_name = "TI816X";
191 } else if (cpu_is_am335x()) {
192 cpu_name = "AM335X";
193 } else if (cpu_is_ti814x()) {
194 cpu_name = "TI814X";
195 } else if (omap3_has_iva() && omap3_has_sgx()) {
196 /* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */
197 cpu_name = "OMAP3430/3530";
198 } else if (omap3_has_iva()) {
199 cpu_name = "OMAP3525";
200 } else if (omap3_has_sgx()) {
201 cpu_name = "OMAP3515";
202 } else {
203 cpu_name = "OMAP3503";
204 }
205
206 /* Print verbose information */
207 pr_info("%s ES%s (", cpu_name, cpu_rev);
208
209 OMAP3_SHOW_FEATURE(l2cache);
210 OMAP3_SHOW_FEATURE(iva);
211 OMAP3_SHOW_FEATURE(sgx);
212 OMAP3_SHOW_FEATURE(neon);
213 OMAP3_SHOW_FEATURE(isp);
214 OMAP3_SHOW_FEATURE(192mhz_clk);
215
216 printk(")\n");
217}
218
169#define OMAP3_CHECK_FEATURE(status,feat) \ 219#define OMAP3_CHECK_FEATURE(status,feat) \
170 if (((status & OMAP3_ ##feat## _MASK) \ 220 if (((status & OMAP3_ ##feat## _MASK) \
171 >> OMAP3_ ##feat## _SHIFT) != FEAT_ ##feat## _NONE) { \ 221 >> OMAP3_ ##feat## _SHIFT) != FEAT_ ##feat## _NONE) { \
@@ -231,7 +281,7 @@ static void __init ti81xx_check_features(void)
231 omap_features = OMAP3_HAS_NEON; 281 omap_features = OMAP3_HAS_NEON;
232} 282}
233 283
234static void __init omap3_check_revision(const char **cpu_rev) 284static void __init omap3_check_revision(void)
235{ 285{
236 u32 cpuid, idcode; 286 u32 cpuid, idcode;
237 u16 hawkeye; 287 u16 hawkeye;
@@ -245,7 +295,7 @@ static void __init omap3_check_revision(const char **cpu_rev)
245 cpuid = read_cpuid(CPUID_ID); 295 cpuid = read_cpuid(CPUID_ID);
246 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) { 296 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
247 omap_revision = OMAP3430_REV_ES1_0; 297 omap_revision = OMAP3430_REV_ES1_0;
248 *cpu_rev = "1.0"; 298 cpu_rev = "1.0";
249 return; 299 return;
250 } 300 }
251 301
@@ -266,26 +316,26 @@ static void __init omap3_check_revision(const char **cpu_rev)
266 case 0: /* Take care of early samples */ 316 case 0: /* Take care of early samples */
267 case 1: 317 case 1:
268 omap_revision = OMAP3430_REV_ES2_0; 318 omap_revision = OMAP3430_REV_ES2_0;
269 *cpu_rev = "2.0"; 319 cpu_rev = "2.0";
270 break; 320 break;
271 case 2: 321 case 2:
272 omap_revision = OMAP3430_REV_ES2_1; 322 omap_revision = OMAP3430_REV_ES2_1;
273 *cpu_rev = "2.1"; 323 cpu_rev = "2.1";
274 break; 324 break;
275 case 3: 325 case 3:
276 omap_revision = OMAP3430_REV_ES3_0; 326 omap_revision = OMAP3430_REV_ES3_0;
277 *cpu_rev = "3.0"; 327 cpu_rev = "3.0";
278 break; 328 break;
279 case 4: 329 case 4:
280 omap_revision = OMAP3430_REV_ES3_1; 330 omap_revision = OMAP3430_REV_ES3_1;
281 *cpu_rev = "3.1"; 331 cpu_rev = "3.1";
282 break; 332 break;
283 case 7: 333 case 7:
284 /* FALLTHROUGH */ 334 /* FALLTHROUGH */
285 default: 335 default:
286 /* Use the latest known revision as default */ 336 /* Use the latest known revision as default */
287 omap_revision = OMAP3430_REV_ES3_1_2; 337 omap_revision = OMAP3430_REV_ES3_1_2;
288 *cpu_rev = "3.1.2"; 338 cpu_rev = "3.1.2";
289 } 339 }
290 break; 340 break;
291 case 0xb868: 341 case 0xb868:
@@ -298,13 +348,13 @@ static void __init omap3_check_revision(const char **cpu_rev)
298 switch (rev) { 348 switch (rev) {
299 case 0: 349 case 0:
300 omap_revision = OMAP3517_REV_ES1_0; 350 omap_revision = OMAP3517_REV_ES1_0;
301 *cpu_rev = "1.0"; 351 cpu_rev = "1.0";
302 break; 352 break;
303 case 1: 353 case 1:
304 /* FALLTHROUGH */ 354 /* FALLTHROUGH */
305 default: 355 default:
306 omap_revision = OMAP3517_REV_ES1_1; 356 omap_revision = OMAP3517_REV_ES1_1;
307 *cpu_rev = "1.1"; 357 cpu_rev = "1.1";
308 } 358 }
309 break; 359 break;
310 case 0xb891: 360 case 0xb891:
@@ -313,60 +363,60 @@ static void __init omap3_check_revision(const char **cpu_rev)
313 switch(rev) { 363 switch(rev) {
314 case 0: /* Take care of early samples */ 364 case 0: /* Take care of early samples */
315 omap_revision = OMAP3630_REV_ES1_0; 365 omap_revision = OMAP3630_REV_ES1_0;
316 *cpu_rev = "1.0"; 366 cpu_rev = "1.0";
317 break; 367 break;
318 case 1: 368 case 1:
319 omap_revision = OMAP3630_REV_ES1_1; 369 omap_revision = OMAP3630_REV_ES1_1;
320 *cpu_rev = "1.1"; 370 cpu_rev = "1.1";
321 break; 371 break;
322 case 2: 372 case 2:
323 /* FALLTHROUGH */ 373 /* FALLTHROUGH */
324 default: 374 default:
325 omap_revision = OMAP3630_REV_ES1_2; 375 omap_revision = OMAP3630_REV_ES1_2;
326 *cpu_rev = "1.2"; 376 cpu_rev = "1.2";
327 } 377 }
328 break; 378 break;
329 case 0xb81e: 379 case 0xb81e:
330 switch (rev) { 380 switch (rev) {
331 case 0: 381 case 0:
332 omap_revision = TI8168_REV_ES1_0; 382 omap_revision = TI8168_REV_ES1_0;
333 *cpu_rev = "1.0"; 383 cpu_rev = "1.0";
334 break; 384 break;
335 case 1: 385 case 1:
336 /* FALLTHROUGH */ 386 /* FALLTHROUGH */
337 default: 387 default:
338 omap_revision = TI8168_REV_ES1_1; 388 omap_revision = TI8168_REV_ES1_1;
339 *cpu_rev = "1.1"; 389 cpu_rev = "1.1";
340 break; 390 break;
341 } 391 }
342 break; 392 break;
343 case 0xb944: 393 case 0xb944:
344 omap_revision = AM335X_REV_ES1_0; 394 omap_revision = AM335X_REV_ES1_0;
345 *cpu_rev = "1.0"; 395 cpu_rev = "1.0";
346 case 0xb8f2: 396 case 0xb8f2:
347 switch (rev) { 397 switch (rev) {
348 case 0: 398 case 0:
349 /* FALLTHROUGH */ 399 /* FALLTHROUGH */
350 case 1: 400 case 1:
351 omap_revision = TI8148_REV_ES1_0; 401 omap_revision = TI8148_REV_ES1_0;
352 *cpu_rev = "1.0"; 402 cpu_rev = "1.0";
353 break; 403 break;
354 case 2: 404 case 2:
355 omap_revision = TI8148_REV_ES2_0; 405 omap_revision = TI8148_REV_ES2_0;
356 *cpu_rev = "2.0"; 406 cpu_rev = "2.0";
357 break; 407 break;
358 case 3: 408 case 3:
359 /* FALLTHROUGH */ 409 /* FALLTHROUGH */
360 default: 410 default:
361 omap_revision = TI8148_REV_ES2_1; 411 omap_revision = TI8148_REV_ES2_1;
362 *cpu_rev = "2.1"; 412 cpu_rev = "2.1";
363 break; 413 break;
364 } 414 }
365 break; 415 break;
366 default: 416 default:
367 /* Unknown default to latest silicon rev as default */ 417 /* Unknown default to latest silicon rev as default */
368 omap_revision = OMAP3630_REV_ES1_2; 418 omap_revision = OMAP3630_REV_ES1_2;
369 *cpu_rev = "1.2"; 419 cpu_rev = "1.2";
370 pr_warn("Warning: unknown chip type; assuming OMAP3630ES1.2\n"); 420 pr_warn("Warning: unknown chip type; assuming OMAP3630ES1.2\n");
371 } 421 }
372} 422}
@@ -444,63 +494,11 @@ static void __init omap4_check_revision(void)
444 ((omap_rev() >> 12) & 0xf), ((omap_rev() >> 8) & 0xf)); 494 ((omap_rev() >> 12) & 0xf), ((omap_rev() >> 8) & 0xf));
445} 495}
446 496
447#define OMAP3_SHOW_FEATURE(feat) \
448 if (omap3_has_ ##feat()) \
449 printk(#feat" ");
450
451static void __init omap3_cpuinfo(const char *cpu_rev)
452{
453 const char *cpu_name;
454
455 /*
456 * OMAP3430 and OMAP3530 are assumed to be same.
457 *
458 * OMAP3525, OMAP3515 and OMAP3503 can be detected only based
459 * on available features. Upon detection, update the CPU id
460 * and CPU class bits.
461 */
462 if (cpu_is_omap3630()) {
463 cpu_name = "OMAP3630";
464 } else if (cpu_is_omap3517()) {
465 /* AM35xx devices */
466 cpu_name = (omap3_has_sgx()) ? "AM3517" : "AM3505";
467 } else if (cpu_is_ti816x()) {
468 cpu_name = "TI816X";
469 } else if (cpu_is_am335x()) {
470 cpu_name = "AM335X";
471 } else if (cpu_is_ti814x()) {
472 cpu_name = "TI814X";
473 } else if (omap3_has_iva() && omap3_has_sgx()) {
474 /* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */
475 cpu_name = "OMAP3430/3530";
476 } else if (omap3_has_iva()) {
477 cpu_name = "OMAP3525";
478 } else if (omap3_has_sgx()) {
479 cpu_name = "OMAP3515";
480 } else {
481 cpu_name = "OMAP3503";
482 }
483
484 /* Print verbose information */
485 pr_info("%s ES%s (", cpu_name, cpu_rev);
486
487 OMAP3_SHOW_FEATURE(l2cache);
488 OMAP3_SHOW_FEATURE(iva);
489 OMAP3_SHOW_FEATURE(sgx);
490 OMAP3_SHOW_FEATURE(neon);
491 OMAP3_SHOW_FEATURE(isp);
492 OMAP3_SHOW_FEATURE(192mhz_clk);
493
494 printk(")\n");
495}
496
497/* 497/*
498 * Try to detect the exact revision of the omap we're running on 498 * Try to detect the exact revision of the omap we're running on
499 */ 499 */
500void __init omap2_check_revision(void) 500void __init omap2_check_revision(void)
501{ 501{
502 const char *cpu_rev;
503
504 /* 502 /*
505 * At this point we have an idea about the processor revision set 503 * At this point we have an idea about the processor revision set
506 * earlier with omap2_set_globals_tap(). 504 * earlier with omap2_set_globals_tap().
@@ -508,7 +506,7 @@ void __init omap2_check_revision(void)
508 if (cpu_is_omap24xx()) { 506 if (cpu_is_omap24xx()) {
509 omap24xx_check_revision(); 507 omap24xx_check_revision();
510 } else if (cpu_is_omap34xx()) { 508 } else if (cpu_is_omap34xx()) {
511 omap3_check_revision(&cpu_rev); 509 omap3_check_revision();
512 510
513 /* TI81XX doesn't have feature register */ 511 /* TI81XX doesn't have feature register */
514 if (!cpu_is_ti81xx()) 512 if (!cpu_is_ti81xx())
@@ -516,7 +514,7 @@ void __init omap2_check_revision(void)
516 else 514 else
517 ti81xx_check_features(); 515 ti81xx_check_features();
518 516
519 omap3_cpuinfo(cpu_rev); 517 omap3_cpuinfo();
520 return; 518 return;
521 } else if (cpu_is_omap44xx()) { 519 } else if (cpu_is_omap44xx()) {
522 omap4_check_revision(); 520 omap4_check_revision();