Skip to content

Commit 39949c0

Browse files
committed
soc: ambiq: adjust init process
split soc init into two parts as it is too large to be up front at early stages. Signed-off-by: Swift Tian <swift.tian@ambiq.com>
1 parent 7bbb834 commit 39949c0

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

soc/ambiq/apollo5x/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ config SOC_SERIES_APOLLO5X
1818
select AMBIQ_HAL
1919
select HAS_PM
2020
select SOC_EARLY_INIT_HOOK
21-
select REQUIRES_FULL_LIBC
2221

2322
config SOC_AMBIQ_DCACHE_SIZE
2423
int

soc/ambiq/apollo5x/soc.c

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,6 @@ void soc_early_init_hook(void)
3838

3939
/* Internal timer15 for SPOT manager */
4040
IRQ_CONNECT(82, 0, hal_internal_timer_isr, 0, 0);
41-
42-
/* Initialize for low power in the power control block */
43-
am_hal_pwrctrl_low_power_init();
44-
45-
/* Enable SIMOBUCK for the apollo5 Family */
46-
am_hal_pwrctrl_control(AM_HAL_PWRCTRL_CONTROL_SIMOBUCK_INIT, NULL);
47-
48-
/*
49-
* Set default temperature for spotmgr to room temperature
50-
*/
51-
am_hal_pwrctrl_temp_thresh_t dummy;
52-
53-
am_hal_pwrctrl_temp_update(25.0f, &dummy);
54-
55-
/* Enable Icache*/
56-
sys_cache_instr_enable();
57-
58-
/* Enable Dcache */
59-
sys_cache_data_enable();
6041
}
6142

6243
#if CONFIG_CACHE_MANAGEMENT
@@ -84,3 +65,29 @@ bool buf_in_nocache(uintptr_t buf, size_t len_bytes)
8465
return buf_within_nocache;
8566
}
8667
#endif
68+
69+
int apollo5x_init(void)
70+
{
71+
/* Initialize for low power in the power control block */
72+
am_hal_pwrctrl_low_power_init();
73+
74+
/* Enable SIMOBUCK for the apollo5 Family */
75+
am_hal_pwrctrl_control(AM_HAL_PWRCTRL_CONTROL_SIMOBUCK_INIT, NULL);
76+
77+
/*
78+
* Set default temperature for spotmgr to room temperature
79+
*/
80+
am_hal_pwrctrl_temp_thresh_t dummy;
81+
82+
am_hal_pwrctrl_temp_update(25.0f, &dummy);
83+
84+
/* Enable Icache*/
85+
sys_cache_instr_enable();
86+
87+
/* Enable Dcache */
88+
sys_cache_data_enable();
89+
90+
return 0;
91+
}
92+
93+
SYS_INIT(apollo5x_init, PRE_KERNEL_1, 0);

0 commit comments

Comments
 (0)