All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] davinci: spl: Create board_init_f for explicit initialization
@ 2019-05-20 19:35 Adam Ford
  2019-05-21 12:52 ` Sekhar Nori
  2019-05-31 11:48 ` Adam Ford
  0 siblings, 2 replies; 5+ messages in thread
From: Adam Ford @ 2019-05-20 19:35 UTC (permalink / raw)
  To: u-boot

The arch_cpu_init() and preloader_console_init() functions
were not getting called until board_init_r() as part of the
spl_board_init() functions.  This patch explicitly moves these
initialization sequences earlier in startup, and now clears BSS
per the suggested workflow in the README. This also means that
CONFIG_SPL_BOARD_INIT can be removed from the defconfig

Suggested-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Adam Ford <aford173@gmail.com>

diff --git a/arch/arm/mach-davinci/spl.c b/arch/arm/mach-davinci/spl.c
index 103639e347..05c78f1801 100644
--- a/arch/arm/mach-davinci/spl.c
+++ b/arch/arm/mach-davinci/spl.c
@@ -37,6 +37,33 @@ void spl_board_init(void)
 	preloader_console_init();
 }
 
+void board_init_f(ulong boot_flags)
+{
+	gd->flags = boot_flags;
+	gd->have_console = 0;
+
+	if (!(gd->flags & GD_FLG_SPL_INIT)) {
+		if (spl_init())
+			hang();
+	}
+
+	arch_cpu_init();
+
+	board_early_init_f();
+
+	/* setup GP timer */
+	timer_init();
+
+	/* UART clocks enabled and gd valid - init serial console */
+	preloader_console_init();
+
+	/* Clear the BSS. */
+	memset(__bss_start, 0, __bss_end - __bss_start);
+
+	/* load/boot image from boot device */
+	board_init_r(NULL, 0);
+}
+
 u32 spl_boot_device(void)
 {
 	switch (davinci_syscfg_regs->bootcfg) {
diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
index 8c16d5c4f5..c095058282 100644
--- a/configs/da850evm_defconfig
+++ b/configs/da850evm_defconfig
@@ -21,7 +21,6 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x80000000
-CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_SPI_LOAD=y
diff --git a/configs/da850evm_nand_defconfig b/configs/da850evm_nand_defconfig
index b8eac0e659..7271016346 100644
--- a/configs/da850evm_nand_defconfig
+++ b/configs/da850evm_nand_defconfig
@@ -19,7 +19,6 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x80000000
-CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_NAND_SUPPORT=y
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-05-31 11:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 19:35 [U-Boot] [PATCH] davinci: spl: Create board_init_f for explicit initialization Adam Ford
2019-05-21 12:52 ` Sekhar Nori
2019-05-21 12:59   ` Adam Ford
2019-05-21 13:49     ` Adam Ford
2019-05-31 11:48 ` Adam Ford

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.