Skip to contentSkip to conversation

mpc83xx: cleanup System Part and Revision ID Register (SPRIDR) code

PATCH New Kim Phillips 3 participants 7 messages Mar 28, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 mpc83xx: cleanup System Part and Revision ID Register (SPRIDR) code

in the spirit of commit 1ced121600b2060ab2ff9f0fddd9421fd70a0dc6, 85xx's "Update SVR numbers to expand support", simplify SPRIDR processing and processor ID display. Add REVID_{MAJ,MIN}OR macros to make REVID dependent code simpler. Also added PARTID_NO_E and IS_E_PROCESSOR convenience macros.

---
 board/freescale/mpc8360emds/mpc8360emds.c |   11 +--
 board/freescale/mpc837xerdb/mpc837xerdb.c |   15 +--
 cpu/mpc83xx/cpu.c                         |  169 ++++++++---------------------
 include/mpc83xx.h                         |   91 +++++-----------
 4 files changed, 84 insertions(+), 202 deletions(-)
board/freescale/mpc8360emds/mpc8360emds.c +4 -7
index d90cdb3..2119320 100644
@@ -98,11 +98,8 @@ int board_early_init_f(void)
 	/* Enable flash write */
 	bcsr[0xa] &= ~0x04;
 
-	/* Disable G1TXCLK, G2TXCLK h/w buffers (rev.2 h/w bug workaround) */
-	if (immr->sysconf.spridr == SPR_8360_REV20 ||
-	    immr->sysconf.spridr == SPR_8360E_REV20 ||
-	    immr->sysconf.spridr == SPR_8360_REV21 ||
-	    immr->sysconf.spridr == SPR_8360E_REV21)
+	/* Disable G1TXCLK, G2TXCLK h/w buffers (rev.2.x h/w bug workaround) */
+	if (REVID_MAJOR(immr->sysconf.spridr) == 2)
 		bcsr[0xe] = 0x30;
 
 	/* Enable second UART */
@@ -308,8 +305,8 @@ void ft_board_setup(void *blob, bd_t *bd)
 	 * if on mpc8360ea rev. 2.1,
 	 * change both ucc phy-connection-types from rgmii-id to rgmii-rxid
 	 */
-	if (immr->sysconf.spridr == SPR_8360_REV21 ||
-	    immr->sysconf.spridr == SPR_8360E_REV21) {
+	if ((REVID_MAJOR(immr->sysconf.spridr) == 2) &&
+	    (REVID_MINOR(immr->sysconf.spridr) == 1)) {
 		int nodeoffset;
 		const char *prop;
 		int path;
board/freescale/mpc837xerdb/mpc837xerdb.c +6 -9
index 83fb60d..e054f4e 100644
@@ -140,24 +140,21 @@ int board_early_init_f(void)
 	u32 spridr = in_be32(&immr->sysconf.spridr);
 
 	/* we check only part num, and don't look for CPU revisions */
-	switch (spridr >> 16) {
-	case SPR_8379E_REV10 >> 16:
-	case SPR_8379_REV10 >> 16:
+	switch (PARTID_NO_E(spridr)) {
+	case SPR_8377:
 		fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_SATA,
 				 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
-		fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_SATA,
+		fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_PEX,
 				 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
 		break;
-	case SPR_8378E_REV10 >> 16:
-	case SPR_8378_REV10 >> 16:
+	case SPR_8378:
 		fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_PEX,
 				 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
 		break;
-	case SPR_8377E_REV10 >> 16:
-	case SPR_8377_REV10 >> 16:
+	case SPR_8379:
 		fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_SATA,
 				 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
-		fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_PEX,
+		fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_SATA,
 				 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
 		break;
 	default:
cpu/mpc83xx/cpu.c +46 -123

188 lines not on this page · raw message

include/mpc83xx.h +30 -65

101 lines not on this page · raw message

Signature · 1 line
1.5.4.4.481.g5075
#1 lore raw

PATCH 3/3 mpc83xx: cleanup System Part and Revision ID Register (SPRIDR) code

Quoted 18 lines
cpu/mpc83xx/cpu.c +16 -0
+struct cpu_type {
+	char name[15];
+	u32 partid;
+};
+
+#define CPU_TYPE_ENTRY(x) {#x, SPR_##x}
+
+struct cpu_type cpu_type_list [] = {
+	CPU_TYPE_ENTRY(8311),
+	CPU_TYPE_ENTRY(8313),
+	CPU_TYPE_ENTRY(8314),
+	CPU_TYPE_ENTRY(8315),
+	CPU_TYPE_ENTRY(8321),
+	CPU_TYPE_ENTRY(8323),
+	CPU_TYPE_ENTRY(8343),
+	CPU_TYPE_ENTRY(8347_TBGA_),

cpu/mpc83xx/cpu.c line 63

Quoted 10 lines
cpu/mpc83xx/cpu.c +10 -0
+	CPU_TYPE_ENTRY(8347_PBGA_),
+	CPU_TYPE_ENTRY(8349),
+	CPU_TYPE_ENTRY(8358_TBGA_),
+	CPU_TYPE_ENTRY(8358_PBGA_),
+	CPU_TYPE_ENTRY(8360),
+	CPU_TYPE_ENTRY(8377),
+	CPU_TYPE_ENTRY(8378),
+	CPU_TYPE_ENTRY(8379),
+};
+

Global data, could become a problem if/when full relocation is impl. Not a big deal, just figured I should mention it.

Jocke

#2 lore raw

PATCH 3/3 mpc83xx: cleanup System Part and Revision ID Register (SPRIDR) code

Quoted 3 lines · On Fri, 28 Mar 2008 16:34:23 +0100 Joakim Tjernlund…

Global data, could become a problem if/when full relocation is impl. Not a big deal, just figured I should mention it.

would you rather something like this then? :

cpu/mpc83xx/cpu.c +23 -26
index c878268..36de78d 100644
@@ -35,32 +35,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct cpu_type {
-	char name[15];
-	u32 partid;
-};
-
-#define CPU_TYPE_ENTRY(x) {#x, SPR_##x}
-
-struct cpu_type cpu_type_list [] = {
-	CPU_TYPE_ENTRY(8311),
-	CPU_TYPE_ENTRY(8313),
-	CPU_TYPE_ENTRY(8314),
-	CPU_TYPE_ENTRY(8315),
-	CPU_TYPE_ENTRY(8321),
-	CPU_TYPE_ENTRY(8323),
-	CPU_TYPE_ENTRY(8343),
-	CPU_TYPE_ENTRY(8347_TBGA_),
-	CPU_TYPE_ENTRY(8347_PBGA_),
-	CPU_TYPE_ENTRY(8349),
-	CPU_TYPE_ENTRY(8358_TBGA_),
-	CPU_TYPE_ENTRY(8358_PBGA_),
-	CPU_TYPE_ENTRY(8360),
-	CPU_TYPE_ENTRY(8377),
-	CPU_TYPE_ENTRY(8378),
-	CPU_TYPE_ENTRY(8379),
-};
-
 int checkcpu(void)
 {
 	volatile immap_t *immr;
@@ -70,6 +44,29 @@ int checkcpu(void)
 	char buf[32];
 	int i;
 
+#define CPU_TYPE_ENTRY(x) {#x, SPR_##x}
+	const struct cpu_type {
+		char name[15];
+		u32 partid;
+	} cpu_type_list [] = {
+		CPU_TYPE_ENTRY(8311),
+		CPU_TYPE_ENTRY(8313),
+		CPU_TYPE_ENTRY(8314),
+		CPU_TYPE_ENTRY(8315),
+		CPU_TYPE_ENTRY(8321),
+		CPU_TYPE_ENTRY(8323),
+		CPU_TYPE_ENTRY(8343),
+		CPU_TYPE_ENTRY(8347_TBGA_),
+		CPU_TYPE_ENTRY(8347_PBGA_),
+		CPU_TYPE_ENTRY(8349),
+		CPU_TYPE_ENTRY(8358_TBGA_),
+		CPU_TYPE_ENTRY(8358_PBGA_),
+		CPU_TYPE_ENTRY(8360),
+		CPU_TYPE_ENTRY(8377),
+		CPU_TYPE_ENTRY(8378),
+		CPU_TYPE_ENTRY(8379),
+	};
+
 	immr = (immap_t *)CFG_IMMR;
 
 	puts("CPU:   ");

Kim

#3 lore raw

PATCH 3/3 mpc83xx: cleanup System Part and Revision ID Register (SPRIDR) code

Quoted 85 lines

-----Original Message-----
From: Kim Phillips [mailto:kim.phillips at freescale.com]
Sent: den 28 mars 2008 18:30
To: joakim.tjernlund at transmode.se
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [U-Boot-Users] [PATCH 3/3] mpc83xx: cleanup System Part and Revision ID Register (SPRIDR) code

Quoted 3 lines · On Fri, 28 Mar 2008 16:34:23 +0100 Joakim Tjernlund…

Global data, could become a problem if/when full relocation is impl. Not a big deal, just figured I should mention it.

would you rather something like this then? :

cpu/mpc83xx/cpu.c +23 -26
index c878268..36de78d 100644
@@ -35,32 +35,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct cpu_type {
-	char name[15];
-	u32 partid;
-};
-
-#define CPU_TYPE_ENTRY(x) {#x, SPR_##x}
-
-struct cpu_type cpu_type_list [] = {
-	CPU_TYPE_ENTRY(8311),
-	CPU_TYPE_ENTRY(8313),
-	CPU_TYPE_ENTRY(8314),
-	CPU_TYPE_ENTRY(8315),
-	CPU_TYPE_ENTRY(8321),
-	CPU_TYPE_ENTRY(8323),
-	CPU_TYPE_ENTRY(8343),
-	CPU_TYPE_ENTRY(8347_TBGA_),
-	CPU_TYPE_ENTRY(8347_PBGA_),
-	CPU_TYPE_ENTRY(8349),
-	CPU_TYPE_ENTRY(8358_TBGA_),
-	CPU_TYPE_ENTRY(8358_PBGA_),
-	CPU_TYPE_ENTRY(8360),
-	CPU_TYPE_ENTRY(8377),
-	CPU_TYPE_ENTRY(8378),
-	CPU_TYPE_ENTRY(8379),
-};
-
 int checkcpu(void)
 {
 	volatile immap_t *immr;
@@ -70,6 +44,29 @@ int checkcpu(void)
 	char buf[32];
 	int i;
 
+#define CPU_TYPE_ENTRY(x) {#x, SPR_##x}
+	const struct cpu_type {
+		char name[15];
+		u32 partid;
+	} cpu_type_list [] = {
+		CPU_TYPE_ENTRY(8311),
+		CPU_TYPE_ENTRY(8313),
+		CPU_TYPE_ENTRY(8314),
+		CPU_TYPE_ENTRY(8315),
+		CPU_TYPE_ENTRY(8321),
+		CPU_TYPE_ENTRY(8323),
+		CPU_TYPE_ENTRY(8343),
+		CPU_TYPE_ENTRY(8347_TBGA_),
+		CPU_TYPE_ENTRY(8347_PBGA_),
+		CPU_TYPE_ENTRY(8349),
+		CPU_TYPE_ENTRY(8358_TBGA_),
+		CPU_TYPE_ENTRY(8358_PBGA_),
+		CPU_TYPE_ENTRY(8360),
+		CPU_TYPE_ENTRY(8377),
+		CPU_TYPE_ENTRY(8378),
+		CPU_TYPE_ENTRY(8379),
+	};
+
 	immr = (immap_t *)CFG_IMMR;
 
 	puts("CPU:   ");
Quoted 1 line

Kim

It is still global data, but the const makes it smaller and should be there if accepted. Like I said, it is just a minor comment as u-boot isn't ready for full relocation yet.

BTW, what happened to relocation stuff Grant was doing? It is still disabled, I never had any problems so perhaps time to turn it on again? it might even make u-boot smaller once all the old manuel relocation code has been properly disabled.

Jocke

#4 lore raw

PATCH 3/3 mpc83xx: cleanup System Part and Revision ID Register (SPRIDR) code

Quoted 5 lines · On Fri, 28 Mar 2008 21:01:30 +0100 "Joakim Tjernlund"…

BTW, what happened to relocation stuff Grant was doing? It is still disabled, I never had any problems so perhaps time to turn it on again? it might even make u-boot smaller once all the old manuel relocation code has been properly disabled.

beats me. I'm all for it, but I think we're still supposed to support a wide range of toolchain versions (the reason Grant's stuff got reverted).

Kim

#5 lore raw

PATCH 3/3 mpc83xx: cleanup System Part and Revision ID Register (SPRIDR) code

Quoted 11 lines · Kim Phillips
Quoted 5 lines · On Fri, 28 Mar 2008 21:01:30 +0100 "Joakim Tjernlund"…

BTW, what happened to relocation stuff Grant was doing? It is still disabled, I never had any problems so perhaps time to turn it on again? it might even make u-boot smaller once all the old manuel relocation code has been properly disabled.

beats me. I'm all for it, but I think we're still supposed to support a wide range of toolchain versions (the reason Grant's stuff got reverted).

The main problem is not really understanding how gcc wants to handle relocation. I've got no idea what needs to be different between versions of gcc. Someone with greater gcc powers than I needs to take a look at it.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#6 lore raw

PATCH 3/3 mpc83xx: cleanup System Part and Revision ID Register (SPRIDR) code

Quoted 22 lines

-----Original Message-----
From: glikely at secretlab.ca [mailto:glikely at secretlab.ca] On Behalf Of Grant Likely
Sent: den 29 mars 2008 00:12
To: Kim Phillips
Cc: Joakim Tjernlund; u-boot-users at lists.sourceforge.net
Subject: Re: [U-Boot-Users] [PATCH 3/3] mpc83xx: cleanup System Part and Revision ID Register (SPRIDR) code

Quoted 11 lines · Kim Phillips
Quoted 5 lines · On Fri, 28 Mar 2008 21:01:30 +0100 "Joakim Tjernlund"…

BTW, what happened to relocation stuff Grant was doing? It is still disabled, I never had any problems so perhaps time to turn it on again? it might even make u-boot smaller once all the old manuel relocation code has been properly disabled.

beats me. I'm all for it, but I think we're still supposed to support a wide range of toolchain versions (the reason Grant's stuff got reverted).

Quoted 6 lines

The main problem is not really understanding how gcc wants to handle relocation. I've got no idea what needs to be different between versions of gcc. Someone with greater gcc powers than I needs to take a look at it.

g.

I am no gcc expert, but perhaps listing which gcc's that don't work is a god start? What archs were problematic? only ppc? There was a register bug for ppc that WD fixed a little while ago, maybe that will help.

Jocke