[U-Boot] [PATCH] spl: add a new stub spl_early_board_init() for early SoC-specific setup

Masahiro Yamada yamada.masahiro at socionext.com
Tue Mar 8 12:37:16 CET 2016


We are generally supposed to implement SoC/board-specific SPL init
code in spl_board_init(), but it is called after spl_init() where the
FDT is setup and devices are bound.

This new stub spl_early_board_init() would be useful to put something
really SoC-specific, for example, debug_uart_init().

In fact, I was hit by some problems on FDT setup when I was tackling
on a completely new platform.  I wished I could use the debug UART
earlier in situations like that.

Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
---

 common/spl/spl.c | 6 ++++++
 include/spl.h    | 1 +
 2 files changed, 7 insertions(+)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index e5167bf..df85b09 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -150,6 +150,10 @@ static int spl_ram_load_image(void)
 }
 #endif
 
+void __weak spl_early_board_init(void)
+{
+}
+
 int spl_init(void)
 {
 	int ret;
@@ -344,6 +348,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 {
 	int i;
 
+	spl_early_board_init();
+
 	debug(">>spl:board_init_r()\n");
 
 #if defined(CONFIG_SYS_SPL_MALLOC_START)
diff --git a/include/spl.h b/include/spl.h
index 92cdc04..e3c1873 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -93,6 +93,7 @@ int spl_load_image_ext_os(block_dev_desc_t *block_dev, int partition);
  */
 int spl_init(void);
 
+void spl_early_board_init(void);
 #ifdef CONFIG_SPL_BOARD_INIT
 void spl_board_init(void);
 #endif
-- 
1.9.1



More information about the U-Boot mailing list