Skip to contentSkip to conversation

common: add config for board_init() call

PATCH In review Ben Dooks 2 participants 3 messages May 7, 2025 – May 22, 2025

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 common: add config for board_init() call

Add CONFIG_BOARD_INIT to specifu if the board_init() needs calling during initcall phase, and default it to 'y' for the relevant architectures which probably need it.

This allows anyone with a board that doesn't need it to just remove it from the initcall list w/o an empty code block in the board init file.

---
 common/Kconfig   | 7 +++++++
 common/board_r.c | 3 +--
 2 files changed, 8 insertions(+), 2 deletions(-)
common/Kconfig +7 -0
index be517b80eb5..17539079f90 100644
@@ -727,6 +727,13 @@ config BOARD_EARLY_INIT_R
 	  relocation. With this option, U-Boot calls board_early_init_r()
 	  in the post-relocation init sequence.
 
+config BOARD_INIT
+	bool "Call board-specific init board_init() during init-calls"
+	default y if ARM || RISCV || SANDBOX
+	help
+	  Some boards need an board_init() function called during the initcall
+	  phase of startup.
+
 config BOARD_POSTCLK_INIT
 	bool "Call board_postclk_init"
 	help
common/board_r.c +1 -2
index b90a4d9ff69..65ff5fb595c 100644
@@ -649,8 +649,7 @@ static void initcall_run_r(void)
 #if CONFIG_IS_ENABLED(ADDR_MAP)
 	INITCALL(init_addr_map);
 #endif
-#if CONFIG_IS_ENABLED(ARM) || CONFIG_IS_ENABLED(RISCV) || \
-    CONFIG_IS_ENABLED(SANDBOX)
+#if CONFIG_IS_ENABLED(BOARD_INIT)
 	INITCALL(board_init);	/* Setup chipselects */
 #endif
 	/*
Signature · 1 line
2.37.2.352.g3c44437643
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Ben Dooks

Add CONFIG_BOARD_INIT to specifu if the board_init() needs calling during initcall phase, and default it to 'y' for the relevant architectures which probably need it.

This allows anyone with a board that doesn't need it to just remove it from the initcall list w/o an empty code block in the board init file.

Signature · 1 line
Tom
#2 lore raw
In reply to Ben Dooks
Quoted 9 lines · Ben Dooks

Add CONFIG_BOARD_INIT to specifu if the board_init() needs calling during initcall phase, and default it to 'y' for the relevant architectures which probably need it.

This allows anyone with a board that doesn't need it to just remove it from the initcall list w/o an empty code block in the board init file.

[...]

Applied to u-boot/next, thanks!

[1/1] common: add config for board_init() call

      commit: 86acdce2ba886153f152b924b28e5c040e316c80
Signature · 1 line
Tom