Skip to contentSkip to conversation

Fix for Freescale ppc cores: major revision detection

PATCH Martin Langer 2 participants 3 messages Feb 11, 2008 – Feb 27, 2008

lore
Share & tools
lore
#0 lore raw
Quoted 17 lines · Kumar Gala
Quoted 10 lines · Martin Langer

Ppc cores by Freescale are using the configuration field instead of the
major revision field for their major revision number. Those field definitions come from include/asm-powerpc/reg.h.

Look at the pdf below and you will see that PVR_MAJ() does a wrong shift
for ppc cores by Freescale. This patch fixes it.

http://www.freescale.com/files/archives/doc/support_info/PPCPVR.pdf

This doc doesn't encompass the e500/book-e cores that don't follow the same pattern.

Quoted 7 lines

The code should probably be something like:

#ifdef CONFIG_FSL_BOOKE
maj = PVR_MAJ(pvr);
#else
maj = (pvr >> 8) & 0xff;
#endif

Thanks for the hint. Inspired by that I did the logic the other way round. So we have the same default cases as we had before and additionally it will fit for the cores mentioned in the doc.

powerpc/kernel/setup-common.c renamed from powerpc/kernel/setup-common.c.ORIGINAL +15 -2
@@ -241,8 +241,21 @@
 	/* If we are a Freescale core do a simple check so
 	 * we dont have to keep adding cases in the future */
 	if (PVR_VER(pvr) & 0x8000) {
-		maj = PVR_MAJ(pvr);
-		min = PVR_MIN(pvr);
+		switch (PVR_VER(pvr)) {
+			case 0x8000:	/* 7441/7450/7451, Vger */
+			case 0x8001:	/* 7445/7455, Apollo 6 */
+			case 0x8002:	/* 7447/7457, Apollo 7 */
+			case 0x8003:	/* 7447A, Apollo 7 PM */
+			case 0x8004:	/* 7448, Apollo 8 */
+			case 0x800c:	/* 7410, Nitro */
+				maj = ((pvr >> 8) & 0xF);
+				min = PVR_MIN(pvr);
+				break;
+			default:	/* e500/book-e */
+				maj = PVR_MAJ(pvr);
+				min = PVR_MIN(pvr);
+				break;
+		}
 	} else {
 		switch (PVR_VER(pvr)) {
 			case 0x0020:	/* 403 family */
#1 lore raw
Quoted 3 lines · Martin Langer

Thanks for the hint. Inspired by that I did the logic the other way round. So we have the same default cases as we had before and additionally it will fit for the cores mentioned in the doc.

Care to resend this with a proper description and a Signed-off-by line?

powerpc/kernel/setup-common.c line 250

Quoted 7 lines
powerpc/kernel/setup-common.c renamed from powerpc/kernel/setup-common.c.ORIGINAL +7 -0
+		switch (PVR_VER(pvr)) {
+			case 0x8000:	/* 7441/7450/7451, Vger */
+			case 0x8001:	/* 7445/7455, Apollo 6 */
+			case 0x8002:	/* 7447/7457, Apollo 7 */
+			case 0x8003:	/* 7447A, Apollo 7 PM */
+			case 0x8004:	/* 7448, Apollo 8 */
+			case 0x800c:	/* 7410, Nitro */

BTW, these case labels are all indented one tab too far.

Paul.

#2 lore raw
Quoted 4 lines · Paul Mackerras

Martin Langer writes:

Care to resend this with a proper description and a Signed-off-by line?

Sure.

Quoted 9 lines

Review

Quoted 7 lines
(quoted diff) +7 -0
+		switch (PVR_VER(pvr)) {
+			case 0x8000:	/* 7441/7450/7451, Vger */
+			case 0x8001:	/* 7445/7455, Apollo 6 */
+			case 0x8002:	/* 7447/7457, Apollo 7 */
+			case 0x8003:	/* 7447A, Apollo 7 PM */
+			case 0x8004:	/* 7448, Apollo 8 */
+			case 0x800c:	/* 7410, Nitro */

BTW, these case labels are all indented one tab too far.

Ok. Now it's fixed.

The major revision number of some ppc cores by Freescale is placed in the configuration field instead of the major revision field. The patch corrects the behaviour for those 74xx cores.

setup-common.c renamed from setup-common.c.ORIGINAL +15 -2
@@ -241,8 +241,21 @@
 	/* If we are a Freescale core do a simple check so
 	 * we dont have to keep adding cases in the future */
 	if (PVR_VER(pvr) & 0x8000) {
-		maj = PVR_MAJ(pvr);
-		min = PVR_MIN(pvr);
+		switch (PVR_VER(pvr)) {
+		case 0x8000:	/* 7441/7450/7451, Voyager */
+		case 0x8001:	/* 7445/7455, Apollo 6 */
+		case 0x8002:	/* 7447/7457, Apollo 7 */
+		case 0x8003:	/* 7447A, Apollo 7 PM */
+		case 0x8004:	/* 7448, Apollo 8 */
+		case 0x800c:	/* 7410, Nitro */
+			maj = ((pvr >> 8) & 0xF);
+			min = PVR_MIN(pvr);
+			break;
+		default:	/* e500/book-e */
+			maj = PVR_MAJ(pvr);
+			min = PVR_MIN(pvr);
+			break;
+		}
 	} else {
 		switch (PVR_VER(pvr)) {
 			case 0x0020:	/* 403 family */