[U-Boot] [PATCH 4/4] ARM: rmobile: Convert Porter to SPL

Marek Vasut marek.vasut at gmail.com
Fri Feb 16 15:39:25 UTC 2018


Due to size limitations of the MERAM, switch U-Boot to SPL.
The SPL is loaded by the SPI_LOADER into MERAM and then loads
U-Boot proper into DRAM. This way U-Boot can freely grow in
size in DRAM, as there is plenty of it.

Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>
---
NOTE: To update U-Boot, first install u-boot.img to 0x140000 in SPI NOR,
      then use the Minimon to flash u-boot-spl.srec using ls,2,e6304000.
      To generate u-boot-spl.srec, use objcopy:
        arm-linux-gnueabi-objcopy -O srec spl/u-boot-spl u-boot-spl.srec
---
 arch/arm/mach-rmobile/Kconfig.32 |  2 ++
 board/renesas/porter/porter.c    | 22 ++++++++++++++++++++++
 configs/porter_defconfig         | 20 +++++++++++++++++++-
 include/configs/porter.h         | 15 +++++++++------
 4 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-rmobile/Kconfig.32 b/arch/arm/mach-rmobile/Kconfig.32
index ab05966d15..a96938c01e 100644
--- a/arch/arm/mach-rmobile/Kconfig.32
+++ b/arch/arm/mach-rmobile/Kconfig.32
@@ -70,6 +70,8 @@ config TARGET_PORTER
 	bool "Porter board"
 	select DM
 	select DM_SERIAL
+	select SUPPORT_SPL
+	select SPL_DM if SPL
 
 config TARGET_STOUT
 	bool "Stout board"
diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c
index 86dea8bfa7..bd0080d210 100644
--- a/board/renesas/porter/porter.c
+++ b/board/renesas/porter/porter.c
@@ -115,3 +115,25 @@ void reset_cpu(ulong addr)
 	val |= 0x02;
 	i2c_write(CONFIG_SYS_I2C_POWERIC_ADDR, 0x13, 1, &val, 1);
 }
+
+#ifdef CONFIG_SPL_BUILD
+#include <spl.h>
+void board_init_f(ulong dummy)
+{
+	board_early_init_f();
+}
+
+void spl_board_init(void)
+{
+	/* UART clocks enabled and gd valid - init serial console */
+	preloader_console_init();
+}
+
+void board_boot_order(u32 *spl_boot_list)
+{
+	/* Boot from SPI NOR with YMODEM UART fallback. */
+	spl_boot_list[0] = BOOT_DEVICE_SPI;
+	spl_boot_list[1] = BOOT_DEVICE_UART;
+	spl_boot_list[2] = BOOT_DEVICE_NONE;
+}
+#endif
diff --git a/configs/porter_defconfig b/configs/porter_defconfig
index 38501d0bf1..0fa308b584 100644
--- a/configs/porter_defconfig
+++ b/configs/porter_defconfig
@@ -1,12 +1,22 @@
 CONFIG_ARM=y
 CONFIG_ARCH_RMOBILE=y
-CONFIG_SYS_TEXT_BASE=0xE6304000
+CONFIG_SYS_TEXT_BASE=0x50000000
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_SYS_MALLOC_F_LEN=0x8000
 CONFIG_R8A7791=y
 CONFIG_TARGET_PORTER=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_DEFAULT_DEVICE_TREE="r8a7791-porter-u-boot"
 CONFIG_BOOTDELAY=3
 CONFIG_VERSION_VARIABLE=y
+CONFIG_SPL=y
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_IMI is not set
 # CONFIG_CMD_XIMG is not set
@@ -26,8 +36,14 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_OF_EMBED=y
+CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-parent dma-names dmas power-domains"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_CLK=y
+CONFIG_SPL_CLK=y
 CONFIG_CLK_RENESAS=y
 CONFIG_DM_GPIO=y
 CONFIG_RCAR_GPIO=y
@@ -44,6 +60,7 @@ CONFIG_DM_PCI=y
 CONFIG_PCI_RCAR_GEN2=y
 CONFIG_PINCTRL=y
 CONFIG_PINCONF=y
+CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_PFC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
@@ -55,3 +72,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_PCI=y
 CONFIG_USB_STORAGE=y
+CONFIG_SPL_FRAMEWORK=y
diff --git a/include/configs/porter.h b/include/configs/porter.h
index b4a317f724..758ed21c15 100644
--- a/include/configs/porter.h
+++ b/include/configs/porter.h
@@ -16,12 +16,8 @@
 
 #include "rcar-gen2-common.h"
 
-#if defined(CONFIG_ARCH_RMOBILE_EXTRAM_BOOT)
-#define CONFIG_SYS_INIT_SP_ADDR		0x7023FFFC
-#else
-#define CONFIG_SYS_INIT_SP_ADDR		0xE633fffC
-#endif
-#define STACK_AREA_SIZE			0xC000
+#define CONFIG_SYS_INIT_SP_ADDR		0x4f000000
+#define STACK_AREA_SIZE			0x00100000
 #define LOW_LEVEL_MERAM_STACK \
 		(CONFIG_SYS_INIT_SP_ADDR + STACK_AREA_SIZE - 4)
 
@@ -67,4 +63,11 @@
 
 #define CONFIG_SYS_I2C_POWERIC_ADDR	0x58 /* da9063 */
 
+/* SPL support */
+#define CONFIG_SPL_TEXT_BASE		0xe6304000
+#define CONFIG_SPL_STACK		0xe6340000
+#define CONFIG_SPL_MAX_SIZE		0x40000
+#define CONFIG_SPL_SPI_LOAD
+#define CONFIG_SYS_SPI_U_BOOT_OFFS	0x140000
+
 #endif /* __PORTER_H */
-- 
2.15.1



More information about the U-Boot mailing list