Skip to contentSkip to conversation

powerpc: Introduce device tree control and driver model

PATCH Superseded Simon Glass 3 participants 43 messages Feb 7, 2015 – Feb 19, 2015 PowerPC

lore
Share & tools
lore
#0 lore raw

v2 cover powerpc: Introduce device tree control and driver model

This series does a small amount of tweaking to support device tree control (CONFIG_OF_CONTROL) on PowerPC platforms. It also adds support for driver model. In both cases the main effort is to set things up correctly before calling board_init_f().

A new generic function, board_init_f_mem() is introduced. This does the various memory calculations in C code, since they are messy in assembler and every architecture should in fact be the same. A later series will adjust ARM and x86 to use this function.

As an example, the Canyonlands boards are converted over to use device tree control and driver model for their serial console. It should be fairly straightforward to convert over other boards.

Changes in v2:
- Reduce reserved stack space for board_init_f_mem() to 64 bytes
- Add SYS_MALLOC_F to Kconfig

Simon Glass (15):
Introduce board_init_f_mem() to handle early memory layout
powerpc: Permit device tree control of U-Boot (CONFIG_OF_CONTROL)
powerpc: ppc4xx: canyonlands: config: Tidy up CONFIGs and config.mk
powerpc: ppc4xx: Move CANYONLANDS/GLACIER/ARCHES to Kconfig
powerpc: ppc4xx: Add ramboot config for glacier
powerpc: ppc4xx: canyonlands: Move to generic board
powerpc: ppc4xx: dts: Bring in canyonlands device tree files
powerpc: ppc4xx: Call board_init_f_mem() for generic board
powerpc: ppc4xx: Add a gpio.h header file
powerpc: ppc4xx: Allow the end of u-boot.bin to be found
powerpc: ppc4xx: Use CONFIG_OF_CONTROL for canyonlands boards
ppc: amcc: Omit unneeded ns16550 CONFIG if using driver model
powerpc: Add serial driver for driver model
dm: powerpc: ppc4xx: Move glacier to use driver model for serial
powerpc: Add linkage.h file

Stefan Roese (4):
WIP: powerpc: ppc4xx: Somehow BSS is not cleared in RAMBOOT case
powerpc: ppc4xx: Change from OF_SEPARATE to OF_EMBED
powerpc: ppc4xx: Add defaults for DT based booting to really work
powerpc: ppc4xx: Enable CONFIG_DISPLAY_BOARDINFO

 arch/Kconfig                                |   1 +
 arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c      |   8 +
 arch/powerpc/cpu/ppc4xx/config.mk           |   5 +-
 arch/powerpc/cpu/ppc4xx/cpu_init.c          |   2 +
 arch/powerpc/cpu/ppc4xx/start.S             |  18 +-
 arch/powerpc/cpu/ppc4xx/u-boot.lds          |   8 +-
 arch/powerpc/dts/Makefile                   |  11 +
 arch/powerpc/dts/arches.dts                 | 339 ++++++++++++++++
 arch/powerpc/dts/canyonlands.dts            | 561 +++++++++++++++++++++++++++
 arch/powerpc/dts/glacier.dts                | 582 ++++++++++++++++++++++++++++
 arch/powerpc/include/asm/arch-ppc4xx/gpio.h |   7 +
 arch/powerpc/include/asm/linkage.h          |   7 +
 arch/powerpc/include/asm/ppc460ex_gt.h      |   2 +
 arch/powerpc/lib/board.c                    |   3 +
 board/amcc/canyonlands/Kconfig              |  36 ++
 board/amcc/canyonlands/MAINTAINERS          |   1 +
 board/amcc/canyonlands/config.mk            |   2 -
 board/amcc/canyonlands/u-boot-ram.lds       |  85 ++++
 common/board_f.c                            |  18 +
 common/board_r.c                            |   8 +-
 configs/arches_defconfig                    |   5 +-
 configs/canyonlands_defconfig               |   5 +-
 configs/glacier_defconfig                   |   5 +-
 configs/glacier_ramboot_defconfig           |   8 +
 drivers/serial/Makefile                     |   1 +
 drivers/serial/serial_ppc.c                 |  40 ++
 include/configs/amcc-common.h               |   2 +
 include/configs/canyonlands.h               |  38 +-
 28 files changed, 1778 insertions(+), 30 deletions(-)
 create mode 100644 arch/powerpc/dts/Makefile
 create mode 100644 arch/powerpc/dts/arches.dts
 create mode 100644 arch/powerpc/dts/canyonlands.dts
 create mode 100644 arch/powerpc/dts/glacier.dts
 create mode 100644 arch/powerpc/include/asm/arch-ppc4xx/gpio.h
 create mode 100644 arch/powerpc/include/asm/linkage.h
 create mode 100644 board/amcc/canyonlands/u-boot-ram.lds
 create mode 100644 configs/glacier_ramboot_defconfig
 create mode 100644 drivers/serial/serial_ppc.c
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#1 lore raw

PATCH v2 1/19 Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every arch's assembler start-up is a pain. Also this code is not actually architecture-specific. We can use common code for all architectures and with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory is available, with a pointer to the top of the area that should be used before relocation. The function will set things up and return the lowest memory address that it allocated/used. That can then be set as the top of the stack.

Note that on some archs this function will use the stack, so the stack pointer should be set to same value as is pased to board_init_f_mem(). A margin of 128 bytes will be left for this stack, so that it is not overwritten. This means that 64 bytes is wasted by this early call. This is not strictly necessary on several more modern archs, so we could remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to zero global_data or set up the early malloc pointers.

---

Changes in v2:
- Reduce reserved stack space for board_init_f_mem() to 64 bytes

 common/board_f.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
common/board_f.c +18 -0
index 7953137..07f5118 100644
@@ -1075,4 +1075,22 @@ void board_init_f_r(void)
 	/* NOTREACHED - board_init_r() does not return */
 	hang();
 }
+#else
+ulong board_init_f_mem(ulong top)
+{
+	/* Leave space for the stack we are running with now */
+	top -= 0x40;
+
+	top -= sizeof(struct global_data);
+	top = ALIGN(top, 16);
+	gd = (struct global_data *)top;
+	memset((void *)gd, '\0', sizeof(*gd));
+
+#ifdef CONFIG_SYS_MALLOC_F_LEN
+	top -= CONFIG_SYS_MALLOC_F_LEN;
+	gd->malloc_base = top;
+#endif
+
+	return top;
+}
 #endif /* CONFIG_X86 */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#2 lore raw

PATCH v2 1/19 Introduce board_init_f_mem() to handle early memory layout

Quoted 28 lines · Simon Glass

At present on some architectures we set up the following before calling board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every arch's assembler start-up is a pain. Also this code is not actually architecture-specific. We can use common code for all architectures and with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory is available, with a pointer to the top of the area that should be used before relocation. The function will set things up and return the lowest memory address that it allocated/used. That can then be set as the top of the stack.

Note that on some archs this function will use the stack, so the stack pointer should be set to same value as is pased to board_init_f_mem(). A margin of 128 bytes will be left for this stack, so that it is not overwritten. This means that 64 bytes is wasted by this early call. This is not strictly necessary on several more modern archs, so we could remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to zero global_data or set up the early malloc pointers.

Quoted 8 lines

---

Changes in v2:
- Reduce reserved stack space for board_init_f_mem() to 64 bytes

 common/board_f.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Applied to u-boot-dm.

#3 lore raw

PATCH v2 2/19 powerpc: Permit device tree control of U-Boot (CONFIG_OF_CONTROL)

In reply to Simon Glass

Enable this in the Kconfig so that PowerPC boards can use device tree to configure U-Boot.

---

Changes in v2: None

 arch/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/Kconfig +1 -0
index f63cc5a..67e99e9 100644
@@ -39,6 +39,7 @@ config OPENRISC
 config PPC
 	bool "PowerPC architecture"
 	select HAVE_PRIVATE_LIBGCC
+	select SUPPORT_OF_CONTROL
 
 config SANDBOX
 	bool "Sandbox"
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#4 lore raw

PATCH v2 2/19 powerpc: Permit device tree control of U-Boot (CONFIG_OF_CONTROL)

Quoted 10 lines · Simon Glass

Enable this in the Kconfig so that PowerPC boards can use device tree to configure U-Boot.

---

Changes in v2: None

 arch/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Applied to u-boot-dm.

#5 lore raw

PATCH v2 3/19 powerpc: ppc4xx: canyonlands: config: Tidy up CONFIGs and config.mk

In reply to Simon Glass

Many CONFIG options have an unnecessary value of 1. CONFIG_440 is set in the various board config files. Also simplify the CONFIG_440 check in config.mk

---

Changes in v2: None

 arch/powerpc/cpu/ppc4xx/config.mk |  5 +----
 board/amcc/canyonlands/config.mk  |  2 --
 include/configs/canyonlands.h     | 34 +++++++++++++++++-----------------
 3 files changed, 18 insertions(+), 23 deletions(-)
arch/powerpc/cpu/ppc4xx/config.mk +1 -4
index f87c9dc..9cb41bb 100644
@@ -7,10 +7,7 @@
 
 PLATFORM_CPPFLAGS += -mstring -msoft-float
 
-cfg=$(srctree)/include/configs/$(CONFIG_SYS_CONFIG_NAME:"%"=%).h
-is440:=$(shell grep CONFIG_440 $(cfg))
-
-ifneq (,$(findstring CONFIG_440,$(is440)))
+ifneq (,$(CONFIG_440))
 PLATFORM_CPPFLAGS += -Wa,-m440 -mcpu=440
 else
 PLATFORM_CPPFLAGS += -Wa,-m405 -mcpu=405
board/amcc/canyonlands/config.mk +0 -2
index 63b8973..5cc90d2 100644
@@ -8,8 +8,6 @@
 # AMCC 460EX/460GT Evaluation Board (Canyonlands) board
 #
 
-PLATFORM_CPPFLAGS += -DCONFIG_440=1
-
 ifeq ($(debug),1)
 PLATFORM_CPPFLAGS += -DDEBUG
 endif
include/configs/canyonlands.h +17 -17
index 8eeb15c..7b1f368 100644
@@ -19,10 +19,10 @@
  * and Arches dual (460GT)
  */
 #ifdef CONFIG_CANYONLANDS
-#define CONFIG_460EX		1	/* Specific PPC460EX		*/
+#define CONFIG_460EX			/* Specific PPC460EX		*/
 #define CONFIG_HOSTNAME		canyonlands
 #else
-#define CONFIG_460GT		1	/* Specific PPC460GT		*/
+#define CONFIG_460GT			/* Specific PPC460GT		*/
 #ifdef CONFIG_GLACIER
 #define CONFIG_HOSTNAME		glacier
 #else
@@ -32,7 +32,7 @@
 #endif
 #endif
 
-#define CONFIG_440		1
+#define CONFIG_440
 
 #ifndef CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_TEXT_BASE	0xFFF80000
@@ -45,10 +45,10 @@
 
 #define CONFIG_SYS_CLK_FREQ	66666667	/* external freq to pll	*/
 
-#define CONFIG_BOARD_EARLY_INIT_F	1	/* Call board_early_init_f */
-#define CONFIG_BOARD_EARLY_INIT_R	1	/* Call board_early_init_r */
-#define CONFIG_MISC_INIT_R		1	/* Call misc_init_r */
-#define CONFIG_BOARD_TYPES		1	/* support board types */
+#define CONFIG_BOARD_EARLY_INIT_F		/* Call board_early_init_f */
+#define CONFIG_BOARD_EARLY_INIT_R		/* Call board_early_init_r */
+#define CONFIG_MISC_INIT_R			/* Call misc_init_r */
+#define CONFIG_BOARD_TYPES			/* support board types */
 
 /*-----------------------------------------------------------------------
  * Base addresses -- Note these are effective addresses where the
@@ -134,7 +134,7 @@
  *----------------------------------------------------------------------*/
 #define CONFIG_SYS_FLASH_CFI			/* The flash is CFI compatible	*/
 #define CONFIG_FLASH_CFI_DRIVER		/* Use common CFI driver	*/
-#define CONFIG_SYS_FLASH_CFI_AMD_RESET	1	/* Use AMD (Spansion) reset cmd */
+#define CONFIG_SYS_FLASH_CFI_AMD_RESET	/* Use AMD (Spansion) reset cmd */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST    {CONFIG_SYS_FLASH_BASE}
 #define CONFIG_SYS_MAX_FLASH_BANKS	1	/* max number of memory banks		*/
@@ -172,9 +172,9 @@
  * I2C SPD DIMM autodetection/calibration doesn't fit into the 4k of boot
  * code.
  */
-#define CONFIG_SPD_EEPROM	1	/* Use SPD EEPROM for setup	*/
+#define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for setup	*/
 #define SPD_EEPROM_ADDRESS	{0x50, 0x51}	/* SPD i2c spd addresses*/
-#define CONFIG_DDR_ECC		1	/* with ECC support		*/
+#define CONFIG_DDR_ECC			/* with ECC support		*/
 #define CONFIG_DDR_RQDC_FIXED	0x80000038 /* fixed value for RQDC	*/
 
 #else /* defined(CONFIG_ARCHES) */
@@ -262,8 +262,8 @@
 #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		*/
+#define CONFIG_DTT_LM75				/* ON Semi's LM75	*/
+#define CONFIG_DTT_AD7414			/* use AD7414		*/
 #define CONFIG_DTT_SENSORS	{0}		/* Sensor addresses	*/
 #define CONFIG_SYS_DTT_MAX_TEMP	70
 #define CONFIG_SYS_DTT_LOW_TEMP	-30
@@ -275,14 +275,14 @@
 
 #if !defined(CONFIG_ARCHES)
 /* RTC configuration */
-#define CONFIG_RTC_M41T62	1
+#define CONFIG_RTC_M41T62
 #define CONFIG_SYS_I2C_RTC_ADDR	0x68
 #endif
 
 /*-----------------------------------------------------------------------
  * Ethernet
  *----------------------------------------------------------------------*/
-#define CONFIG_IBM_EMAC4_V4	1
+#define CONFIG_IBM_EMAC4_V4
 
 #define CONFIG_HAS_ETH0
 #define CONFIG_HAS_ETH1
@@ -322,9 +322,9 @@
 #define CONFIG_GPCS_PHY2_ADDR   0xC
 #endif	/* !defined(CONFIG_ARCHES) */
 
-#define CONFIG_PHY_RESET	1	/* reset phy upon startup	*/
-#define CONFIG_PHY_GIGE		1	/* Include GbE speed/duplex detection */
-#define CONFIG_PHY_DYNAMIC_ANEG	1
+#define CONFIG_PHY_RESET		/* reset phy upon startup	*/
+#define CONFIG_PHY_GIGE			/* Include GbE speed/duplex detection */
+#define CONFIG_PHY_DYNAMIC_ANEG
 
 /*-----------------------------------------------------------------------
  * USB-OHCI
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#6 lore raw

PATCH v2 3/19 powerpc: ppc4xx: canyonlands: config: Tidy up CONFIGs and config.mk

Quoted 5 lines · Simon Glass

Many CONFIG options have an unnecessary value of 1. CONFIG_440 is set in the various board config files. Also simplify the CONFIG_440 check in config.mk

Quoted 8 lines

---

Changes in v2: None

 arch/powerpc/cpu/ppc4xx/config.mk |  5 +----
 board/amcc/canyonlands/config.mk  |  2 --
 include/configs/canyonlands.h     | 34 +++++++++++++++++-----------------
 3 files changed, 18 insertions(+), 23 deletions(-)

Applied to u-boot-dm.

#7 lore raw

PATCH v2 4/19 powerpc: ppc4xx: Move CANYONLANDS/GLACIER/ARCHES to Kconfig

In reply to Simon Glass

Move these options to Kconfig and remove them from the CONFIG files.

---

Changes in v2: None

 board/amcc/canyonlands/Kconfig | 20 ++++++++++++++++++++
 configs/arches_defconfig       |  2 +-
 configs/canyonlands_defconfig  |  2 +-
 configs/glacier_defconfig      |  2 +-
 include/configs/canyonlands.h  |  2 ++
 5 files changed, 25 insertions(+), 3 deletions(-)
board/amcc/canyonlands/Kconfig +20 -0
index 530a6ef..0fc6877 100644
@@ -9,4 +9,24 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "canyonlands"
 
+choice BOARD_TYPE
+	prompt "Select which board to build for"
+
+config CANYONLANDS
+	bool "Glacier"
+	help
+	  Select this to build for the Canyonlands 460EX board.
+
+config GLACIER
+	bool "Glacier"
+	help
+	  Select this to build for the Glacier 460GT board.
+
+config ARCHES
+	bool "Arches"
+	help
+	  Select this to build for the Arches dual 460GT board.
+
+endchoice
+
 endif
configs/arches_defconfig +1 -1
index 18d0a14..60e6ef9 100644
@@ -1,4 +1,4 @@
-CONFIG_SYS_EXTRA_OPTIONS="ARCHES"
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_CANYONLANDS=y
+CONFIG_ARCHES=y
configs/canyonlands_defconfig +1 -1
index 09b9ab9..37a2b4d 100644
@@ -1,4 +1,4 @@
-CONFIG_SYS_EXTRA_OPTIONS="CANYONLANDS"
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_CANYONLANDS=y
+CONFIG_CANYONLANDS=y
configs/glacier_defconfig +1 -1
index 2a66bfb..436b9f8 100644
@@ -1,4 +1,4 @@
-CONFIG_SYS_EXTRA_OPTIONS="GLACIER"
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_CANYONLANDS=y
+CONFIG_GLACIER=y
include/configs/canyonlands.h +2 -0
index 7b1f368..ed790cc 100644
@@ -11,6 +11,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/kconfig.h>
+
 /*-----------------------------------------------------------------------
  * High Level Configuration Options
  *----------------------------------------------------------------------*/
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#8 lore raw

PATCH v2 4/19 powerpc: ppc4xx: Move CANYONLANDS/GLACIER/ARCHES to Kconfig

Quoted 5 lines · Simon Glass

Move these options to Kconfig and remove them from the CONFIG files.

---

Quoted 8 lines

Changes in v2: None

 board/amcc/canyonlands/Kconfig | 20 ++++++++++++++++++++
 configs/arches_defconfig       |  2 +-
 configs/canyonlands_defconfig  |  2 +-
 configs/glacier_defconfig      |  2 +-
 include/configs/canyonlands.h  |  2 ++
 5 files changed, 25 insertions(+), 3 deletions(-)

Applied to u-boot-dm.

#9 lore raw

PATCH v2 5/19 powerpc: ppc4xx: Add ramboot config for glacier

In reply to Simon Glass

Add a new ramboot config for glacier so that it is possible to test U-Boot loaded over Ethernet instead of using JTAG.

---

Changes in v2: None

 arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c |  8 ++++
 board/amcc/canyonlands/MAINTAINERS     |  1 +
 board/amcc/canyonlands/u-boot-ram.lds  | 79 ++++++++++++++++++++++++++++++++++
 configs/glacier_ramboot_defconfig      |  5 +++
 4 files changed, 93 insertions(+)
 create mode 100644 board/amcc/canyonlands/u-boot-ram.lds
 create mode 100644 configs/glacier_ramboot_defconfig
arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c +8 -0
index 71bb9d7..7202c3f 100644
@@ -424,6 +424,14 @@ phys_size_t initdram(int board_type)
 	int write_recovery;
 	phys_size_t dram_size = 0;
 
+	if (IS_ENABLED(CONFIG_SYS_RAMBOOT)) {
+		/*
+		 * Reduce RAM size to avoid overwriting memory used by
+		 * current stack? Not sure what is happening.
+		 */
+		return sdram_memsize() / 2;
+	}
+
 	num_dimm_banks = sizeof(iic0_dimm_addr);
 
 	/*------------------------------------------------------------------
board/amcc/canyonlands/MAINTAINERS +1 -0
index 52bf004..8be8a52 100644
@@ -6,3 +6,4 @@ F:	include/configs/canyonlands.h
 F:	configs/arches_defconfig
 F:	configs/canyonlands_defconfig
 F:	configs/glacier_defconfig
+F:	configs/glacier_ramboot_defconfig
board/amcc/canyonlands/u-boot-ram.lds new file +79 -0

79 lines not on this page · raw message

configs/glacier_ramboot_defconfig new file +5 -0
new file mode 100644
index 0000000..4fc2303
@@ -0,0 +1,5 @@
+CONFIG_SYS_EXTRA_OPTIONS="SYS_RAMBOOT,SYS_TEXT_BASE=0x01000000,SYS_LDSCRIPT=board/amcc/canyonlands/u-boot-ram.lds"
+CONFIG_PPC=y
+CONFIG_4xx=y
+CONFIG_TARGET_CANYONLANDS=y
+CONFIG_GLACIER=y
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#10 lore raw

PATCH v2 5/19 powerpc: ppc4xx: Add ramboot config for glacier

Quoted 8 lines · Simon Glass

Add a new ramboot config for glacier so that it is possible to test U-Boot loaded over Ethernet instead of using JTAG.

---

Changes in v2: None

Quoted 7 lines
 arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c |  8 ++++
 board/amcc/canyonlands/MAINTAINERS     |  1 +
 board/amcc/canyonlands/u-boot-ram.lds  | 79 ++++++++++++++++++++++++++++++++++
 configs/glacier_ramboot_defconfig      |  5 +++
 4 files changed, 93 insertions(+)
 create mode 100644 board/amcc/canyonlands/u-boot-ram.lds
 create mode 100644 configs/glacier_ramboot_defconfig

Applied to u-boot-dm.

#11 lore raw

PATCH v2 6/19 powerpc: ppc4xx: canyonlands: Move to generic board

In reply to Simon Glass

Switch to generic board so that this board will not be broken/removed.

---

Changes in v2: None

 arch/powerpc/cpu/ppc4xx/cpu_init.c | 2 ++
 include/configs/canyonlands.h      | 2 ++
 2 files changed, 4 insertions(+)
arch/powerpc/cpu/ppc4xx/cpu_init.c +2 -0
index e5a0e21..5f5c720 100644
@@ -450,10 +450,12 @@ cpu_init_f (void)
 	      PLB4Ax_ACR_RDP_4DEEP);
 #endif /* CONFIG_440SP/SPE || CONFIG_460EX/GT || CONFIG_405EX */
 
+#ifndef CONFIG_SYS_GENERIC_BOARD
 	gd = (gd_t *)(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
 
 	/* Clear initial global data */
 	memset((void *)gd, 0, sizeof(gd_t));
+#endif
 }
 
 /*
include/configs/canyonlands.h +2 -0
index ed790cc..7a1499d 100644
@@ -13,6 +13,8 @@
 
 #include <linux/kconfig.h>
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 /*-----------------------------------------------------------------------
  * High Level Configuration Options
  *----------------------------------------------------------------------*/
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#12 lore raw

PATCH v2 6/19 powerpc: ppc4xx: canyonlands: Move to generic board

Quoted 10 lines · Simon Glass

Switch to generic board so that this board will not be broken/removed.

---

Changes in v2: None

 arch/powerpc/cpu/ppc4xx/cpu_init.c | 2 ++
 include/configs/canyonlands.h      | 2 ++
 2 files changed, 4 insertions(+)

Applied to u-boot-dm.

#13 lore raw

PATCH v2 7/19 WIP: powerpc: ppc4xx: Somehow BSS is not cleared in RAMBOOT case

In reply to Simon Glass

From: Stefan Roese <[email protected]>

(NOT TO APPLY)

I'm really not sure why this doesn't work in the RAMBOOT case. But BSS is not cleared and because of this booting crashed / hangs at some stage later. Something with the GOT calculation / handling is incorrect.

To get this going for now, just clear the BSS again in the C code.

---

Changes in v2: None

 arch/powerpc/lib/board.c | 3 +++
 common/board_r.c         | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
arch/powerpc/lib/board.c +3 -0
index 91645d3..47654fa 100644
@@ -108,6 +108,7 @@ DECLARE_GLOBAL_DATA_PTR;
 extern ulong __init_end;
 extern ulong __bss_end;
 ulong monitor_flash_len;
+extern ulong __bss_start;
 
 #if defined(CONFIG_CMD_BEDBUG)
 #include <bedbug/type.h>
@@ -590,6 +591,8 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	/* The Malloc area is immediately below the monitor copy in DRAM */
 	malloc_start = dest_addr - TOTAL_MALLOC_LEN;
 
+	memset(&__bss_start, 0, &__bss_end - &__bss_start);
+
 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
 	/*
 	 * The gd->arch.cpu pointer is set to an address in flash before
common/board_r.c +7 -1
index 68a9448..6900374 100644
@@ -1,4 +1,4 @@
-/*
+	/*
  * Copyright (c) 2011 The Chromium OS Authors.
  * (C) Copyright 2002-2006
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
@@ -870,6 +870,12 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 	gd = new_gd;
 #endif
 
+#ifdef CONFIG_GLACIER
+	ulong bss_start = (ulong)&__bss_start;
+	ulong bss_end = (ulong)&__bss_end;
+	memset((void *)bss_start, 0, bss_end - bss_start);
+#endif
+
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
 	for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
 		init_sequence_r[i] += gd->reloc_off;
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#14 lore raw

PATCH v2 8/19 powerpc: ppc4xx: dts: Bring in canyonlands device tree files

In reply to Simon Glass

The canyonlands.h config file works with canyonlands, glacier and arches boards. Bring in the device tree files for these from Linux 3.17.

---

Changes in v2: None

 arch/powerpc/dts/Makefile        |  11 +
 arch/powerpc/dts/arches.dts      | 339 +++++++++++++++++++++++
 arch/powerpc/dts/canyonlands.dts | 555 +++++++++++++++++++++++++++++++++++++
 arch/powerpc/dts/glacier.dts     | 579 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 1484 insertions(+)
 create mode 100644 arch/powerpc/dts/Makefile
 create mode 100644 arch/powerpc/dts/arches.dts
 create mode 100644 arch/powerpc/dts/canyonlands.dts
 create mode 100644 arch/powerpc/dts/glacier.dts
arch/powerpc/dts/Makefile new file +11 -0
new file mode 100644
index 0000000..ad104b9
@@ -0,0 +1,11 @@
+dtb-$(CONFIG_TARGET_CANYONLANDS) += arches.dtb canyonlands.dtb glacier.dtb
+
+targets += $(dtb-y)
+
+DTC_FLAGS += -R 4 -p 0x1000
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+	@:
+
+clean-files := *.dtb
arch/powerpc/dts/arches.dts new file +339 -0

339 lines not on this page · raw message

arch/powerpc/dts/canyonlands.dts new file +555 -0

555 lines not on this page · raw message

arch/powerpc/dts/glacier.dts new file +579 -0

579 lines not on this page · raw message

Signature · 1 line
2.2.0.rc0.207.ga3a616c
#15 lore raw

PATCH v2 8/19 powerpc: ppc4xx: dts: Bring in canyonlands device tree files

Quoted 8 lines · Simon Glass

The canyonlands.h config file works with canyonlands, glacier and arches boards. Bring in the device tree files for these from Linux 3.17.

---

Changes in v2: None

Quoted 9 lines
 arch/powerpc/dts/Makefile        |  11 +
 arch/powerpc/dts/arches.dts      | 339 +++++++++++++++++++++++
 arch/powerpc/dts/canyonlands.dts | 555 +++++++++++++++++++++++++++++++++++++
 arch/powerpc/dts/glacier.dts     | 579 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 1484 insertions(+)
 create mode 100644 arch/powerpc/dts/Makefile
 create mode 100644 arch/powerpc/dts/arches.dts
 create mode 100644 arch/powerpc/dts/canyonlands.dts
 create mode 100644 arch/powerpc/dts/glacier.dts

Applied to u-boot-dm.

#16 lore raw

PATCH v2 9/19 powerpc: ppc4xx: Call board_init_f_mem() for generic board

In reply to Simon Glass

Call this function to set up our early memory.

---

Changes in v2: None

 arch/powerpc/cpu/ppc4xx/start.S | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
arch/powerpc/cpu/ppc4xx/start.S +17 -1
index 09a02d7..7a0f0d2 100644
@@ -760,6 +760,15 @@ _start:
 #endif
 
 	bl	cpu_init_f	/* run low-level CPU init code	   (from Flash) */
+#ifdef CONFIG_SYS_GENERIC_BOARD
+	mr	r3, r1
+	bl	board_init_f_mem
+	mr	r1, r3
+	li	r0,0
+	stwu	r0, -4(r1)
+	stwu	r0, -4(r1)
+#endif
+	li	r3, 0
 	bl	board_init_f
 	/* NOTREACHED - board_init_f() does not return */
 
@@ -1027,7 +1036,14 @@ _start:
 	GET_GOT			/* initialize GOT access			*/
 
 	bl	cpu_init_f	/* run low-level CPU init code	   (from Flash) */
-
+#ifdef CONFIG_SYS_GENERIC_BOARD
+	mr	r3, r1
+	bl	board_init_f_mem
+	mr	r1, r3
+	stwu	r0, -4(r1)
+	stwu	r0, -4(r1)
+#endif
+	li	r3, 0
 	bl	board_init_f	/* run first part of init code (from Flash)	*/
 	/* NOTREACHED - board_init_f() does not return */
 
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#17 lore raw

PATCH v2 9/19 powerpc: ppc4xx: Call board_init_f_mem() for generic board

Quoted 9 lines · Simon Glass

Call this function to set up our early memory.

---

Changes in v2: None

 arch/powerpc/cpu/ppc4xx/start.S | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Applied to u-boot-dm.

#18 lore raw

PATCH v2 10/19 powerpc: ppc4xx: Add a gpio.h header file

In reply to Simon Glass

This is required at present for device tree control. The ppc4xx does support GPIOs but does not seem to have a proper driver. So this file is empty.

---

Changes in v2: None

 arch/powerpc/include/asm/arch-ppc4xx/gpio.h | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 arch/powerpc/include/asm/arch-ppc4xx/gpio.h
arch/powerpc/include/asm/arch-ppc4xx/gpio.h new file +7 -0
new file mode 100644
index 0000000..3d960c3
@@ -0,0 +1,7 @@
+/*
+ * (C) Copyright 2014 Google, Inc
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+/* This is empty for now as we don't support the generic GPIO interface */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#19 lore raw

PATCH v2 10/19 powerpc: ppc4xx: Add a gpio.h header file

Quoted 11 lines · Simon Glass

This is required at present for device tree control. The ppc4xx does support GPIOs but does not seem to have a proper driver. So this file is empty.

---

Changes in v2: None

 arch/powerpc/include/asm/arch-ppc4xx/gpio.h | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 arch/powerpc/include/asm/arch-ppc4xx/gpio.h

Applied to u-boot-dm.

#20 lore raw

PATCH v2 11/19 powerpc: ppc4xx: Allow the end of u-boot.bin to be found

In reply to Simon Glass

Define an _end symbol indicating the end of u-boot.bin. Also add some dummy words into the link script to ensure that u-boot.bin will always extend that far. There may be a better way of doing this.

---

Changes in v2: None

 arch/powerpc/cpu/ppc4xx/u-boot.lds | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/cpu/ppc4xx/u-boot.lds +6 -2
index 8773178..1980508 100644
@@ -76,9 +76,13 @@ SECTIONS
   . = ALIGN(256);
   __init_begin = .;
   .text.init : { *(.text.init) }
-  .data.init : { *(.data.init) }
-  . = ALIGN(256);
+  .data.init : {
+	*(.data.init)
+	. = ALIGN(256);
+	LONG(0) LONG(0)		/* Extend u-boot.bin to here */
+  }
   __init_end = .;
+  _end = .;
 
 #ifndef CONFIG_SPL
 #ifdef CONFIG_440
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#21 lore raw

PATCH v2 11/19 powerpc: ppc4xx: Allow the end of u-boot.bin to be found

Quoted 11 lines · Simon Glass

Define an _end symbol indicating the end of u-boot.bin. Also add some dummy words into the link script to ensure that u-boot.bin will always extend that far. There may be a better way of doing this.

---

Changes in v2: None

 arch/powerpc/cpu/ppc4xx/u-boot.lds | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Applied to u-boot-dm.

#22 lore raw

PATCH v2 12/19 powerpc: ppc4xx: Use CONFIG_OF_CONTROL for canyonlands boards

In reply to Simon Glass

Enable CONFIG_OF_CONTROL so that U-Boot on these three boards uses a device tree for its configuration.

---

Changes in v2: None

 board/amcc/canyonlands/u-boot-ram.lds | 10 ++++++++--
 configs/arches_defconfig              |  3 +++
 configs/canyonlands_defconfig         |  3 +++
 configs/glacier_defconfig             |  3 +++
 configs/glacier_ramboot_defconfig     |  3 +++
 5 files changed, 20 insertions(+), 2 deletions(-)
board/amcc/canyonlands/u-boot-ram.lds +8 -2
index 6765256..1750c74 100644
@@ -12,6 +12,7 @@ SECTIONS
   . = + SIZEOF_HEADERS;
   .text      :
   {
+    _image_copy_start = .;
     arch/powerpc/cpu/ppc4xx/start.o	(.text*)
     board/amcc/canyonlands/init.o	(.text*)
 
@@ -61,9 +62,14 @@ SECTIONS
   . = ALIGN(256);
   __init_begin = .;
   .text.init : { *(.text.init) }
-  .data.init : { *(.data.init) }
-  . = ALIGN(256);
+  .data.init : {
+	*(.data.init)
+	. = ALIGN(256);
+	LONG(0) LONG(0)		/* Extend u-boot.bin to here */
+  }
   __init_end = .;
+  _end = .;
+  _image_binary_end = .;
 
   __bss_start = .;
   .bss (NOLOAD)       :
configs/arches_defconfig +3 -0
index 60e6ef9..30c6932 100644
@@ -2,3 +2,6 @@ CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_CANYONLANDS=y
 CONFIG_ARCHES=y
+CONFIG_DEFAULT_DEVICE_TREE="arches"
+CONFIG_OF_CONTROL=y
+CONFIG_OF_SEPARATE=y
configs/canyonlands_defconfig +3 -0
index 37a2b4d..6f6cf14 100644
@@ -2,3 +2,6 @@ CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_CANYONLANDS=y
 CONFIG_CANYONLANDS=y
+CONFIG_DEFAULT_DEVICE_TREE="canyonlands"
+CONFIG_OF_CONTROL=y
+CONFIG_OF_SEPARATE=y
configs/glacier_defconfig +3 -0
index 436b9f8..e67fa32 100644
@@ -2,3 +2,6 @@ CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_CANYONLANDS=y
 CONFIG_GLACIER=y
+CONFIG_DEFAULT_DEVICE_TREE="glacier"
+CONFIG_OF_CONTROL=y
+CONFIG_OF_SEPARATE=y
configs/glacier_ramboot_defconfig +3 -0
index 4fc2303..e5b402e 100644
@@ -3,3 +3,6 @@ CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_CANYONLANDS=y
 CONFIG_GLACIER=y
+CONFIG_DEFAULT_DEVICE_TREE="glacier"
+CONFIG_OF_CONTROL=y
+CONFIG_OF_SEPARATE=y
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#23 lore raw

PATCH v2 12/19 powerpc: ppc4xx: Use CONFIG_OF_CONTROL for canyonlands boards

Quoted 6 lines · Simon Glass

Enable CONFIG_OF_CONTROL so that U-Boot on these three boards uses a device tree for its configuration.

---

Quoted 8 lines

Changes in v2: None

 board/amcc/canyonlands/u-boot-ram.lds | 10 ++++++++--
 configs/arches_defconfig              |  3 +++
 configs/canyonlands_defconfig         |  3 +++
 configs/glacier_defconfig             |  3 +++
 configs/glacier_ramboot_defconfig     |  3 +++
 5 files changed, 20 insertions(+), 2 deletions(-)

Applied to u-boot-dm.

#24 lore raw

PATCH v2 13/19 ppc: amcc: Omit unneeded ns16550 CONFIG if using driver model

In reply to Simon Glass

This comes from the device tree or a call to get_uart_clock().

---

Changes in v2: None

 arch/powerpc/include/asm/ppc460ex_gt.h | 2 ++
 include/configs/amcc-common.h          | 2 ++
 2 files changed, 4 insertions(+)
arch/powerpc/include/asm/ppc460ex_gt.h +2 -0
index f41df0d..ea019aa 100644
@@ -19,10 +19,12 @@
 /* Memory mapped registers */
 #define CONFIG_SYS_PERIPHERAL_BASE	0xef600000 /* Internal Peripherals */
 
+#ifndef CONFIG_DM_SERIAL
 #define CONFIG_SYS_NS16550_COM1	(CONFIG_SYS_PERIPHERAL_BASE + 0x0300)
 #define CONFIG_SYS_NS16550_COM2	(CONFIG_SYS_PERIPHERAL_BASE + 0x0400)
 #define CONFIG_SYS_NS16550_COM3	(CONFIG_SYS_PERIPHERAL_BASE + 0x0500)
 #define CONFIG_SYS_NS16550_COM4	(CONFIG_SYS_PERIPHERAL_BASE + 0x0600)
+#endif
 
 #define GPIO0_BASE		(CONFIG_SYS_PERIPHERAL_BASE + 0x0b00)
 #define GPIO1_BASE		(CONFIG_SYS_PERIPHERAL_BASE + 0x0c00)
include/configs/amcc-common.h +2 -0
index 2aea899..73e1b0a 100644
@@ -20,8 +20,10 @@
  */
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
+#ifndef CONFIG_DM_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
+#endif
 #define CONFIG_BAUDRATE		115200
 #define CONFIG_SYS_BAUDRATE_TABLE  \
     {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#25 lore raw

PATCH v2 13/19 ppc: amcc: Omit unneeded ns16550 CONFIG if using driver model

Quoted 10 lines · Simon Glass

This comes from the device tree or a call to get_uart_clock().

---

Changes in v2: None

 arch/powerpc/include/asm/ppc460ex_gt.h | 2 ++
 include/configs/amcc-common.h          | 2 ++
 2 files changed, 4 insertions(+)

Applied to u-boot-dm.

#26 lore raw

PATCH v2 14/19 powerpc: Add serial driver for driver model

In reply to Simon Glass

This uses the ns16550 driver but sets up the clock at run-time. It does not seem to be available in the device tree.

---

Changes in v2: None

 drivers/serial/Makefile     |  1 +
 drivers/serial/serial_ppc.c | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 drivers/serial/serial_ppc.c
drivers/serial/Makefile +1 -0
index 4cc00cd..63b0cbf 100644
@@ -8,6 +8,7 @@
 ifdef CONFIG_DM_SERIAL
 obj-y += serial-uclass.o
 obj-$(CONFIG_PL01X_SERIAL) += serial_pl01x.o
+obj-$(CONFIG_PPC) += serial_ppc.o
 else
 obj-y += serial.o
 obj-$(CONFIG_PL010_SERIAL) += serial_pl01x.o
drivers/serial/serial_ppc.c new file +40 -0
new file mode 100644
index 0000000..47141c6
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014 Google, Inc
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <ns16550.h>
+#include <serial.h>
+
+static const struct udevice_id ppc_serial_ids[] = {
+	{ .compatible = "ns16550" },
+	{ }
+};
+
+static int ppc_serial_ofdata_to_platdata(struct udevice *dev)
+{
+	struct ns16550_platdata *plat = dev_get_platdata(dev);
+	int ret;
+
+	ret = ns16550_serial_ofdata_to_platdata(dev);
+	if (ret)
+		return ret;
+	plat->clock = get_serial_clock();
+
+	return 0;
+}
+
+U_BOOT_DRIVER(serial_ns16550) = {
+	.name	= "serial_ppc",
+	.id	= UCLASS_SERIAL,
+	.of_match = ppc_serial_ids,
+	.ofdata_to_platdata = ppc_serial_ofdata_to_platdata,
+	.platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
+	.priv_auto_alloc_size = sizeof(struct NS16550),
+	.probe = ns16550_serial_probe,
+	.ops	= &ns16550_serial_ops,
+	.flags	= DM_FLAG_PRE_RELOC,
+};
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#27 lore raw

PATCH v2 14/19 powerpc: Add serial driver for driver model

Quoted 4 lines · Simon Glass

This uses the ns16550 driver but sets up the clock at run-time. It does not seem to be available in the device tree.

Quoted 8 lines

---

Changes in v2: None

 drivers/serial/Makefile     |  1 +
 drivers/serial/serial_ppc.c | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 drivers/serial/serial_ppc.c

Applied to u-boot-dm.

#28 lore raw

PATCH v2 15/19 dm: powerpc: ppc4xx: Move glacier to use driver model for serial

In reply to Simon Glass

Adjust Kconfig to default to driver model for glacier, canyonlands and arches.

---

Changes in v2:
- Add SYS_MALLOC_F to Kconfig

 board/amcc/canyonlands/Kconfig | 12 ++++++++++++
 1 file changed, 12 insertions(+)
board/amcc/canyonlands/Kconfig +12 -0
index 0fc6877..1617d95 100644
@@ -29,4 +29,16 @@ config ARCHES
 
 endchoice
 
+config DM
+	default y
+
+config DM_SERIAL
+	default y
+
+config SYS_MALLOC_F
+	default y
+
+config SYS_MALLOC_F_LEN
+	default 0x400
+
 endif
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#29 lore raw

PATCH v2 15/19 dm: powerpc: ppc4xx: Move glacier to use driver model for serial

Quoted 11 lines · Simon Glass

Adjust Kconfig to default to driver model for glacier, canyonlands and arches.

---

Changes in v2:
- Add SYS_MALLOC_F to Kconfig

 board/amcc/canyonlands/Kconfig | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Applied to u-boot-dm.

#30 lore raw

PATCH v2 16/19 powerpc: Add linkage.h file

In reply to Simon Glass

This permits us to use linux/linkage.h on PowerPC machines.

---

Changes in v2: None

 arch/powerpc/include/asm/linkage.h | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 arch/powerpc/include/asm/linkage.h
arch/powerpc/include/asm/linkage.h new file +7 -0
new file mode 100644
index 0000000..559b42e
@@ -0,0 +1,7 @@
+/*
+ * Copyright (c) 2014 Google, Inc
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+/* We don't need anything here at present */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#31 lore raw

PATCH v2 16/19 powerpc: Add linkage.h file

Quoted 10 lines · Simon Glass

This permits us to use linux/linkage.h on PowerPC machines.

---

Changes in v2: None

 arch/powerpc/include/asm/linkage.h | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 arch/powerpc/include/asm/linkage.h

Applied to u-boot-dm.

#32 lore raw

PATCH v2 17/19 powerpc: ppc4xx: Change from OF_SEPARATE to OF_EMBED

In reply to Simon Glass

From: Stefan Roese <[email protected]>

This is necessary, as ppc4xx has the reset vector located at the end of the U-Boot image. This needs to be flashed to the end of the NOR flash. Adding the dtb to the main U-Boot image will break booting on ppc4xx. This patch now embeds the dtb in the U-Boot image instead.

---

Changes in v2: None

 configs/canyonlands_defconfig     | 2 +-
 configs/glacier_defconfig         | 2 +-
 configs/glacier_ramboot_defconfig | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
configs/canyonlands_defconfig +1 -1
index 6f6cf14..44d4fbd 100644
@@ -4,4 +4,4 @@ CONFIG_TARGET_CANYONLANDS=y
 CONFIG_CANYONLANDS=y
 CONFIG_DEFAULT_DEVICE_TREE="canyonlands"
 CONFIG_OF_CONTROL=y
-CONFIG_OF_SEPARATE=y
+CONFIG_OF_EMBED=y
configs/glacier_defconfig +1 -1
index e67fa32..d318f82 100644
@@ -4,4 +4,4 @@ CONFIG_TARGET_CANYONLANDS=y
 CONFIG_GLACIER=y
 CONFIG_DEFAULT_DEVICE_TREE="glacier"
 CONFIG_OF_CONTROL=y
-CONFIG_OF_SEPARATE=y
+CONFIG_OF_EMBED=y
configs/glacier_ramboot_defconfig +1 -1
index e5b402e..f8363b2 100644
@@ -5,4 +5,4 @@ CONFIG_TARGET_CANYONLANDS=y
 CONFIG_GLACIER=y
 CONFIG_DEFAULT_DEVICE_TREE="glacier"
 CONFIG_OF_CONTROL=y
-CONFIG_OF_SEPARATE=y
+CONFIG_OF_EMBED=y
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#33 lore raw

PATCH v2 17/19 powerpc: ppc4xx: Change from OF_SEPARATE to OF_EMBED

Quoted 11 lines · Simon Glass

From: Stefan Roese <[email protected]>

This is necessary, as ppc4xx has the reset vector located at the end of the U-Boot image. This needs to be flashed to the end of the NOR flash. Adding the dtb to the main U-Boot image will break booting on ppc4xx. This patch now embeds the dtb in the U-Boot image instead.

Quoted 8 lines

---

Changes in v2: None

 configs/canyonlands_defconfig     | 2 +-
 configs/glacier_defconfig         | 2 +-
 configs/glacier_ramboot_defconfig | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Applied to u-boot-dm, thanks!

#34 lore raw

PATCH v2 17/19 powerpc: ppc4xx: Change from OF_SEPARATE to OF_EMBED

In reply to Simon Glass

Hi,

Quoted 7 lines · On Sat, 7 Feb 2015 11:51:50 -0700 Simon Glass <[email protected]> wrote:

From: Stefan Roese <[email protected]>

This is necessary, as ppc4xx has the reset vector located at the end of the U-Boot image. This needs to be flashed to the end of the NOR flash. Adding the dtb to the main U-Boot image will break booting on ppc4xx. This patch now embeds the dtb in the U-Boot image instead.

Quoted 5 lines

---

It this a common requirement for PowerPC architecture? If so, does it make sense to change default value only for PowerPC?

choice
prompt "Provider of DTB for DT control"
depends on OF_CONTROL
default OF_EMBED if PPC

Or, introduce OF_SEPARATE_TOP ??
I do not know...

Best Regards
Masahiro Yamada

#35 lore raw

PATCH v2 17/19 powerpc: ppc4xx: Change from OF_SEPARATE to OF_EMBED

Quoted 10 lines · Masahiro Yamada
Quoted 7 lines · On Sat, 7 Feb 2015 11:51:50 -0700 Simon Glass <[email protected]> wrote:

From: Stefan Roese <[email protected]>

This is necessary, as ppc4xx has the reset vector located at the end of the U-Boot image. This needs to be flashed to the end of the NOR flash. Adding the dtb to the main U-Boot image will break booting on ppc4xx. This patch now embeds the dtb in the U-Boot image instead.

Quoted 8 lines
Quoted 5 lines

---

It this a common requirement for PowerPC architecture?

No. Its specific to PPC4xx, and perhaps some other PPC variants. But not generally for PowerPC.

Quoted 1 line

If so, does it make sense to change default value only for PowerPC?

Might make sense. Or perhaps even for PPC4xx?

Quoted 5 lines

choice
prompt "Provider of DTB for DT control"
depends on OF_CONTROL
default OF_EMBED if PPC

default OF_EMBED if 4xx

Does this work?

Thanks,
Stefan

#36 lore raw

PATCH v2 18/19 powerpc: ppc4xx: Add defaults for DT based booting to really work

In reply to Simon Glass

From: Stefan Roese <[email protected]>

These additional nodes need to be provided to get U-Boot to boot correctly on the Canyonlands / Glacier board:

- chosen path to the console-uart
- reg-shift set to 0 in the uart device nodes

---

Changes in v2: None

 arch/powerpc/dts/canyonlands.dts | 6 ++++++
 arch/powerpc/dts/glacier.dts     | 3 +++
 2 files changed, 9 insertions(+)
arch/powerpc/dts/canyonlands.dts +6 -0
index 2ec9762..0a2f5d7 100644
@@ -22,6 +22,10 @@
 		serial1 = &UART1;
 	};
 
+	chosen {
+		stdout-path = &UART0;
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -280,6 +284,7 @@
 
 			UART0: serial at ef600300 {
 				device_type = "serial";
+				reg-shift = <0>;
 				compatible = "ns16550";
 				reg = <0xef600300 0x00000008>;
 				virtual-reg = <0xef600300>;
@@ -291,6 +296,7 @@
 
 			UART1: serial at ef600400 {
 				device_type = "serial";
+				reg-shift = <0>;
 				compatible = "ns16550";
 				reg = <0xef600400 0x00000008>;
 				virtual-reg = <0xef600400>;
arch/powerpc/dts/glacier.dts +3 -0
index 3e7ce2c..bb4e819 100644
@@ -251,6 +251,7 @@
 
 			UART1: serial at ef600400 {
 				device_type = "serial";
+				reg-shift = <0>;
 				compatible = "ns16550";
 				reg = <0xef600400 0x00000008>;
 				virtual-reg = <0xef600400>;
@@ -262,6 +263,7 @@
 
 			UART2: serial at ef600500 {
 				device_type = "serial";
+				reg-shift = <0>;
 				compatible = "ns16550";
 				reg = <0xef600500 0x00000008>;
 				virtual-reg = <0xef600500>;
@@ -273,6 +275,7 @@
 
 			UART3: serial at ef600600 {
 				device_type = "serial";
+				reg-shift = <0>;
 				compatible = "ns16550";
 				reg = <0xef600600 0x00000008>;
 				virtual-reg = <0xef600600>;
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#37 lore raw

PATCH v2 18/19 powerpc: ppc4xx: Add defaults for DT based booting to really work

Quoted 12 lines · Simon Glass

From: Stefan Roese <[email protected]>

These additional nodes need to be provided to get U-Boot to boot correctly on the Canyonlands / Glacier board:

- chosen path to the console-uart
- reg-shift set to 0 in the uart device nodes

Quoted 7 lines

---

Changes in v2: None

 arch/powerpc/dts/canyonlands.dts | 6 ++++++
 arch/powerpc/dts/glacier.dts     | 3 +++
 2 files changed, 9 insertions(+)

Applied to u-boot-dm, thanks!

#38 lore raw

PATCH v2 19/19 powerpc: ppc4xx: Enable CONFIG_DISPLAY_BOARDINFO

In reply to Simon Glass

From: Stefan Roese <[email protected]>

This also displays the "Board:" line in the bootup text with the generic board support code.

---

Changes in v2: None

 board/amcc/canyonlands/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
board/amcc/canyonlands/Kconfig +4 -0
index 1617d95..ba1411c 100644
@@ -29,6 +29,10 @@ config ARCHES
 
 endchoice
 
+config DISPLAY_BOARDINFO
+	bool
+	default y
+
 config DM
 	default y
 
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#39 lore raw

PATCH v2 19/19 powerpc: ppc4xx: Enable CONFIG_DISPLAY_BOARDINFO

Quoted 9 lines · Simon Glass

From: Stefan Roese <[email protected]>

This also displays the "Board:" line in the bootup text with the generic board support code.

Quoted 6 lines

---

Changes in v2: None

 board/amcc/canyonlands/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)

Applied to u-boot-dm, thanks!

#40 lore raw

v2 cover powerpc: Introduce device tree control and driver model

In reply to Simon Glass

Hi,

Quoted 10 lines · Simon Glass

This series does a small amount of tweaking to support device tree control (CONFIG_OF_CONTROL) on PowerPC platforms. It also adds support for driver model. In both cases the main effort is to set things up correctly before calling board_init_f().

A new generic function, board_init_f_mem() is introduced. This does the various memory calculations in C code, since they are messy in assembler and every architecture should in fact be the same. A later series will adjust ARM and x86 to use this function.

Quoted 7 lines

As an example, the Canyonlands boards are converted over to use device tree control and driver model for their serial console. It should be fairly straightforward to convert over other boards.

Changes in v2:
- Reduce reserved stack space for board_init_f_mem() to 64 bytes
- Add SYS_MALLOC_F to Kconfig

I'm trying to catch up on a few things I haven't got to.

If it suits I can apply this to u-boot-dm since it is a driver-model-enablement series and Stefan has tested it.

Regards,
Simon

#41 lore raw

v2 cover powerpc: Introduce device tree control and driver model

Hi,

Quoted 17 lines · Simon Glass

Hi,

Quoted 14 lines · Simon Glass

This series does a small amount of tweaking to support device tree control (CONFIG_OF_CONTROL) on PowerPC platforms. It also adds support for driver model. In both cases the main effort is to set things up correctly before calling board_init_f().

A new generic function, board_init_f_mem() is introduced. This does the various memory calculations in C code, since they are messy in assembler and every architecture should in fact be the same. A later series will adjust ARM and x86 to use this function.

As an example, the Canyonlands boards are converted over to use device tree control and driver model for their serial console. It should be fairly straightforward to convert over other boards.

Quoted 8 lines
Quoted 3 lines

Changes in v2:
- Reduce reserved stack space for board_init_f_mem() to 64 bytes
- Add SYS_MALLOC_F to Kconfig

I'm trying to catch up on a few things I haven't got to.

If it suits I can apply this to u-boot-dm since it is a driver-model-enablement series and Stefan has tested it.

OK unless I hear any screams I'm going ahead with that plan this week.

Regards,
Simon

#42 lore raw

v2 cover powerpc: Introduce device tree control and driver model

Hi Simon,

Quoted 19 lines · Simon Glass
Quoted 19 lines · Simon Glass
Quoted 17 lines

This series does a small amount of tweaking to support device tree control (CONFIG_OF_CONTROL) on PowerPC platforms. It also adds support for driver model. In both cases the main effort is to set things up correctly before calling board_init_f().

A new generic function, board_init_f_mem() is introduced. This does the various memory calculations in C code, since they are messy in assembler and every architecture should in fact be the same. A later series will adjust ARM and x86 to use this function.

As an example, the Canyonlands boards are converted over to use device tree control and driver model for their serial console. It should be fairly straightforward to convert over other boards.

Changes in v2:
- Reduce reserved stack space for board_init_f_mem() to 64 bytes
- Add SYS_MALLOC_F to Kconfig

Quoted 6 lines
Quoted 4 lines

I'm trying to catch up on a few things I haven't got to.

If it suits I can apply this to u-boot-dm since it is a driver-model-enablement series and Stefan has tested it.

OK unless I hear any screams I'm going ahead with that plan this week.

Yes, please go ahead. Lazy people (like me) tend to only scream when really forced to test the "latest and greatest" stuff. ;)

Thanks,
Stefan