From: Philippe Reynes Date: Thu, 19 Sep 2019 14:18:39 +0000 (+0200) Subject: spl: add a generic function board_init_f X-Git-Tag: v2020.01-rc1~28^2~20 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a9a3aadaddb4b968eb7133132a73646fc12ca39f;p=oweals%2Fu-boot.git 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 --- diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 92de9cd744..282d246ea3 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -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 hex "Maximum size of SPL image" depends on SPL diff --git a/common/spl/spl.c b/common/spl/spl.c index 5fdd6d0d03..a9d3e847af 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -555,6 +555,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[] = {