soc: silabs: Separate Series 2 soc.c

Series 2 always uses the device init HAL, while Series 0/1 never do.
Create a separate soc.c for Series 2 to make both versions easier to read.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
This commit is contained in:
Aksel Skauge Mellbye 2024-10-03 19:10:59 +02:00 committed by Henrik Brix Andersen
commit a11f0e6d8d
4 changed files with 40 additions and 26 deletions

View file

@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_SOC_FAMILY_SILABS_S0 OR CONFIG_SOC_FAMILY_SILABS_S1 OR CONFIG_SOC_FAMILY_SILABS_S2)
if(CONFIG_SOC_FAMILY_SILABS_S0 OR CONFIG_SOC_FAMILY_SILABS_S1)
zephyr_sources(soc.c)
endif()

View file

@ -19,17 +19,6 @@
#include <soc.h>
#include <cmsis_core.h>
#ifdef CONFIG_SOC_GECKO_DEV_INIT
#include <sl_device_init_dcdc.h>
#include <sl_clock_manager_init.h>
#ifdef CONFIG_PM
#include <sl_hfxo_manager.h>
#include <sl_power_manager.h>
#endif
#endif
LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
#ifdef CONFIG_CMU_HFCLK_HFXO
@ -212,19 +201,6 @@ void soc_early_init_hook(void)
init_lfxo();
#endif
#ifdef CONFIG_SOC_GECKO_DEV_INIT
if (DT_HAS_COMPAT_STATUS_OKAY(silabs_series2_dcdc)) {
sl_device_init_dcdc();
}
sl_clock_manager_init();
#ifdef CONFIG_PM
sl_power_manager_init();
sl_hfxo_manager_init();
#endif
#else /* !CONFIG_SOC_GECKO_DEV_INIT */
#ifdef CONFIG_SOC_GECKO_EMU_DCDC
dcdc_init();
#endif
@ -236,5 +212,4 @@ void soc_early_init_hook(void)
/* Configure SWO debug output */
swo_init();
#endif
#endif /* !CONFIG_SOC_GECKO_DEV_INIT */
}

View file

@ -1,2 +1,4 @@
# Copyright (c) 2024 Silicon Laboratories Inc.
# SPDX-License-Identifier: Apache-2.0
zephyr_sources(soc.c)

View file

@ -0,0 +1,37 @@
/*
* Copyright (c) 2024 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief SoC initialization for Silicon Labs Series 2 products
*/
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <em_chip.h>
#include <sl_device_init_dcdc.h>
#include <sl_clock_manager_init.h>
#include <sl_hfxo_manager.h>
#include <sl_power_manager.h>
LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
void soc_early_init_hook(void)
{
/* Handle chip errata */
CHIP_Init();
if (DT_HAS_COMPAT_STATUS_OKAY(silabs_series2_dcdc)) {
sl_device_init_dcdc();
}
sl_clock_manager_init();
if (IS_ENABLED(CONFIG_PM)) {
sl_power_manager_init();
sl_hfxo_manager_init();
}
}