Skip to contentSkip to conversation

86xx: Report which "bank" of NOR flash we are booting from on MPC8641HPCN

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

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 86xx: Report which "bank" of NOR flash we are booting from on MPC8641HPCN

The MPC8641HPCN board is capable of swizzling the upper address bit 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).

---
 board/freescale/mpc8641hpcn/mpc8641hpcn.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
board/freescale/mpc8641hpcn/mpc8641hpcn.c +11 -2
index 7422e6b..d115ce1 100644
@@ -42,10 +42,19 @@ int board_early_init_f(void)
 
 int checkboard(void)
 {
-	printf ("Board: MPC8641HPCN, System ID: 0x%02x, "
-		"System Version: 0x%02x, FPGA Version: 0x%02x\n",
+	u8 vboot;
+
+	printf ("Board: MPC8641HPCN, 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");
+
 #ifdef CONFIG_PHYS_64BIT
 	printf ("       36-bit physical address map\n");
 #endif
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 1/1 86xx: Report which "bank" of NOR flash we are booting from on MPC8641HPCN

Dear Kumar Gala,

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

The MPC8641HPCN board is capable of swizzling the upper address bit 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).

---
 board/freescale/mpc8641hpcn/mpc8641hpcn.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
board/freescale/mpc8641hpcn/mpc8641hpcn.c +0 -0
index 7422e6b..d115ce1 100644
@@ -42,10 +42,19 @@ int board_early_init_f(void)
 
 int checkboard(void)
 {

board/freescale/mpc8641hpcn/mpc8641hpcn.c int board_early_init_f(void) · line 52

Quoted 10 lines
board/freescale/mpc8641hpcn/mpc8641hpcn.c +6 -2
-	printf ("Board: MPC8641HPCN, System ID: 0x%02x, "
-		"System Version: 0x%02x, FPGA Version: 0x%02x\n",
+	u8 vboot;
+
+	printf ("Board: MPC8641HPCN, 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);

--------------------------------^^^^^^^

Maybe you can use a symbolic name here, too?

board/freescale/mpc8641hpcn/mpc8641hpcn.c int board_early_init_f(void) · line 53

Quoted 1 line
board/freescale/mpc8641hpcn/mpc8641hpcn.c +1 -0
+	if ((vboot >> 7) & 0x1)
	if (vboot & 0x80) ???

board/freescale/mpc8641hpcn/mpc8641hpcn.c int board_early_init_f(void) · line 54

Quoted 1 line
board/freescale/mpc8641hpcn/mpc8641hpcn.c +1 -0
+		printf ("vBank: %d\n", ((vboot >> 6) & 0x1));
		printf ("vBank: %d\n", !!(vboot & 0x40)); ???

And eventually you can even come up with symbolic names for the magic numbers 0x80 and 0x40 ?

Best regards,

Wolfgang Denk

Signature · 6 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
egrep patterns are full regular expressions; it uses a fast  determi-
nistic algorithm that sometimes needs exponential space.
- unix manuals
#2 lore raw

PATCH 1/1 86xx: Report which "bank" of NOR flash we are booting from on MPC8641HPCN

Quoted 21 lines · On Tuesday 21 July 2009 17:05:56 Wolfgang Denk wrote:

board/freescale/mpc8641hpcn/mpc8641hpcn.c int board_early_init_f(void) · line 52

Quoted 12 lines

int checkboard(void)
{

board/freescale/mpc8641hpcn/mpc8641hpcn.c +6 -2
-	printf ("Board: MPC8641HPCN, System ID: 0x%02x, "
-		"System Version: 0x%02x, FPGA Version: 0x%02x\n",
+	u8 vboot;
+
+	printf ("Board: MPC8641HPCN, 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);

--------------------------------^^^^^^^

Maybe you can use a symbolic name here, too?

board/freescale/mpc8641hpcn/mpc8641hpcn.c int board_early_init_f(void) · line 53

Quoted 1 line
board/freescale/mpc8641hpcn/mpc8641hpcn.c +1 -0
+	if ((vboot >> 7) & 0x1)
	if (vboot & 0x80) ???
Quoted 6 lines

board/freescale/mpc8641hpcn/mpc8641hpcn.c int board_early_init_f(void) · line 54

Quoted 1 line
board/freescale/mpc8641hpcn/mpc8641hpcn.c +1 -0
+		printf ("vBank: %d\n", ((vboot >> 6) & 0x1));
		printf ("vBank: %d\n", !!(vboot & 0x40)); ???

And eventually you can even come up with symbolic names for the magic numbers 0x80 and 0x40 ?

And please switch from using in8() to in_8().

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================