Skip to contentSkip to conversation

85xx: Report which "bank" of NOR flash we are booting from on FSL boards

PATCH New Kumar Gala 2 participants 3 messages Jul 21, 2009

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 85xx: Report which "bank" of NOR flash we are booting from on FSL boards

The p2020DS, MPC8536DS, MPC8572DS, MPC8544DS boards are capable of swizzling the upper address bits of the NOR flash we boot out of which creates the concept of "virtual" banks. This is useful in that we can flash a test of image of u-boot and reset to one of the virtual banks while still maintaining a working image in "bank 0".

The PIXIS FPGA exposes registers on LBC which we can use to determine which "bank" we are booting out of (as well as setting which bank to boot out of).

---
* This is a merged version of previous patches that covers all the 85xx boards

 board/freescale/mpc8536ds/mpc8536ds.c |   18 ++++++++++++++++--
 board/freescale/mpc8544ds/mpc8544ds.c |   11 +++++++++--
 board/freescale/mpc8572ds/mpc8572ds.c |   21 ++++++++++++++++++++-
 board/freescale/p2020ds/p2020ds.c     |   12 +++++++++++-
 4 files changed, 56 insertions(+), 6 deletions(-)
board/freescale/mpc8536ds/mpc8536ds.c +16 -2
index 28b27ee..91fb87b 100644
@@ -60,10 +60,24 @@ int board_early_init_f (void)
 
 int checkboard (void)
 {
-	printf ("Board: MPC8536DS, System ID: 0x%02x, "
-		"System Version: 0x%02x, FPGA Version: 0x%02x\n",
+	u8 vboot;
+
+	puts("Board: MPC8536DS ");
+#ifdef CONFIG_PHYS_64BIT
+	puts("(36-bit addrmap) ");
+#endif
+
+	printf ("Sys ID: 0x%02x, "
+		"Sys Ver: 0x%02x, FPGA Ver: 0x%02x, ",
 		in8(PIXIS_BASE + PIXIS_ID), in8(PIXIS_BASE + PIXIS_VER),
 		in8(PIXIS_BASE + PIXIS_PVER));
+
+	vboot = in8(PIXIS_BASE + 0x16);
+	if ((vboot >> 7) & 0x1)
+		puts ("Promjet\n");
+	else
+		printf ("vBank: %d\n", ((vboot >> 5) & 0x3));
+
 	return 0;
 }
 
board/freescale/mpc8544ds/mpc8544ds.c +9 -2
index 34bdbad..5a199f7 100644
@@ -43,15 +43,22 @@ int checkboard (void)
 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 	volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
 	volatile ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR);
+	u8 vboot;
 
 	if ((uint)&gur->porpllsr != 0xe00e0000) {
 		printf("immap size error %lx\n",(ulong)&gur->porpllsr);
 	}
-	printf ("Board: MPC8544DS, System ID: 0x%02x, "
-		"System Version: 0x%02x, FPGA Version: 0x%02x\n",
+	printf ("Board: MPC8544DS, Sys ID: 0x%02x, "
+		"Sys Ver: 0x%02x, FPGA Ver: 0x%02x, ",
 		in8(PIXIS_BASE + PIXIS_ID), in8(PIXIS_BASE + PIXIS_VER),
 		in8(PIXIS_BASE + PIXIS_PVER));
 
+	vboot = in8(PIXIS_BASE + 0x16);
+	if ((vboot >> 7) & 0x1)
+		printf ("vBank: %d\n", ((vboot >> 6) & 0x1));
+	else
+		puts ("Promjet\n");
+
 	lbc->ltesr = 0xffffffff;	/* Clear LBC error interrupts */
 	lbc->lteir = 0xffffffff;	/* Enable LBC error interrupts */
 	ecm->eedr = 0xffffffff;		/* Clear ecm errors */
board/freescale/mpc8572ds/mpc8572ds.c +20 -1
index 4b95617..1d4f9bb 100644
@@ -42,14 +42,33 @@ long int fixed_sdram(void);
 
 int checkboard (void)
 {
+	u8 vboot;
+
 	puts ("Board: MPC8572DS ");
 #ifdef CONFIG_PHYS_64BIT
 	puts ("(36-bit addrmap) ");
 #endif
 	printf ("Sys ID: 0x%02x, "
-		"Sys Ver: 0x%02x, FPGA Ver: 0x%02x\n",
+		"Sys Ver: 0x%02x, FPGA Ver: 0x%02x, ",
 		in8(PIXIS_BASE + PIXIS_ID), in8(PIXIS_BASE + PIXIS_VER),
 		in8(PIXIS_BASE + PIXIS_PVER));
+
+	vboot = in8(PIXIS_BASE + 0x16);
+	switch (((vboot >> 6) & 0x3)) {
+		case 0:
+			puts ("vBank: 0\n");
+			break;
+		case 1:
+			puts ("Promjet\n");
+			break;
+		case 2:
+			puts ("NAND\n");
+			break;
+		case 3:
+			puts ("vBank: 1\n");
+			break;
+	}
+
 	return 0;
 }
 
board/freescale/p2020ds/p2020ds.c +11 -1
index 293e5a4..292a820 100644
@@ -47,14 +47,24 @@ phys_size_t fixed_sdram(void);
 
 int checkboard(void)
 {
+	u8 sw7;
+
 	puts("Board: P2020DS ");
 #ifdef CONFIG_PHYS_64BIT
 	puts("(36-bit addrmap) ");
 #endif
+
 	printf("Sys ID: 0x%02x, "
-		"Sys Ver: 0x%02x, FPGA Ver: 0x%02x\n",
+		"Sys Ver: 0x%02x, FPGA Ver: 0x%02x, ",
 		in8(PIXIS_BASE + PIXIS_ID), in8(PIXIS_BASE + PIXIS_VER),
 		in8(PIXIS_BASE + PIXIS_PVER));
+
+	sw7 = in8(PIXIS_BASE + 0x2c);
+	if ((sw7 >> 7) & 0x1)
+		puts ("Promjet\n");
+	else
+		printf ("vBank: %d\n", ((sw7 >> 4) & 0x3));
+
 	return 0;
 }
 
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 1/1 85xx: Report which "bank" of NOR flash we are booting from on FSL boards

Dear Kumar Gala,

Quoted 40 lines · In message <[email protected]> you…

The p2020DS, MPC8536DS, MPC8572DS, MPC8544DS boards are capable of swizzling the upper address bits of the NOR flash we boot out of which creates the concept of "virtual" banks. This is useful in that we can flash a test of image of u-boot and reset to one of the virtual banks while still maintaining a working image in "bank 0".

The PIXIS FPGA exposes registers on LBC which we can use to determine which "bank" we are booting out of (as well as setting which bank to boot out of).

---
* This is a merged version of previous patches that covers all the 85xx boards

 board/freescale/mpc8536ds/mpc8536ds.c |   18 ++++++++++++++++--
 board/freescale/mpc8544ds/mpc8544ds.c |   11 +++++++++--
 board/freescale/mpc8572ds/mpc8572ds.c |   21 ++++++++++++++++++++-
 board/freescale/p2020ds/p2020ds.c     |   12 +++++++++++-
 4 files changed, 56 insertions(+), 6 deletions(-)
board/freescale/mpc8536ds/mpc8536ds.c +9 -2
index 28b27ee..91fb87b 100644
@@ -60,10 +60,24 @@ int board_early_init_f (void)
 
 int checkboard (void)
 {
-	printf ("Board: MPC8536DS, System ID: 0x%02x, "
-		"System Version: 0x%02x, FPGA Version: 0x%02x\n",
+	u8 vboot;
+
+	puts("Board: MPC8536DS ");
+#ifdef CONFIG_PHYS_64BIT
+	puts("(36-bit addrmap) ");
+#endif
+
+	printf ("Sys ID: 0x%02x, "
+		"Sys Ver: 0x%02x, FPGA Ver: 0x%02x, ",
 		in8(PIXIS_BASE + PIXIS_ID), in8(PIXIS_BASE + PIXIS_VER),

board/freescale/mpc8536ds/mpc8536ds.c int board_early_init_f (void) · line 82

Quoted 10 lines
board/freescale/mpc8536ds/mpc8536ds.c +7 -0
 		in8(PIXIS_BASE + PIXIS_PVER));
+
+	vboot = in8(PIXIS_BASE + 0x16);
+	if ((vboot >> 7) & 0x1)
+		puts ("Promjet\n");
+	else
+		printf ("vBank: %d\n", ((vboot >> 5) & 0x3));
+
 	return 0;
 }

So how many boards are copying this mostly identical code?

How about factoring out the big common parts?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Mirrors should reflect a little before throwing back images.
- Jean Cocteau
author
#2 lore raw

PATCH 1/1 85xx: Report which "bank" of NOR flash we are booting from on FSL boards

Quoted 61 lines · Wolfgang Denk

Dear Kumar Gala,

In message <1248187378-5970-1-git-send-email-

Quoted 44 lines · galak at kernel.crashing.org> you wrote:

The p2020DS, MPC8536DS, MPC8572DS, MPC8544DS boards are capable of swizzling the upper address bits of the NOR flash we boot out of which
creates the concept of "virtual" banks. This is useful in that we can
flash a test of image of u-boot and reset to one of the virtual banks while still maintaining a working image in "bank 0".

The PIXIS FPGA exposes registers on LBC which we can use to determine which "bank" we are booting out of (as well as setting which bank to boot out of).

---
* This is a merged version of previous patches that covers all the 85xx boards

board/freescale/mpc8536ds/mpc8536ds.c |   18 ++++++++++++++++--
board/freescale/mpc8544ds/mpc8544ds.c |   11 +++++++++--
board/freescale/mpc8572ds/mpc8572ds.c |   21 ++++++++++++++++++++-
board/freescale/p2020ds/p2020ds.c     |   12 +++++++++++-
4 files changed, 56 insertions(+), 6 deletions(-)
board/ renamed from board/freescale/mpc8536ds/mpc8536ds.c +0 -0

freescale/mpc8536ds/mpc8536ds.c
index 28b27ee..91fb87b 100644

board/freescale/mpc8536ds/mpc8536ds.c +9 -2
@@ -60,10 +60,24 @@ int board_early_init_f (void)
 
 int checkboard (void)
 {
-	printf ("Board: MPC8536DS, System ID: 0x%02x, "
-		"System Version: 0x%02x, FPGA Version: 0x%02x\n",
+	u8 vboot;
+
+	puts("Board: MPC8536DS ");
+#ifdef CONFIG_PHYS_64BIT
+	puts("(36-bit addrmap) ");
+#endif
+
+	printf ("Sys ID: 0x%02x, "
+		"Sys Ver: 0x%02x, FPGA Ver: 0x%02x, ",
 		in8(PIXIS_BASE + PIXIS_ID), in8(PIXIS_BASE + PIXIS_VER),

board/freescale/mpc8536ds/mpc8536ds.c int board_early_init_f (void) · line 82

Quoted 10 lines
board/freescale/mpc8536ds/mpc8536ds.c +7 -0
 		in8(PIXIS_BASE + PIXIS_PVER));
+
+	vboot = in8(PIXIS_BASE + 0x16);
+	if ((vboot >> 7) & 0x1)
+		puts ("Promjet\n");
+	else
+		printf ("vBank: %d\n", ((vboot >> 5) & 0x3));
+
 	return 0;
 }

So how many boards are copying this mostly identical code?

Quoted 1 line

How about factoring out the big common parts?

Agreed, but its not something I'm trying to accomplish in this go around. The PIXIS code is just slightly different enough on these boards that its needs a good scrub to refactor and clean it up.

- k