aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2022-05-06 11:05:13 +0200
committerStefan Roese <sr@denx.de>2022-05-16 11:31:33 +0200
commit948da7773e340fe76d4d1b9c635d724bf8661d30 (patch)
tree2ffb6b6d7b8a7efbe6cb1919bfc2a24fdf977e2f
parent1001a0ab46ee3be2bb5f0017afdaf135df5e6f6d (diff)
downloadu-boot-948da7773e340fe76d4d1b9c635d724bf8661d30.zip
u-boot-948da7773e340fe76d4d1b9c635d724bf8661d30.tar.gz
u-boot-948da7773e340fe76d4d1b9c635d724bf8661d30.tar.bz2
arm: Add new config option ARCH_VERY_EARLY_INIT
When this option is set then ARM _main() function would call arch_very_early_init() function at the beginning. It would be before calling any other functions like debug_uart_init() and also before initializing C runtime environment. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
-rw-r--r--arch/arm/Kconfig6
-rw-r--r--arch/arm/lib/crt0.S5
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0afec51..9898c7d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -401,6 +401,12 @@ config SYS_ARM_CACHE_WRITEALLOC
write is performed.
endchoice
+config ARCH_VERY_EARLY_INIT
+ bool
+
+config SPL_ARCH_VERY_EARLY_INIT
+ bool
+
config ARCH_CPU_INIT
bool "Enable ARCH_CPU_INIT"
help
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index ba31290..612a2d5 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -90,6 +90,11 @@ clbss_l:cmp r0, r1 /* while not at end of BSS */
ENTRY(_main)
+/* Call arch_very_early_init before initializing C runtime environment. */
+#if CONFIG_IS_ENABLED(ARCH_VERY_EARLY_INIT)
+ bl arch_very_early_init
+#endif
+
/*
* Set up initial C runtime environment and call board_init_f(0).
*/