Skip to content

Commit

Permalink
soc: silabs: Separate Series 2 soc.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
asmellby committed Oct 22, 2024
1 parent 099d34b commit 144e17a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 26 deletions.
2 changes: 1 addition & 1 deletion soc/silabs/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()

Expand Down
25 changes: 0 additions & 25 deletions soc/silabs/common/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -236,5 +212,4 @@ void soc_early_init_hook(void)
/* Configure SWO debug output */
swo_init();
#endif
#endif /* !CONFIG_SOC_GECKO_DEV_INIT */
}
2 changes: 2 additions & 0 deletions soc/silabs/silabs_s2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Copyright (c) 2024 Silicon Laboratories Inc.
# SPDX-License-Identifier: Apache-2.0

zephyr_sources(soc.c)
37 changes: 37 additions & 0 deletions soc/silabs/silabs_s2/soc.c
Original file line number Diff line number Diff line change
@@ -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();
}
}

0 comments on commit 144e17a

Please sign in to comment.