From 258c4db1e2cd76e39011674149b7e41176b698b0 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 10 Sep 2024 09:42:42 -0400 Subject: [PATCH] soc: renesas: 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/renesas/ra/ra2a1/Kconfig | 1 + soc/renesas/ra/ra2a1/soc.c | 9 +-------- soc/renesas/ra/ra4e2/Kconfig | 1 + soc/renesas/ra/ra4e2/soc.c | 9 +-------- soc/renesas/ra/ra4m2/Kconfig | 1 + soc/renesas/ra/ra4m2/soc.c | 9 +-------- soc/renesas/ra/ra4m3/Kconfig | 1 + soc/renesas/ra/ra4m3/soc.c | 9 +-------- soc/renesas/ra/ra4w1/Kconfig | 1 + soc/renesas/ra/ra4w1/soc.c | 9 +-------- soc/renesas/ra/ra6e1/Kconfig | 1 + soc/renesas/ra/ra6e1/soc.c | 9 +-------- soc/renesas/ra/ra6e2/Kconfig | 1 + soc/renesas/ra/ra6e2/soc.c | 9 +-------- soc/renesas/ra/ra6m1/Kconfig | 1 + soc/renesas/ra/ra6m1/soc.c | 9 +-------- soc/renesas/ra/ra6m2/Kconfig | 1 + soc/renesas/ra/ra6m2/soc.c | 9 +-------- soc/renesas/ra/ra6m3/Kconfig | 1 + soc/renesas/ra/ra6m3/soc.c | 9 +-------- soc/renesas/ra/ra6m4/Kconfig | 1 + soc/renesas/ra/ra6m4/soc.c | 9 +-------- soc/renesas/ra/ra6m5/Kconfig | 1 + soc/renesas/ra/ra6m5/soc.c | 9 +-------- soc/renesas/ra/ra8d1/Kconfig | 1 + soc/renesas/ra/ra8d1/soc.c | 9 +-------- soc/renesas/ra/ra8m1/Kconfig | 1 + soc/renesas/ra/ra8m1/soc.c | 9 +-------- soc/renesas/ra/ra8t1/Kconfig | 1 + soc/renesas/ra/ra8t1/soc.c | 9 +-------- soc/renesas/rzt2m/Kconfig | 1 + soc/renesas/rzt2m/soc.c | 5 +---- soc/renesas/smartbond/da1469x/Kconfig | 1 + soc/renesas/smartbond/da1469x/power.c | 4 +--- soc/renesas/smartbond/da1469x/soc.c | 12 +++++++----- 35 files changed, 41 insertions(+), 132 deletions(-) diff --git a/soc/renesas/ra/ra2a1/Kconfig b/soc/renesas/ra/ra2a1/Kconfig index f447a628c3a..a9915c0f4ad 100644 --- a/soc/renesas/ra/ra2a1/Kconfig +++ b/soc/renesas/ra/ra2a1/Kconfig @@ -10,3 +10,4 @@ config SOC_SERIES_RA2A1 select HAS_SWO select XIP select HAS_RENESAS_RA_FSP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra2a1/soc.c b/soc/renesas/ra/ra2a1/soc.c index 5b944eaa92d..76fc4803360 100644 --- a/soc/renesas/ra/ra2a1/soc.c +++ b/soc/renesas/ra/ra2a1/soc.c @@ -29,17 +29,10 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra2a1_init(void) +void soc_early_init_hook(void) { SystemCoreClock = BSP_MOCO_HZ; g_protect_pfswe_counter = 0; bsp_clock_init(); - - return 0; } - -SYS_INIT(renesas_ra2a1_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra4e2/Kconfig b/soc/renesas/ra/ra4e2/Kconfig index 6c3c2b87468..bfe486040c4 100644 --- a/soc/renesas/ra/ra4e2/Kconfig +++ b/soc/renesas/ra/ra4e2/Kconfig @@ -13,3 +13,4 @@ config SOC_SERIES_RA4E2 select FPU select HAS_SWO select XIP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra4e2/soc.c b/soc/renesas/ra/ra4e2/soc.c index 74b0e8c7641..6d11bae8208 100644 --- a/soc/renesas/ra/ra4e2/soc.c +++ b/soc/renesas/ra/ra4e2/soc.c @@ -30,11 +30,8 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra4e2_init(void) +void soc_early_init_hook(void) { extern volatile uint16_t g_protect_counters[]; @@ -62,8 +59,4 @@ static int renesas_ra4e2_init(void) SystemCoreClock = BSP_MOCO_HZ; g_protect_pfswe_counter = 0; - - return 0; } - -SYS_INIT(renesas_ra4e2_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra4m2/Kconfig b/soc/renesas/ra/ra4m2/Kconfig index 1231924935d..a4b6d2c7c50 100644 --- a/soc/renesas/ra/ra4m2/Kconfig +++ b/soc/renesas/ra/ra4m2/Kconfig @@ -13,3 +13,4 @@ config SOC_SERIES_RA4M2 select FPU select HAS_SWO select XIP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra4m2/soc.c b/soc/renesas/ra/ra4m2/soc.c index e6e846ab088..c3c21184aa4 100644 --- a/soc/renesas/ra/ra4m2/soc.c +++ b/soc/renesas/ra/ra4m2/soc.c @@ -30,11 +30,8 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra4m2_init(void) +void soc_early_init_hook(void) { extern volatile uint16_t g_protect_counters[]; @@ -62,8 +59,4 @@ static int renesas_ra4m2_init(void) SystemCoreClock = BSP_MOCO_HZ; g_protect_pfswe_counter = 0; - - return 0; } - -SYS_INIT(renesas_ra4m2_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra4m3/Kconfig b/soc/renesas/ra/ra4m3/Kconfig index 00eb8c9a7ab..0898c3796bc 100644 --- a/soc/renesas/ra/ra4m3/Kconfig +++ b/soc/renesas/ra/ra4m3/Kconfig @@ -13,3 +13,4 @@ config SOC_SERIES_RA4M3 select FPU select HAS_SWO select XIP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra4m3/soc.c b/soc/renesas/ra/ra4m3/soc.c index f62cd1da28c..10658184372 100644 --- a/soc/renesas/ra/ra4m3/soc.c +++ b/soc/renesas/ra/ra4m3/soc.c @@ -30,11 +30,8 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra4m3_init(void) +void soc_early_init_hook(void) { extern volatile uint16_t g_protect_counters[]; @@ -62,8 +59,4 @@ static int renesas_ra4m3_init(void) SystemCoreClock = BSP_MOCO_HZ; g_protect_pfswe_counter = 0; - - return 0; } - -SYS_INIT(renesas_ra4m3_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra4w1/Kconfig b/soc/renesas/ra/ra4w1/Kconfig index 358633bb895..c9d1fbb3703 100644 --- a/soc/renesas/ra/ra4w1/Kconfig +++ b/soc/renesas/ra/ra4w1/Kconfig @@ -12,3 +12,4 @@ config SOC_SERIES_RA4W1 select FPU select HAS_SWO select XIP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra4w1/soc.c b/soc/renesas/ra/ra4w1/soc.c index d3f9b351d24..6d84c068f7d 100644 --- a/soc/renesas/ra/ra4w1/soc.c +++ b/soc/renesas/ra/ra4w1/soc.c @@ -30,16 +30,9 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra4w1_init(void) +void soc_early_init_hook(void) { SystemCoreClock = BSP_MOCO_HZ; g_protect_pfswe_counter = 0; - - return 0; } - -SYS_INIT(renesas_ra4w1_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra6e1/Kconfig b/soc/renesas/ra/ra6e1/Kconfig index e67c9f66dc2..accd57e26a0 100644 --- a/soc/renesas/ra/ra6e1/Kconfig +++ b/soc/renesas/ra/ra6e1/Kconfig @@ -13,3 +13,4 @@ config SOC_SERIES_RA6E1 select FPU select HAS_SWO select XIP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra6e1/soc.c b/soc/renesas/ra/ra6e1/soc.c index 5ca796f5bbe..ca37db8e274 100644 --- a/soc/renesas/ra/ra6e1/soc.c +++ b/soc/renesas/ra/ra6e1/soc.c @@ -29,11 +29,8 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra6e1_init(void) +void soc_early_init_hook(void) { uint32_t key; @@ -67,8 +64,4 @@ static int renesas_ra6e1_init(void) g_protect_pfswe_counter = 0; irq_unlock(key); - - return 0; } - -SYS_INIT(renesas_ra6e1_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra6e2/Kconfig b/soc/renesas/ra/ra6e2/Kconfig index 9ac1ba7dd42..f7081a1c958 100644 --- a/soc/renesas/ra/ra6e2/Kconfig +++ b/soc/renesas/ra/ra6e2/Kconfig @@ -13,3 +13,4 @@ config SOC_SERIES_RA6E2 select FPU select HAS_SWO select XIP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra6e2/soc.c b/soc/renesas/ra/ra6e2/soc.c index 2249db628e4..2b34260479e 100644 --- a/soc/renesas/ra/ra6e2/soc.c +++ b/soc/renesas/ra/ra6e2/soc.c @@ -29,11 +29,8 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra6e2_init(void) +void soc_early_init_hook(void) { uint32_t key; @@ -67,8 +64,4 @@ static int renesas_ra6e2_init(void) g_protect_pfswe_counter = 0; irq_unlock(key); - - return 0; } - -SYS_INIT(renesas_ra6e2_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra6m1/Kconfig b/soc/renesas/ra/ra6m1/Kconfig index e2520fc4569..649b6702629 100644 --- a/soc/renesas/ra/ra6m1/Kconfig +++ b/soc/renesas/ra/ra6m1/Kconfig @@ -12,3 +12,4 @@ config SOC_SERIES_RA6M1 select FPU select HAS_SWO select XIP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra6m1/soc.c b/soc/renesas/ra/ra6m1/soc.c index d56bde197e6..c9809254ae2 100644 --- a/soc/renesas/ra/ra6m1/soc.c +++ b/soc/renesas/ra/ra6m1/soc.c @@ -29,11 +29,8 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra6m1_init(void) +void soc_early_init_hook(void) { uint32_t key; @@ -43,8 +40,4 @@ static int renesas_ra6m1_init(void) g_protect_pfswe_counter = 0; irq_unlock(key); - - return 0; } - -SYS_INIT(renesas_ra6m1_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra6m2/Kconfig b/soc/renesas/ra/ra6m2/Kconfig index 89c951a9db9..680e649349d 100644 --- a/soc/renesas/ra/ra6m2/Kconfig +++ b/soc/renesas/ra/ra6m2/Kconfig @@ -12,3 +12,4 @@ config SOC_SERIES_RA6M2 select FPU select HAS_SWO select XIP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra6m2/soc.c b/soc/renesas/ra/ra6m2/soc.c index 4b10f2123e6..f0d399463f5 100644 --- a/soc/renesas/ra/ra6m2/soc.c +++ b/soc/renesas/ra/ra6m2/soc.c @@ -29,11 +29,8 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra6m2_init(void) +void soc_early_init_hook(void) { uint32_t key; @@ -43,8 +40,4 @@ static int renesas_ra6m2_init(void) g_protect_pfswe_counter = 0; irq_unlock(key); - - return 0; } - -SYS_INIT(renesas_ra6m2_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra6m3/Kconfig b/soc/renesas/ra/ra6m3/Kconfig index c91e5284022..bebd78f1bab 100644 --- a/soc/renesas/ra/ra6m3/Kconfig +++ b/soc/renesas/ra/ra6m3/Kconfig @@ -12,3 +12,4 @@ config SOC_SERIES_RA6M3 select FPU select HAS_SWO select XIP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra6m3/soc.c b/soc/renesas/ra/ra6m3/soc.c index b2d87b50f0a..99f9a60e6eb 100644 --- a/soc/renesas/ra/ra6m3/soc.c +++ b/soc/renesas/ra/ra6m3/soc.c @@ -29,11 +29,8 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra6m3_init(void) +void soc_early_init_hook(void) { uint32_t key; @@ -43,8 +40,4 @@ static int renesas_ra6m3_init(void) g_protect_pfswe_counter = 0; irq_unlock(key); - - return 0; } - -SYS_INIT(renesas_ra6m3_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra6m4/Kconfig b/soc/renesas/ra/ra6m4/Kconfig index b74ea6807dc..ee2acc2855f 100644 --- a/soc/renesas/ra/ra6m4/Kconfig +++ b/soc/renesas/ra/ra6m4/Kconfig @@ -13,3 +13,4 @@ config SOC_SERIES_RA6M4 select FPU select HAS_SWO select XIP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra6m4/soc.c b/soc/renesas/ra/ra6m4/soc.c index 1d61e5f40c7..f561d631b67 100644 --- a/soc/renesas/ra/ra6m4/soc.c +++ b/soc/renesas/ra/ra6m4/soc.c @@ -29,11 +29,8 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra6m4_init(void) +void soc_early_init_hook(void) { uint32_t key; @@ -67,8 +64,4 @@ static int renesas_ra6m4_init(void) g_protect_pfswe_counter = 0; irq_unlock(key); - - return 0; } - -SYS_INIT(renesas_ra6m4_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra6m5/Kconfig b/soc/renesas/ra/ra6m5/Kconfig index f7fdc083bc2..4a8f750eab6 100644 --- a/soc/renesas/ra/ra6m5/Kconfig +++ b/soc/renesas/ra/ra6m5/Kconfig @@ -13,3 +13,4 @@ config SOC_SERIES_RA6M5 select FPU select HAS_SWO select XIP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra6m5/soc.c b/soc/renesas/ra/ra6m5/soc.c index fda381f0f0d..f156a3c5fb2 100644 --- a/soc/renesas/ra/ra6m5/soc.c +++ b/soc/renesas/ra/ra6m5/soc.c @@ -29,11 +29,8 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra6m5_init(void) +void soc_early_init_hook(void) { uint32_t key; @@ -67,8 +64,4 @@ static int renesas_ra6m5_init(void) g_protect_pfswe_counter = 0; irq_unlock(key); - - return 0; } - -SYS_INIT(renesas_ra6m5_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra8d1/Kconfig b/soc/renesas/ra/ra8d1/Kconfig index 8945d31a8b3..968c60343c6 100644 --- a/soc/renesas/ra/ra8d1/Kconfig +++ b/soc/renesas/ra/ra8d1/Kconfig @@ -13,3 +13,4 @@ config SOC_SERIES_RA8D1 select XIP select CLOCK_CONTROL_RENESAS_RA_CGC if CLOCK_CONTROL select HAS_RENESAS_RA_FSP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra8d1/soc.c b/soc/renesas/ra/ra8d1/soc.c index e915ceb8816..4d78ba0e1ca 100644 --- a/soc/renesas/ra/ra8d1/soc.c +++ b/soc/renesas/ra/ra8d1/soc.c @@ -29,16 +29,9 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra8d1_init(void) +void soc_early_init_hook(void) { SystemCoreClock = BSP_MOCO_HZ; g_protect_pfswe_counter = 0; - - return 0; } - -SYS_INIT(renesas_ra8d1_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra8m1/Kconfig b/soc/renesas/ra/ra8m1/Kconfig index 98d6503297b..f1fd9d9967e 100644 --- a/soc/renesas/ra/ra8m1/Kconfig +++ b/soc/renesas/ra/ra8m1/Kconfig @@ -13,5 +13,6 @@ config SOC_SERIES_RA8M1 select XIP select CLOCK_CONTROL_RENESAS_RA_CGC if CLOCK_CONTROL select HAS_RENESAS_RA_FSP + select SOC_EARLY_INIT_HOOK help Enable support for Renesas RA8M1 MCU series diff --git a/soc/renesas/ra/ra8m1/soc.c b/soc/renesas/ra/ra8m1/soc.c index 3c110730f16..a0da08c8616 100644 --- a/soc/renesas/ra/ra8m1/soc.c +++ b/soc/renesas/ra/ra8m1/soc.c @@ -29,16 +29,9 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra8m1_init(void) +void soc_early_init_hook(void) { SystemCoreClock = BSP_MOCO_HZ; g_protect_pfswe_counter = 0; - - return 0; } - -SYS_INIT(renesas_ra8m1_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/ra/ra8t1/Kconfig b/soc/renesas/ra/ra8t1/Kconfig index 1c96706ad2f..426e72be95d 100644 --- a/soc/renesas/ra/ra8t1/Kconfig +++ b/soc/renesas/ra/ra8t1/Kconfig @@ -13,3 +13,4 @@ config SOC_SERIES_RA8T1 select XIP select CLOCK_CONTROL_RENESAS_RA_CGC if CLOCK_CONTROL select HAS_RENESAS_RA_FSP + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/ra/ra8t1/soc.c b/soc/renesas/ra/ra8t1/soc.c index e62a6d2c102..33948ba3097 100644 --- a/soc/renesas/ra/ra8t1/soc.c +++ b/soc/renesas/ra/ra8t1/soc.c @@ -29,16 +29,9 @@ volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; * @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 renesas_ra8t1_init(void) +void soc_early_init_hook(void) { SystemCoreClock = BSP_MOCO_HZ; g_protect_pfswe_counter = 0; - - return 0; } - -SYS_INIT(renesas_ra8t1_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/rzt2m/Kconfig b/soc/renesas/rzt2m/Kconfig index c8274534a24..1b0d438c31f 100644 --- a/soc/renesas/rzt2m/Kconfig +++ b/soc/renesas/rzt2m/Kconfig @@ -8,3 +8,4 @@ config SOC_RENESAS_RZT2M select GIC_SINGLE_SECURITY_STATE select ARM_ARCH_TIMER select SYSCON + select SOC_EARLY_INIT_HOOK diff --git a/soc/renesas/rzt2m/soc.c b/soc/renesas/rzt2m/soc.c index 673994e254d..183381179ba 100644 --- a/soc/renesas/rzt2m/soc.c +++ b/soc/renesas/rzt2m/soc.c @@ -90,7 +90,7 @@ void rzt2m_enable_counters(void) syscon_write_reg(dev, 0, CNTCR_EN); } -static int rzt2m_init(void) +void soc_early_init_hook(void) { /* Unlock the Protect Registers * so that device drivers can access configuration registers of peripherals. @@ -115,7 +115,4 @@ static int rzt2m_init(void) rzt2m_lock_prcrn(PRCRN_PRC1 | PRCRN_PRC2 | PRCRN_PRC0); rzt2m_enable_counters(); - return 0; } - -SYS_INIT(rzt2m_init, PRE_KERNEL_1, 0); diff --git a/soc/renesas/smartbond/da1469x/Kconfig b/soc/renesas/smartbond/da1469x/Kconfig index 024120268ab..5c4225a0dcc 100644 --- a/soc/renesas/smartbond/da1469x/Kconfig +++ b/soc/renesas/smartbond/da1469x/Kconfig @@ -14,4 +14,5 @@ config SOC_SERIES_DA1469X select CLOCK_CONTROL_SMARTBOND select SOC_RESET_HOOK select PM_DEVICE if PM + select SOC_EARLY_INIT_HOOK imply TIMER_READS_ITS_FREQUENCY_AT_RUNTIME diff --git a/soc/renesas/smartbond/da1469x/power.c b/soc/renesas/smartbond/da1469x/power.c index 80a497acff5..3e39239bcd1 100644 --- a/soc/renesas/smartbond/da1469x/power.c +++ b/soc/renesas/smartbond/da1469x/power.c @@ -45,7 +45,7 @@ void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id) } } -static int renesas_da1469x_pm_init(void) +int renesas_da1469x_pm_init(void) { static const struct da1469x_sleep_config sleep_cfg = { .enable_xtal_on_wakeup = DT_NODE_HAS_STATUS(DT_NODELABEL(xtal32m), okay), @@ -55,5 +55,3 @@ static int renesas_da1469x_pm_init(void) return 0; } - -SYS_INIT(renesas_da1469x_pm_init, PRE_KERNEL_2, 2); diff --git a/soc/renesas/smartbond/da1469x/soc.c b/soc/renesas/smartbond/da1469x/soc.c index 40bb55ebd0d..79b191cb596 100644 --- a/soc/renesas/smartbond/da1469x/soc.c +++ b/soc/renesas/smartbond/da1469x/soc.c @@ -131,7 +131,10 @@ void soc_reset_hook(void) #endif } -static int renesas_da1469x_init(void) +/* defined in power.c */ +extern int renesas_da1469x_pm_init(void); + +void soc_early_init_hook(void) { /* Freeze watchdog until configured */ GPREG->SET_FREEZE_REG = GPREG_SET_FREEZE_REG_FRZ_SYS_WDOG_Msk; @@ -176,8 +179,7 @@ static int renesas_da1469x_init(void) da1469x_pd_acquire(MCU_PD_DOMAIN_TIM); da1469x_pdc_reset(); - - return 0; +#if CONFIG_PM + renesas_da1469x_pm_init(); +#endif } - -SYS_INIT(renesas_da1469x_init, PRE_KERNEL_1, 0);