From 5c541ffd3011e5e335f4866be3b2c51be67e7ae0 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 10 Sep 2024 09:42:29 -0400 Subject: [PATCH] soc: brcm: move init code from SYS_INIT to hooks Replace SYS_INIT with SoC hooks and adapt SoC init code Signed-off-by: Anas Nashif --- soc/brcm/bcmvk/viper/Kconfig | 2 ++ soc/brcm/bcmvk/viper/a72/soc.c | 9 +-------- soc/brcm/bcmvk/viper/m7/soc.c | 9 +-------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/soc/brcm/bcmvk/viper/Kconfig b/soc/brcm/bcmvk/viper/Kconfig index e6266d10456..20b30195bc6 100644 --- a/soc/brcm/bcmvk/viper/Kconfig +++ b/soc/brcm/bcmvk/viper/Kconfig @@ -6,8 +6,10 @@ config SOC_BCM58402_M7 select CPU_CORTEX_M7 select CPU_CORTEX_M_HAS_SYSTICK select CPU_HAS_ARM_MPU + select SOC_EARLY_INIT_HOOK config SOC_BCM58402_A72 select ARM64 select CPU_CORTEX_A72 select ARM_ARCH_TIMER if SYS_CLOCK_EXISTS + select SOC_EARLY_INIT_HOOK diff --git a/soc/brcm/bcmvk/viper/a72/soc.c b/soc/brcm/bcmvk/viper/a72/soc.c index 9bc05f01425..a30d246cf07 100644 --- a/soc/brcm/bcmvk/viper/a72/soc.c +++ b/soc/brcm/bcmvk/viper/a72/soc.c @@ -13,11 +13,8 @@ * @brief Perform basic hardware initialization at boot. * * This needs to be run from the very beginning. - * So the init priority has to be 0 (zero). - * - * @return 0 */ -static int viper_init(void) +void soc_early_init_hook(void) { uint32_t key; uint32_t data; @@ -35,8 +32,4 @@ static int viper_init(void) sys_write32(data, LS_ICFG_PMON_LITE_SW_RESETN); irq_unlock(key); - - return 0; } - -SYS_INIT(viper_init, PRE_KERNEL_1, 0); diff --git a/soc/brcm/bcmvk/viper/m7/soc.c b/soc/brcm/bcmvk/viper/m7/soc.c index d18d13ce884..61ab7eb3b30 100644 --- a/soc/brcm/bcmvk/viper/m7/soc.c +++ b/soc/brcm/bcmvk/viper/m7/soc.c @@ -13,11 +13,8 @@ * @brief Perform basic hardware initialization at boot. * * This needs to be run from the very beginning. - * So the init priority has to be 0 (zero). - * - * @return 0 */ -static int viper_init(void) +void soc_early_init_hook(void) { uint32_t data; @@ -29,8 +26,4 @@ static int viper_init(void) data = sys_read32(LS_ICFG_PMON_LITE_SW_RESETN); data |= PCIE_PMON_LITE_SW_RESETN; sys_write32(data, LS_ICFG_PMON_LITE_SW_RESETN); - - return 0; } - -SYS_INIT(viper_init, PRE_KERNEL_1, 0);