summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2010-09-03 13:27:02 +0200
committerStefan Roese <sr@denx.de>2010-09-23 09:02:06 +0200
commite02d44964407716104c78d72170a086052c64e86 (patch)
tree9ece2861dad4076dbd231638d3b9edb500ea728a
parent5b9144638e7d4c86e0470e21869b341278e183c3 (diff)
ppc4xx: Cleanup of PVR detection code in cpu.c
This patch cleans the PVR detection code in check_cpu() up a bit. Basically the strings are better seperated, resulting in an easier to understand and maintain code version. The #ifdef's couldn't be removed easily because of two reasons: - Some SoC revisions have the same PVR, so need a way to differentiate between those two SoC's. - In some case statements registers only available in this SoC variant are referenced. Instead I moved the CONFIG_440 #ifdef a bit, so that 405 platforms don't add this 440 detection code and vice versa. Resulting in this U-Boot image size change: 405EX (Kilauea): 408 bytes less 440EPx (Sequoia): 604 bytes less 460EX (Canyonlands): 564 bytes less Signed-off-by: Stefan Roese <sr@denx.de> Cc: Wolfgang Denk <wd@denx.de>
-rw-r--r--arch/powerpc/cpu/ppc4xx/cpu.c132
1 files changed, 61 insertions, 71 deletions
diff --git a/arch/powerpc/cpu/ppc4xx/cpu.c b/arch/powerpc/cpu/ppc4xx/cpu.c
index 84852184de8..6009b0ce048 100644
--- a/arch/powerpc/cpu/ppc4xx/cpu.c
+++ b/arch/powerpc/cpu/ppc4xx/cpu.c
@@ -303,123 +303,113 @@ int checkcpu (void)
get_sys_info(&sys_info);
#if defined(CONFIG_XILINX_440)
- puts("IBM PowerPC 4");
+ puts("IBM PowerPC ");
#else
- puts("AMCC PowerPC 4");
-#endif
-
-#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
- defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \
- defined(CONFIG_405EX)
- puts("05");
-#endif
-#if defined(CONFIG_440)
-#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
- puts("60");
-#else
- puts("40");
-#endif
+ puts("AMCC PowerPC ");
#endif
switch (pvr) {
+
+#if !defined(CONFIG_440)
case PVR_405GP_RB:
- puts("GP Rev. B");
+ puts("405GP Rev. B");
break;
case PVR_405GP_RC:
- puts("GP Rev. C");
+ puts("405GP Rev. C");
break;
case PVR_405GP_RD:
- puts("GP Rev. D");
+ puts("405GP Rev. D");
break;
#ifdef CONFIG_405GP
case PVR_405GP_RE: /* 405GP rev E and 405CR rev C have same PVR */
- puts("GP Rev. E");
+ puts("405GP Rev. E");
break;
#endif
case PVR_405CR_RA:
- puts("CR Rev. A");
+ puts("405CR Rev. A");
break;
case PVR_405CR_RB:
- puts("CR Rev. B");
+ puts("405CR Rev. B");
break;
#ifdef CONFIG_405CR
case PVR_405CR_RC: /* 405GP rev E and 405CR rev C have same PVR */
- puts("CR Rev. C");
+ puts("405CR Rev. C");
break;
#endif
case PVR_405GPR_RB:
- puts("GPr Rev. B");
+ puts("405GPr Rev. B");
break;
case PVR_405EP_RB:
- puts("EP Rev. B");
+ puts("405EP Rev. B");
break;
case PVR_405EZ_RA:
- puts("EZ Rev. A");
+ puts("405EZ Rev. A");
break;
case PVR_405EX1_RA:
- puts("EX Rev. A");
+ puts("405EX Rev. A");
strcpy(addstr, "Security support");
break;
case PVR_405EXR2_RA:
- puts("EXr Rev. A");
+ puts("405EXr Rev. A");
strcpy(addstr, "No Security support");
break;
case PVR_405EX1_RC:
- puts("EX Rev. C");
+ puts("405EX Rev. C");
strcpy(addstr, "Security support");
break;
case PVR_405EX2_RC:
- puts("EX Rev. C");
+ puts("405EX Rev. C");
strcpy(addstr, "No Security support");
break;
case PVR_405EXR1_RC:
- puts("EXr Rev. C");
+ puts("405EXr Rev. C");
strcpy(addstr, "Security support");
break;
case PVR_405EXR2_RC:
- puts("EXr Rev. C");
+ puts("405EXr Rev. C");
strcpy(addstr, "No Security support");
break;
case PVR_405EX1_RD:
- puts("EX Rev. D");
+ puts("405EX Rev. D");
strcpy(addstr, "Security support");
break;
case PVR_405EX2_RD:
- puts("EX Rev. D");
+ puts("405EX Rev. D");
strcpy(addstr, "No Security support");
break;
case PVR_405EXR1_RD:
- puts("EXr Rev. D");
+ puts("405EXr Rev. D");
strcpy(addstr, "Security support");
break;
case PVR_405EXR2_RD:
- puts("EXr Rev. D");
+ puts("405EXr Rev. D");
strcpy(addstr, "No Security support");
break;
-#if defined(CONFIG_440)
+#else /* CONFIG_440 */
+
#if defined(CONFIG_440GP)
case PVR_440GP_RB:
- puts("GP Rev. B");
+ puts("440GP Rev. B");
/* See errata 1.12: CHIP_4 */
if ((mfdcr(CPC0_SYS0) != mfdcr(CPC0_STRP0)) ||
(mfdcr(CPC0_SYS1) != mfdcr(CPC0_STRP1)) ){
@@ -432,128 +422,127 @@ int checkcpu (void)
break;
case PVR_440GP_RC:
- puts("GP Rev. C");
+ puts("440GP Rev. C");
break;
#endif /* CONFIG_440GP */
case PVR_440GX_RA:
- puts("GX Rev. A");
+ puts("440GX Rev. A");
break;
case PVR_440GX_RB:
- puts("GX Rev. B");
+ puts("440GX Rev. B");
break;
case PVR_440GX_RC:
- puts("GX Rev. C");
+ puts("440GX Rev. C");
break;
case PVR_440GX_RF:
- puts("GX Rev. F");
+ puts("440GX Rev. F");
break;
case PVR_440EP_RA:
- puts("EP Rev. A");
+ puts("440EP Rev. A");
break;
#ifdef CONFIG_440EP
case PVR_440EP_RB: /* 440EP rev B and 440GR rev A have same PVR */
- puts("EP Rev. B");
+ puts("440EP Rev. B");
break;
case PVR_440EP_RC: /* 440EP rev C and 440GR rev B have same PVR */
- puts("EP Rev. C");
+ puts("440EP Rev. C");
break;
#endif /* CONFIG_440EP */
#ifdef CONFIG_440GR
case PVR_440GR_RA: /* 440EP rev B and 440GR rev A have same PVR */
- puts("GR Rev. A");
+ puts("440GR Rev. A");
break;
case PVR_440GR_RB: /* 440EP rev C and 440GR rev B have same PVR */
- puts("GR Rev. B");
+ puts("440GR Rev. B");
break;
#endif /* CONFIG_440GR */
-#endif /* CONFIG_440 */
#ifdef CONFIG_440EPX
case PVR_440EPX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
- puts("EPx Rev. A");
+ puts("440EPx Rev. A");
strcpy(addstr, "Security/Kasumi support");
break;
case PVR_440EPX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
- puts("EPx Rev. A");
+ puts("440EPx Rev. A");
strcpy(addstr, "No Security/Kasumi support");
break;
#endif /* CONFIG_440EPX */
#ifdef CONFIG_440GRX
case PVR_440GRX1_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
- puts("GRx Rev. A");
+ puts("440GRx Rev. A");
strcpy(addstr, "Security/Kasumi support");
break;
case PVR_440GRX2_RA: /* 440EPx rev A and 440GRx rev A have same PVR */
- puts("GRx Rev. A");
+ puts("440GRx Rev. A");
strcpy(addstr, "No Security/Kasumi support");
break;
#endif /* CONFIG_440GRX */
case PVR_440SP_6_RAB:
- puts("SP Rev. A/B");
+ puts("440SP Rev. A/B");
strcpy(addstr, "RAID 6 support");
break;
case PVR_440SP_RAB:
- puts("SP Rev. A/B");
+ puts("440SP Rev. A/B");
strcpy(addstr, "No RAID 6 support");
break;
case PVR_440SP_6_RC:
- puts("SP Rev. C");
+ puts("440SP Rev. C");
strcpy(addstr, "RAID 6 support");
break;
case PVR_440SP_RC:
- puts("SP Rev. C");
+ puts("440SP Rev. C");
strcpy(addstr, "No RAID 6 support");
break;
case PVR_440SPe_6_RA:
- puts("SPe Rev. A");
+ puts("440SPe Rev. A");
strcpy(addstr, "RAID 6 support");
break;
case PVR_440SPe_RA:
- puts("SPe Rev. A");
+ puts("440SPe Rev. A");
strcpy(addstr, "No RAID 6 support");
break;
case PVR_440SPe_6_RB:
- puts("SPe Rev. B");
+ puts("440SPe Rev. B");
strcpy(addstr, "RAID 6 support");
break;
case PVR_440SPe_RB:
- puts("SPe Rev. B");
+ puts("440SPe Rev. B");
strcpy(addstr, "No RAID 6 support");
break;
#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
case PVR_460EX_RA:
- puts("EX Rev. A");
+ puts("460EX Rev. A");
strcpy(addstr, "No Security/Kasumi support");
break;
case PVR_460EX_SE_RA:
- puts("EX Rev. A");
+ puts("460EX Rev. A");
strcpy(addstr, "Security/Kasumi support");
break;
case PVR_460EX_RB:
- puts("EX Rev. B");
+ puts("460EX Rev. B");
mfsdr(SDR0_ECID3, reg);
if (reg & 0x00100000)
strcpy(addstr, "No Security/Kasumi support");
@@ -562,17 +551,17 @@ int checkcpu (void)
break;
case PVR_460GT_RA:
- puts("GT Rev. A");
+ puts("460GT Rev. A");
strcpy(addstr, "No Security/Kasumi support");
break;
case PVR_460GT_SE_RA:
- puts("GT Rev. A");
+ puts("460GT Rev. A");
strcpy(addstr, "Security/Kasumi support");
break;
case PVR_460GT_RB:
- puts("GT Rev. B");
+ puts("460GT Rev. B");
mfsdr(SDR0_ECID3, reg);
if (reg & 0x00100000)
strcpy(addstr, "No Security/Kasumi support");
@@ -582,28 +571,29 @@ int checkcpu (void)
#endif
case PVR_460SX_RA:
- puts("SX Rev. A");
+ puts("460SX Rev. A");
strcpy(addstr, "Security support");
break;
case PVR_460SX_RA_V1:
- puts("SX Rev. A");
+ puts("460SX Rev. A");
strcpy(addstr, "No Security support");
break;
case PVR_460GX_RA:
- puts("GX Rev. A");
+ puts("460GX Rev. A");
strcpy(addstr, "Security support");
break;
case PVR_460GX_RA_V1:
- puts("GX Rev. A");
+ puts("460GX Rev. A");
strcpy(addstr, "No Security support");
break;
case PVR_VIRTEX5:
- puts("x5 VIRTEX5");
+ puts("440x5 VIRTEX5");
break;
+#endif /* CONFIG_440 */
default:
printf (" UNKNOWN (PVR=%08x)", pvr);