soc: snps: move init code from SYS_INIT to hooks

Replace SYS_INIT with SoC hooks and adapt SoC init code

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2024-09-10 09:42:45 -04:00 committed by Henrik Brix Andersen
commit 49f7204530
4 changed files with 8 additions and 14 deletions

View file

@ -6,3 +6,4 @@ config SOC_ARC_IOT
select ARC
select CPU_HAS_MPU
select CPU_HAS_FPU
select SOC_EARLY_INIT_HOOK

View file

@ -15,14 +15,7 @@
#define CPU_FREQ DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency)
static int arc_iot_init(void)
void soc_early_init_hook(void)
{
if (arc_iot_pll_fout_config(CPU_FREQ / 1000000) < 0) {
return -1;
}
return 0;
arc_iot_pll_fout_config(CPU_FREQ / 1000000);
}
SYS_INIT(arc_iot_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -4,12 +4,16 @@
config SOC_EMSK
select ARC
select SOC_EARLY_INIT_HOOK
config SOC_EMSK_EM7D
select CPU_HAS_MPU
select SOC_EARLY_INIT_HOOK
config SOC_EMSK_EM9D
select CPU_HAS_FPU
select SOC_EARLY_INIT_HOOK
config SOC_EMSK_EM11D
select CPU_HAS_FPU
select SOC_EARLY_INIT_HOOK

View file

@ -11,7 +11,7 @@
#ifdef CONFIG_UART_NS16550
static int uart_ns16550_init(void)
void soc_early_init_hook(void)
{
/* On ARC EM Starter kit board,
@ -25,10 +25,6 @@ static int uart_ns16550_init(void)
sys_write32(0, DT_REG_ADDR(DT_INST(1, ns16550))+0x4);
sys_write32(0, DT_REG_ADDR(DT_INST(1, ns16550))+0x10);
#endif /* DT_NODE_HAS_STATUS(DT_INST(1, ns16550), okay) */
return 0;
}
SYS_INIT(uart_ns16550_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_UART_NS16550 */