spl: add a generic function board_init_f
PATCH v2 1/1 spl: add a generic function board_init_f
This commit add a generic function board_init_f that only initialize some device (for example serial). It avoid to define a board function only to launch the serial configuration.
Signed-off-by Philippe Reynes <[email protected]>
---
Changelog:
v2:
- fix the commit message (use board_init_f instead of board_init_r) (thanks Simon)
- remove the useless "default n" in Kconfig (thanks Simon)
- enhance the help in Kconfig (thanks Simon)
- replace #if by if (thanks Simon)
common/spl/Kconfig | 9 +++++++++ common/spl/spl.c | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+)
common/spl/Kconfig +9 -0
@@ -25,6 +25,15 @@ config SPL_FRAMEWORK supports MMC, NAND and YMODEM and other methods loading of U-Boot and the Linux Kernel. If unsure, say Y. +config SPL_FRAMEWORK_BOARD_INIT_F + bool "Define a generic function board_init_f" + depends on SPL_FRAMEWORK + help + Define a generic function board_init_f that: + - initialize the spl (spl_early_init) + - initialize the serial (preloader_console_init) + Unless you want to provide your own board_init_f, you should say Y. + config SPL_SIZE_LIMIT int "Maximum size of SPL image" depends on SPL
common/spl/spl.c +18 -0
@@ -566,6 +566,24 @@ static int boot_from_devices(struct spl_image_info *spl_image,return -ENODEV ; } +#if defined(CONFIG_SPL_FRAMEWORK_BOARD_INIT_F ) +void board_init_f (ulong dummy) +{ +if (CONFIG_IS_ENABLED (OF_CONTROL )) { +int ret; + + ret =spl_early_init (); +if (ret) { +debug ("spl_early_init() failed: %d\n" , ret); +hang (); + } + } + +if (CONFIG_IS_ENABLED (SERIAL_SUPPORT )) +preloader_console_init (); +} +#endif +void board_init_r (gd_t *dummy1,ulong dummy2) {u32 spl_boot_list[] = {
Signature · 1 line
2.7.4
PATCH v2 1/1 spl: add a generic function board_init_f
Quoted 6 lines · Philippe Reynes
This commit add a generic function
board_init_fthat only initialize some device (for example serial). It avoid to define a board function only to launch the serial configuration.Signed-off-by Philippe Reynes <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/705e6ebb/attachment.sig>