Skip to contentSkip to conversation

Add "cpu_config" command for PPC4xx bootstrap configuration

PATCH New Stefan Roese 3 participants 9 messages Jul 17, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add "cpu_config" command for PPC4xx bootstrap configuration

From: Dirk Eibach <[email protected]>

This patch adds a generic command for programming I2C bootstrap eeproms on PPC4xx. An implementation for Canyonlands board is included.

The command name is intentionally chosen not to be PPC4xx specific. This way other CPU's/SoC's can implement a similar command under the same name, perhaps with a different syntax.

Usage on Canyonlands:

=> cpu_config
Available configurations:

 600-nor         - NOR  CPU: 600 PLB: 200 OPB: 100 EBC: 100
 600-nand        - NAND CPU: 600 PLB: 200 OPB: 100 EBC: 100
 800-nor         - NOR  CPU: 800 PLB: 200 OPB: 100 EBC: 100
 800-nand        - NAND CPU: 800 PLB: 200 OPB: 100 EBC: 100
 1000-nor        - NOR  CPU:1000 PLB: 200 OPB: 100 EBC: 100
 1000-nand       - NAND CPU:1000 PLB: 200 OPB: 100 EBC: 100
 1066-nor        - NOR  CPU:1066 PLB: 266 OPB:  88 EBC:  88
 1066-nand       - NAND CPU:1066 PLB: 266 OPB:  88 EBC:  88

=> cpu_config 600-nor
Using configuration:
600-nor - NOR CPU: 600 PLB: 200 OPB: 100 EBC: 100
done (dump via 'i2c md 52 0.1 10')
Reset the board for the changes to take effect

Other 4xx boards will be migrated to use this command soon as well.

Cc Dirk Eibach <[email protected]>
Cc Matthias Fuchs <[email protected]>
---
 board/amcc/canyonlands/Makefile     |    5 +-
 board/amcc/canyonlands/bootstrap.c  |  195 -----------------------------------
 board/amcc/canyonlands/cpu_config.c |   71 +++++++++++++
 cpu/ppc4xx/Makefile                 |    3 +
 cpu/ppc4xx/cmd_cpu_config.c         |   92 ++++++++++++++++
 include/asm-ppc/ppc4xx_config.h     |   42 ++++++++
 include/configs/canyonlands.h       |    4 +
 7 files changed, 215 insertions(+), 197 deletions(-)
 delete mode 100644 board/amcc/canyonlands/bootstrap.c
 create mode 100644 board/amcc/canyonlands/cpu_config.c
 create mode 100644 cpu/ppc4xx/cmd_cpu_config.c
 create mode 100644 include/asm-ppc/ppc4xx_config.h
board/amcc/canyonlands/Makefile +3 -2
index 2aeead6..b1dfb0b 100644
@@ -25,10 +25,11 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	:= $(BOARD).o
-COBJS	+= bootstrap.o
+COBJS-y	:= $(BOARD).o
+COBJS-$(CONFIG_CMD_CPU_CONFIG) += cpu_config.o
 SOBJS	:= init.o
 
+COBJS   := $(COBJS-y)
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
 SOBJS	:= $(addprefix $(obj),$(SOBJS))
board/amcc/canyonlands/bootstrap.c deleted +0 -195

195 lines not on this page · raw message

board/amcc/canyonlands/cpu_config.c new file +71 -0

71 lines not on this page · raw message

cpu/ppc4xx/Makefile +3 -0
index 96ab5c6..c5f22f1 100644
@@ -41,6 +41,9 @@ endif
 COBJS	+= 4xx_pci.o
 COBJS	+= 4xx_pcie.o
 COBJS	+= bedbug_405.o
+ifdef CONFIG_CMD_CPU_CONFIG
+COBJS	+= cmd_cpu_config.o
+endif
 COBJS	+= commproc.o
 COBJS	+= cpu.o
 COBJS	+= cpu_init.o
cpu/ppc4xx/cmd_cpu_config.c new file +92 -0

92 lines not on this page · raw message

include/asm-ppc/ppc4xx_config.h new file +42 -0

42 lines not on this page · raw message

include/configs/canyonlands.h +4 -0
index 48c5198..41a0755 100644
@@ -330,6 +330,9 @@
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS	3
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS	10
 
+#define CONFIG_4xx_CONFIG_I2C_EEPROM_ADDR	0x52
+#define CONFIG_4xx_CONFIG_BLOCKSIZE		16
+
 /* I2C SYSMON (LM75, AD7414 is almost compatible)			*/
 #define CONFIG_DTT_LM75		1		/* ON Semi's LM75	*/
 #define CONFIG_DTT_AD7414	1		/* use AD7414		*/
@@ -442,6 +445,7 @@
 /*
  * Commands additional to the ones defined in amcc-common.h
  */
+#define CONFIG_CMD_CPU_CONFIG
 #if defined(CONFIG_ARCHES)
 #define CONFIG_CMD_DTT
 #define CONFIG_CMD_PCI
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 1/1 Add "cpu_config" command for PPC4xx bootstrap configuration

Quoted 1 line · On Friday 17 July 2009 11:26:03 Stefan Roese wrote:

From: Dirk Eibach <[email protected]>

Sorry, but this "From: Dirk..." slipped in by accident. Dirk has provided some parts of this framework, but the real command is more complete rewrite from myself. I kept Dirk's Copyright's in the header, but this patch version shouldn't have the authorship of Dirk.

I'll fix this in the next patch version.

Dirk, if you like I can add you s-o-b to the next patch version, since you contributed to this code as well. Just let me know.

Thanks.

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
=====================================================================

#2 lore raw

PATCH 1/1 Add "cpu_config" command for PPC4xx bootstrap configuration

Quoted 3 lines

Dirk, if you like I can add you s-o-b to the next patch version, since you contributed to this code as well. Just let me know.

Sure, you can list me as s-o-b.

Cheers
Dirk

#3 lore raw

PATCH 1/1 Add "cpu_config" command for PPC4xx bootstrap configuration

In reply to Stefan Roese

Dear Stefan Roese,

Quoted 14 lines · In message <[email protected]> you wrote:

From: Dirk Eibach <[email protected]>

This patch adds a generic command for programming I2C bootstrap eeproms on PPC4xx. An implementation for Canyonlands board is included.

The command name is intentionally chosen not to be PPC4xx specific. This way other CPU's/SoC's can implement a similar command under the same name, perhaps with a different syntax.

Usage on Canyonlands:

=> cpu_config
Available configurations:

Quoted 8 lines
 600-nor         - NOR  CPU: 600 PLB: 200 OPB: 100 EBC: 100
 600-nand        - NAND CPU: 600 PLB: 200 OPB: 100 EBC: 100
 800-nor         - NOR  CPU: 800 PLB: 200 OPB: 100 EBC: 100
 800-nand        - NAND CPU: 800 PLB: 200 OPB: 100 EBC: 100
 1000-nor        - NOR  CPU:1000 PLB: 200 OPB: 100 EBC: 100
 1000-nand       - NAND CPU:1000 PLB: 200 OPB: 100 EBC: 100
 1066-nor        - NOR  CPU:1066 PLB: 266 OPB:  88 EBC:  88
 1066-nand       - NAND CPU:1066 PLB: 266 OPB:  88 EBC:  88

Why are the lines indented by one space?

Would it be possible to also mark the current setting in this output? Like printing an asterisk befor or after it?

Quoted 3 lines
board/amcc/canyonlands/cpu_config.c new file +0 -0
new file mode 100644
index 0000000..15813c4

...

board/amcc/canyonlands/cpu_config.c line 33

Quoted 6 lines
board/amcc/canyonlands/cpu_config.c new file +6 -0
+struct ppc4xx_config ppc4xx_config_val[] = {
+	{ "600-nor", "NOR  CPU: 600 PLB: 200 OPB: 100 EBC: 100",
+	  {
+		  0x86, 0x80, 0xce, 0x1f, 0x79, 0x80, 0x00, 0xa0,
+		  0x40, 0x08, 0x23, 0x50, 0x0d, 0x05, 0x00, 0x00
+	  } },

Indentation by TAB, please.

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
What is mind?  No matter.  What is matter?  Never mind.
                                      -- Thomas Hewitt Key, 1799-1875
#4 lore raw

PATCH 1/1 Add "cpu_config" command for PPC4xx bootstrap configuration

Hi Wolfgang,

Quoted 11 lines · On Friday 17 July 2009 12:45:01 Wolfgang Denk wrote:
Quoted 10 lines

=> cpu_config
Available configurations:

 600-nor         - NOR  CPU: 600 PLB: 200 OPB: 100 EBC: 100
 600-nand        - NAND CPU: 600 PLB: 200 OPB: 100 EBC: 100
 800-nor         - NOR  CPU: 800 PLB: 200 OPB: 100 EBC: 100
 800-nand        - NAND CPU: 800 PLB: 200 OPB: 100 EBC: 100
 1000-nor        - NOR  CPU:1000 PLB: 200 OPB: 100 EBC: 100
 1000-nand       - NAND CPU:1000 PLB: 200 OPB: 100 EBC: 100
 1066-nor        - NOR  CPU:1066 PLB: 266 OPB:  88 EBC:  88
 1066-nand       - NAND CPU:1066 PLB: 266 OPB:  88 EBC:  88
Quoted 1 line

Why are the lines indented by one space?

It was this way in the original bootstrap version. I can remove it if you prefer.

Quoted 2 lines

Would it be possible to also mark the current setting in this output? Like printing an asterisk befor or after it?

No. Currently the implementation only checks strings and has no idea of frequencies. Also, not only PLL frequencies are configured in this I2C bootstrap EEPROM but also boot-location (NOR, NAND, PCI) and other things. So it's really not trivial to find/search the current configuration in this table.

Since 4xx prints the speed's in the bootlog, it shouldn't be too hard to find the current setting there (if necessary).

Quoted 8 lines

board/amcc/canyonlands/cpu_config.c line 33

Quoted 6 lines
board/amcc/canyonlands/cpu_config.c new file +6 -0
+struct ppc4xx_config ppc4xx_config_val[] = {
+	{ "600-nor", "NOR  CPU: 600 PLB: 200 OPB: 100 EBC: 100",
+	  {
+		  0x86, 0x80, 0xce, 0x1f, 0x79, 0x80, 0x00, 0xa0,
+		  0x40, 0x08, 0x23, 0x50, 0x0d, 0x05, 0x00, 0x00
+	  } },

Indentation by TAB, please.

Ups. Will fix. Thanks.

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
=====================================================================

#5 lore raw

PATCH 1/1 Add "cpu_config" command for PPC4xx bootstrap configuration

Dear Stefan Roese,

Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Why are the lines indented by one space?

It was this way in the original bootstrap version. I can remove it if you prefer.

Please do.

Quoted 8 lines
Quoted 2 lines

Would it be possible to also mark the current setting in this output? Like printing an asterisk befor or after it?

No. Currently the implementation only checks strings and has no idea of frequencies. Also, not only PLL frequencies are configured in this I2C bootstrap EEPROM but also boot-location (NOR, NAND, PCI) and other things. So it's really not trivial to find/search the current configuration in this table.

Umm.. I think it should be fairly trivial to read the current EEPROM settings and compare these against the entries in the table above?

Quoted 2 lines

Since 4xx prints the speed's in the bootlog, it shouldn't be too hard to find the current setting there (if necessary).

But would it not be useful to be able to detect any "illegal" settings, for example resulting from accidentyial corruption of the EEPROM data?

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
If you're not part of the solution, then you're part of the  precipi-
tate.
#6 lore raw

PATCH 1/1 Add "cpu_config" command for PPC4xx bootstrap configuration

Quoted 11 lines · On Friday 17 July 2009 13:20:17 Wolfgang Denk wrote:
Quoted 8 lines
Quoted 2 lines

Would it be possible to also mark the current setting in this output? Like printing an asterisk befor or after it?

No. Currently the implementation only checks strings and has no idea of frequencies. Also, not only PLL frequencies are configured in this I2C bootstrap EEPROM but also boot-location (NOR, NAND, PCI) and other things. So it's really not trivial to find/search the current configuration in this table.

Umm.. I think it should be fairly trivial to read the current EEPROM settings and compare these against the entries in the table above?

OK, this could be done. Even if I don't see a real advantage here. But I'll add it anyway in the next patch version.

Quoted 6 lines
Quoted 2 lines

Since 4xx prints the speed's in the bootlog, it shouldn't be too hard to find the current setting there (if necessary).

But would it not be useful to be able to detect any "illegal" settings, for example resulting from accidentyial corruption of the EEPROM data?

I don't understand this. How should the code detect an "illegal" setting? All settings configured in the board specific code are valid.

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
=====================================================================

#7 lore raw

PATCH 1/1 Add "cpu_config" command for PPC4xx bootstrap configuration

Dear Stefan Roese,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 4 lines

But would it not be useful to be able to detect any "illegal" settings, for example resulting from accidentyial corruption of the EEPROM data?

I don't understand this. How should the code detect an "illegal" setting? All settings configured in the board specific code are valid.

You define a list of ppc4xx_config_count known configuration
settings; the data read from the EEPROM either matches one of these then it is a "known" or "legal" setting, or it does not - in that case the EEPROM contains an "illegal" setting. This should at least trigger a warning message (probably including the hex values as read from the EEPROM).

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
The IQ of the group is the lowest IQ of a member of the group divided
by the number of people in the group.
#8 lore raw

PATCH 1/1 Add "cpu_config" command for PPC4xx bootstrap configuration

Quoted 7 lines · On Friday 17 July 2009 13:40:50 Wolfgang Denk wrote:
Quoted 6 lines
Quoted 3 lines

But would it not be useful to be able to detect any "illegal" settings, for example resulting from accidentyial corruption of the EEPROM data?

I don't understand this. How should the code detect an "illegal" setting? All settings configured in the board specific code are valid.

Quoted 6 lines

You define a list of ppc4xx_config_count known configuration
settings; the data read from the EEPROM either matches one of these then it is a "known" or "legal" setting, or it does not - in that case the EEPROM contains an "illegal" setting. This should at least trigger a warning message (probably including the hex values as read from the EEPROM).

Ah, yes. Good idea. Will add.

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
=====================================================================