aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2011-09-13 21:52:15 -0400
committerPaul Walmsley <paul@pwsan.com>2011-09-14 17:44:55 -0400
commit3b32b7d62e9800579e591553875e5ff60be15546 (patch)
tree74d685ede75dd4907e7f10aa8fcff080f581412f /arch/arm/mach-omap2
parent51ec811a292eba77c1df00d9d6416526b1ce7972 (diff)
OMAP3: id: remove duplicate code for testing SoC ES level
omap3_cpuinfo() contains essentially duplicated code from omap3_check_revision(), just for the purpose of determining the chip ES level. Set the cpu_rev char array pointer in omap3_check_revision() instead, and drop the now-useless code from omap3_cpuinfo(). Signed-off-by: Paul Walmsley <paul@pwsan.com> Tested-by: Igor Grinberg <grinberg@compulab.co.il> Tested-by: Abhilash Koyamangalath <abhilash.kv@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/id.c80
1 files changed, 23 insertions, 57 deletions
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 3f4a0d0395e..ed1d43923d1 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -242,7 +242,7 @@ static void __init ti816x_check_features(void)
242 omap_features = OMAP3_HAS_NEON; 242 omap_features = OMAP3_HAS_NEON;
243} 243}
244 244
245static void __init omap3_check_revision(void) 245static void __init omap3_check_revision(const char **cpu_rev)
246{ 246{
247 u32 cpuid, idcode; 247 u32 cpuid, idcode;
248 u16 hawkeye; 248 u16 hawkeye;
@@ -259,6 +259,7 @@ static void __init omap3_check_revision(void)
259 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) { 259 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
260 omap_revision = OMAP3430_REV_ES1_0; 260 omap_revision = OMAP3430_REV_ES1_0;
261 omap_chip.oc |= CHIP_IS_OMAP3430ES1; 261 omap_chip.oc |= CHIP_IS_OMAP3430ES1;
262 *cpu_rev = "1.0";
262 return; 263 return;
263 } 264 }
264 265
@@ -280,18 +281,22 @@ static void __init omap3_check_revision(void)
280 case 1: 281 case 1:
281 omap_revision = OMAP3430_REV_ES2_0; 282 omap_revision = OMAP3430_REV_ES2_0;
282 omap_chip.oc |= CHIP_IS_OMAP3430ES2; 283 omap_chip.oc |= CHIP_IS_OMAP3430ES2;
284 *cpu_rev = "2.0";
283 break; 285 break;
284 case 2: 286 case 2:
285 omap_revision = OMAP3430_REV_ES2_1; 287 omap_revision = OMAP3430_REV_ES2_1;
286 omap_chip.oc |= CHIP_IS_OMAP3430ES2; 288 omap_chip.oc |= CHIP_IS_OMAP3430ES2;
289 *cpu_rev = "2.1";
287 break; 290 break;
288 case 3: 291 case 3:
289 omap_revision = OMAP3430_REV_ES3_0; 292 omap_revision = OMAP3430_REV_ES3_0;
290 omap_chip.oc |= CHIP_IS_OMAP3430ES3_0; 293 omap_chip.oc |= CHIP_IS_OMAP3430ES3_0;
294 *cpu_rev = "3.0";
291 break; 295 break;
292 case 4: 296 case 4:
293 omap_revision = OMAP3430_REV_ES3_1; 297 omap_revision = OMAP3430_REV_ES3_1;
294 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1; 298 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
299 *cpu_rev = "3.1";
295 break; 300 break;
296 case 7: 301 case 7:
297 /* FALLTHROUGH */ 302 /* FALLTHROUGH */
@@ -301,6 +306,7 @@ static void __init omap3_check_revision(void)
301 306
302 /* REVISIT: Add CHIP_IS_OMAP3430ES3_1_2? */ 307 /* REVISIT: Add CHIP_IS_OMAP3430ES3_1_2? */
303 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1; 308 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
309 *cpu_rev = "3.1.2";
304 } 310 }
305 break; 311 break;
306 case 0xb868: 312 case 0xb868:
@@ -315,11 +321,13 @@ static void __init omap3_check_revision(void)
315 switch (rev) { 321 switch (rev) {
316 case 0: 322 case 0:
317 omap_revision = OMAP3517_REV_ES1_0; 323 omap_revision = OMAP3517_REV_ES1_0;
324 *cpu_rev = "1.0";
318 break; 325 break;
319 case 1: 326 case 1:
320 /* FALLTHROUGH */ 327 /* FALLTHROUGH */
321 default: 328 default:
322 omap_revision = OMAP3517_REV_ES1_1; 329 omap_revision = OMAP3517_REV_ES1_1;
330 *cpu_rev = "1.1";
323 } 331 }
324 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1; 332 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
325 break; 333 break;
@@ -330,16 +338,19 @@ static void __init omap3_check_revision(void)
330 switch(rev) { 338 switch(rev) {
331 case 0: /* Take care of early samples */ 339 case 0: /* Take care of early samples */
332 omap_revision = OMAP3630_REV_ES1_0; 340 omap_revision = OMAP3630_REV_ES1_0;
341 *cpu_rev = "1.0";
333 break; 342 break;
334 case 1: 343 case 1:
335 omap_revision = OMAP3630_REV_ES1_1; 344 omap_revision = OMAP3630_REV_ES1_1;
336 omap_chip.oc |= CHIP_IS_OMAP3630ES1_1; 345 omap_chip.oc |= CHIP_IS_OMAP3630ES1_1;
346 *cpu_rev = "1.1";
337 break; 347 break;
338 case 2: 348 case 2:
339 /* FALLTHROUGH */ 349 /* FALLTHROUGH */
340 default: 350 default:
341 omap_revision = OMAP3630_REV_ES1_2; 351 omap_revision = OMAP3630_REV_ES1_2;
342 omap_chip.oc |= CHIP_IS_OMAP3630ES1_2; 352 omap_chip.oc |= CHIP_IS_OMAP3630ES1_2;
353 *cpu_rev = "1.2";
343 } 354 }
344 break; 355 break;
345 case 0xb81e: 356 case 0xb81e:
@@ -348,17 +359,21 @@ static void __init omap3_check_revision(void)
348 switch (rev) { 359 switch (rev) {
349 case 0: 360 case 0:
350 omap_revision = TI8168_REV_ES1_0; 361 omap_revision = TI8168_REV_ES1_0;
362 *cpu_rev = "1.0";
351 break; 363 break;
352 case 1: 364 case 1:
353 /* FALLTHROUGH */ 365 /* FALLTHROUGH */
354 default: 366 default:
355 omap_revision = TI8168_REV_ES1_1; 367 omap_revision = TI8168_REV_ES1_1;
368 *cpu_rev = "1.1";
369 break;
356 } 370 }
357 break; 371 break;
358 default: 372 default:
359 /* Unknown default to latest silicon rev as default */ 373 /* Unknown default to latest silicon rev as default */
360 omap_revision = OMAP3630_REV_ES1_2; 374 omap_revision = OMAP3630_REV_ES1_2;
361 omap_chip.oc |= CHIP_IS_OMAP3630ES1_2; 375 omap_chip.oc |= CHIP_IS_OMAP3630ES1_2;
376 *cpu_rev = "1.2";
362 pr_warn("Warning: unknown chip type; assuming OMAP3630ES1.2\n"); 377 pr_warn("Warning: unknown chip type; assuming OMAP3630ES1.2\n");
363 } 378 }
364} 379}
@@ -435,10 +450,9 @@ static void __init omap4_check_revision(void)
435 if (omap3_has_ ##feat()) \ 450 if (omap3_has_ ##feat()) \
436 printk(#feat" "); 451 printk(#feat" ");
437 452
438static void __init omap3_cpuinfo(void) 453static void __init omap3_cpuinfo(const char *cpu_rev)
439{ 454{
440 u8 rev = GET_OMAP_REVISION(); 455 const char *cpu_name;
441 const char *cpu_name, *cpu_rev;
442 456
443 /* 457 /*
444 * OMAP3430 and OMAP3530 are assumed to be same. 458 * OMAP3430 and OMAP3530 are assumed to be same.
@@ -465,56 +479,6 @@ static void __init omap3_cpuinfo(void)
465 cpu_name = "OMAP3503"; 479 cpu_name = "OMAP3503";
466 } 480 }
467 481
468 if (cpu_is_omap3630() || cpu_is_ti816x()) {
469 switch (rev) {
470 case OMAP_REVBITS_00:
471 cpu_rev = "1.0";
472 break;
473 case OMAP_REVBITS_01:
474 cpu_rev = "1.1";
475 break;
476 case OMAP_REVBITS_02:
477 /* FALLTHROUGH */
478 default:
479 /* Use the latest known revision as default */
480 cpu_rev = "1.2";
481 }
482 } else if (cpu_is_omap3505() || cpu_is_omap3517()) {
483 switch (rev) {
484 case OMAP_REVBITS_00:
485 cpu_rev = "1.0";
486 break;
487 case OMAP_REVBITS_01:
488 /* FALLTHROUGH */
489 default:
490 /* Use the latest known revision as default */
491 cpu_rev = "1.1";
492 }
493 } else {
494 switch (rev) {
495 case OMAP_REVBITS_00:
496 cpu_rev = "1.0";
497 break;
498 case OMAP_REVBITS_01:
499 cpu_rev = "2.0";
500 break;
501 case OMAP_REVBITS_02:
502 cpu_rev = "2.1";
503 break;
504 case OMAP_REVBITS_03:
505 cpu_rev = "3.0";
506 break;
507 case OMAP_REVBITS_04:
508 cpu_rev = "3.1";
509 break;
510 case OMAP_REVBITS_05:
511 /* FALLTHROUGH */
512 default:
513 /* Use the latest known revision as default */
514 cpu_rev = "3.1.2";
515 }
516 }
517
518 /* Print verbose information */ 482 /* Print verbose information */
519 pr_info("%s ES%s (", cpu_name, cpu_rev); 483 pr_info("%s ES%s (", cpu_name, cpu_rev);
520 484
@@ -533,6 +497,8 @@ static void __init omap3_cpuinfo(void)
533 */ 497 */
534void __init omap2_check_revision(void) 498void __init omap2_check_revision(void)
535{ 499{
500 const char *cpu_rev;
501
536 /* 502 /*
537 * 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
538 * earlier with omap2_set_globals_tap(). 504 * earlier with omap2_set_globals_tap().
@@ -540,7 +506,7 @@ void __init omap2_check_revision(void)
540 if (cpu_is_omap24xx()) { 506 if (cpu_is_omap24xx()) {
541 omap24xx_check_revision(); 507 omap24xx_check_revision();
542 } else if (cpu_is_omap34xx()) { 508 } else if (cpu_is_omap34xx()) {
543 omap3_check_revision(); 509 omap3_check_revision(&cpu_rev);
544 510
545 /* TI816X doesn't have feature register */ 511 /* TI816X doesn't have feature register */
546 if (!cpu_is_ti816x()) 512 if (!cpu_is_ti816x())
@@ -548,7 +514,7 @@ void __init omap2_check_revision(void)
548 else 514 else
549 ti816x_check_features(); 515 ti816x_check_features();
550 516
551 omap3_cpuinfo(); 517 omap3_cpuinfo(cpu_rev);
552 return; 518 return;
553 } else if (cpu_is_omap44xx()) { 519 } else if (cpu_is_omap44xx()) {
554 omap4_check_revision(); 520 omap4_check_revision();