Skip to contentSkip to conversation

Kirkwood: print_cpuinfo fixed for valid devid revid

PATCH Superseded Prafulla Wadaskar 1 participant 3 messages Sep 20, 2010 – Oct 12, 2010 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Kirkwood: print_cpuinfo fixed for valid devid revid

From: Prafulla Wadaskar <[[email protected]]>

Earlier Device Identification register was used to detect the type for SoC, considering 88F6282 support to be added, It is not possible to detect the same using current algorithm.

With this patch, device ID is being read using PCIE devid register, also valid chip revision ID will also be read and displayed

---
Change log:
v2: Updated as per review comments for V1
debug replaced by printf, sprintf removed
(??) kept as it is since we dont know future references for revid

 arch/arm/cpu/arm926ejs/kirkwood/cpu.c    |   34 ++++++++++++++++++++---------
 arch/arm/include/asm/arch-kirkwood/cpu.h |    2 +
 2 files changed, 25 insertions(+), 11 deletions(-)
arch/arm/cpu/arm926ejs/kirkwood/cpu.c +23 -11
index 82c978b..b4a4c04 100644
@@ -54,10 +54,11 @@ unsigned char get_random_hex(void)
 	u8 outbuf[BUFLEN];
 
 	/*
-	 * in case of 88F6281/88F6192 A0,
+	 * in case of 88F6281/88F6282/88F6192 A0,
 	 * Bit7 need to reset to generate random values in KW_REG_UNDOC_0x1470
-	 * Soc reg offsets KW_REG_UNDOC_0x1470 and KW_REG_UNDOC_0x1478 are reserved regs and
-	 * Does not have names at this moment (no errata available)
+	 * Soc reg offsets KW_REG_UNDOC_0x1470 and KW_REG_UNDOC_0x1478 are
+	 * reserved regs and does not have names at this moment
+	 * (no errata available)
 	 */
 	writel(readl(KW_REG_UNDOC_0x1478) & ~(1 << 7), KW_REG_UNDOC_0x1478);
 	for (i = 0; i < BUFLEN; i++) {
@@ -271,20 +272,31 @@ static void kw_sysrst_check(void)
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
 {
-	char *name = "Unknown";
+	char *rev;
+	u16 devid = (readl(KW_REG_PCIE_DEVID) >> 16) & 0xffff;
+	u8 revid = readl(KW_REG_PCIE_REVID) & 0xff;
 
-	switch (readl(KW_REG_DEVICE_ID) & 0x03) {
-	case 1:
-		name = "88F6192_A0";
+	if ((readl(KW_REG_DEVICE_ID) & 0x03) > 2) {
+		printf("Error.. %s:Unsupported Kirkwood SoC 88F%04x\n", __FUNCTION__, devid);
+		return -1;
+	}
+
+	switch (revid) {
+	case 0:
+		rev = "Z0";
 		break;
 	case 2:
-		name = "88F6281_A0";
+		rev = "A0";
+		break;
+	case 3:
+		rev = "A1";
 		break;
 	default:
-		printf("SoC:   Unsupported Kirkwood\n");
-		return -1;
+		rev = "??";
+		break;
 	}
-	printf("SoC:   Kirkwood %s\n", name);
+
+	printf("SoC:   Kirkwood 88F%04x_%s\n", devid, rev);
 	return 0;
 }
 #endif /* CONFIG_DISPLAY_CPUINFO */
arch/arm/include/asm/arch-kirkwood/cpu.h +2 -0
index b3022a3..d28c51a 100644
@@ -35,6 +35,8 @@
 #define KWGBE_PORT_SERIAL_CONTROL1_REG(_x)	\
 		((_x ? KW_EGIGA0_BASE : KW_EGIGA1_BASE) + 0x44c)
 
+#define KW_REG_PCIE_DEVID		(KW_REG_PCIE_BASE + 0x00)
+#define KW_REG_PCIE_REVID		(KW_REG_PCIE_BASE + 0x08)
 #define KW_REG_DEVICE_ID		(KW_MPP_BASE + 0x34)
 #define KW_REG_SYSRST_CNT		(KW_MPP_BASE + 0x50)
 #define SYSRST_CNT_1SEC_VAL		(25*1000000)
Signature · 1 line
1.7.2.1
#1 lore raw

PATCH v2 1/1 Kirkwood: print_cpuinfo fixed for valid devid revid

Quoted 107 lines

-----Original Message-----
From: Prafulla Wadaskar [mailto:prafulla at marvell.com]
Sent: Monday, September 20, 2010 9:40 PM
To: u-boot at lists.denx.de
Cc: Prabhanjan Sarnaik; Ashish Karkare; Prafulla Wadaskar; Prafulla Wadaskar
Subject: [PATCH v2] Kirkwood: print_cpuinfo fixed for valid devid revid

From: Prafulla Wadaskar <[[email protected]]>

Earlier Device Identification register was used to detect the type for SoC, considering 88F6282 support to be added, It is not possible to detect the same using current algorithm.

With this patch, device ID is being read using PCIE devid register, also valid chip revision ID will also be read and displayed

---
Change log:
v2: Updated as per review comments for V1
debug replaced by printf, sprintf removed (??) kept as it is since we dont know future references
for revid

 arch/arm/cpu/arm926ejs/kirkwood/cpu.c    |   34 
++++++++++++++++++++---------
 arch/arm/include/asm/arch-kirkwood/cpu.h |    2 +
 2 files changed, 25 insertions(+), 11 deletions(-)
arch/arm/cpu/arm926ejs/kirkwood/cpu.c +1 -1
index 82c978b..b4a4c04 100644
@@ -54,10 +54,11 @@ unsigned char get_random_hex(void)
 	u8 outbuf[BUFLEN];
 
 	/*
-	 * in case of 88F6281/88F6192 A0,
+	 * in case of 88F6281/88F6282/88F6192 A0,
 	 * Bit7 need to reset to generate random values in 

KW_REG_UNDOC_0x1470

arch/arm/cpu/arm926ejs/kirkwood/cpu.c +0 -1
-	 * Soc reg offsets KW_REG_UNDOC_0x1470 and 

KW_REG_UNDOC_0x1478 are reserved regs and

arch/arm/cpu/arm926ejs/kirkwood/cpu.c +1 -1
-	 * Does not have names at this moment (no errata available)
+	 * Soc reg offsets KW_REG_UNDOC_0x1470 and 

KW_REG_UNDOC_0x1478 are

arch/arm/cpu/arm926ejs/kirkwood/cpu.c +2 -0
+	 * reserved regs and does not have names at this moment
+	 * (no errata available)
 	 */
 	writel(readl(KW_REG_UNDOC_0x1478) & ~(1 << 7), 

KW_REG_UNDOC_0x1478);

arch/arm/cpu/arm926ejs/kirkwood/cpu.c +19 -8
 	for (i = 0; i < BUFLEN; i++) {
@@ -271,20 +272,31 @@ static void kw_sysrst_check(void)
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
 {
-	char *name = "Unknown";
+	char *rev;
+	u16 devid = (readl(KW_REG_PCIE_DEVID) >> 16) & 0xffff;
+	u8 revid = readl(KW_REG_PCIE_REVID) & 0xff;
 
-	switch (readl(KW_REG_DEVICE_ID) & 0x03) {
-	case 1:
-		name = "88F6192_A0";
+	if ((readl(KW_REG_DEVICE_ID) & 0x03) > 2) {
+		printf("Error.. %s:Unsupported Kirkwood SoC 
 88F%04x\n", __FUNCTION__, devid);
+		return -1;
+	}
+
+	switch (revid) {
+	case 0:
+		rev = "Z0";
 		break;
 	case 2:
-		name = "88F6281_A0";
+		rev = "A0";
+		break;
+	case 3:
+		rev = "A1";
 		break;
 	default:
-		printf("SoC:   Unsupported Kirkwood\n");
-		return -1;
+		rev = "??";
+		break;
 	}
-	printf("SoC:   Kirkwood %s\n", name);
+
+	printf("SoC:   Kirkwood 88F%04x_%s\n", devid, rev);
 	return 0;
 }

#endif /* CONFIG_DISPLAY_CPUINFO */

arch/arm/include/asm/arch-kirkwood/cpu.h +0 -0
index b3022a3..d28c51a 100644

arch/arm/include/asm/arch-kirkwood/cpu.h line 42

Quoted 8 lines
arch/arm/include/asm/arch-kirkwood/cpu.h +2 -0
@@ -35,6 +35,8 @@
 #define KWGBE_PORT_SERIAL_CONTROL1_REG(_x)	\
 		((_x ? KW_EGIGA0_BASE : KW_EGIGA1_BASE) + 0x44c)
 
+#define KW_REG_PCIE_DEVID		(KW_REG_PCIE_BASE + 0x00)
+#define KW_REG_PCIE_REVID		(KW_REG_PCIE_BASE + 0x08)
 #define KW_REG_DEVICE_ID		(KW_MPP_BASE + 0x34)
 #define KW_REG_SYSRST_CNT		(KW_MPP_BASE + 0x50)
 #define SYSRST_CNT_1SEC_VAL		(25*1000000)

Applied to u-boot-marvell.git master branch

Regards..
Prafulla . .

#2 lore raw

PATCH v2 1/1 Kirkwood: print_cpuinfo fixed for valid devid revid

In reply to Prafulla Wadaskar
Quoted 30 lines

-----Original Message-----
From: Prafulla Wadaskar [mailto:prafulla at marvell.com]
Sent: Monday, September 20, 2010 9:40 PM
To: u-boot at lists.denx.de
Cc: Prabhanjan Sarnaik; Ashish Karkare; Prafulla Wadaskar; Prafulla Wadaskar
Subject: [PATCH v2] Kirkwood: print_cpuinfo fixed for valid devid revid

From: Prafulla Wadaskar <[[email protected]]>

Earlier Device Identification register was used to detect the type for SoC, considering 88F6282 support to be added, It is not possible to detect the same using current algorithm.

With this patch, device ID is being read using PCIE devid register, also valid chip revision ID will also be read and displayed

---
Change log:
v2: Updated as per review comments for V1
debug replaced by printf, sprintf removed (??) kept as it is since we dont know future references
for revid

Quoted 5 lines
 arch/arm/cpu/arm926ejs/kirkwood/cpu.c    |   34 
++++++++++++++++++++---------
 arch/arm/include/asm/arch-kirkwood/cpu.h |    2 +
 2 files changed, 25 insertions(+), 11 deletions(-)

Applied to u-boot-marvell.git master branch

Regards.
Prafulla . .