Skip to content

Commit 8fc5514

Browse files
asmellbyaescolar
authored andcommitted
soc: silabs: Only initialize HFXO Manager if HFXO is enabled
Only initialize the HFXO Manager HAL driver if the HFXO is enabled in DeviceTree, the device uses SYSRTC for timekeeping, and Power Manager is enabled. HFXO Manager integrates with the Sleeptimer HAL driver for SYSRTC to autonomously wake the HFXO prior to Sleeptimer wakeup from deep sleep. It is not needed on devices that don't have HFXO-SYSRTC integration, and it is not needed if the application doesn't use deep sleep. Add missing call to init_hardware() prior to init(). Signed-off-by: Aksel Skauge Mellbye <[email protected]>
1 parent 00378b5 commit 8fc5514

File tree

7 files changed

+58
-16
lines changed

7 files changed

+58
-16
lines changed

dts/arm/silabs/efr32bg22.dtsi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
interrupts = <46 0>;
3232
};
3333

34+
&hfxo {
35+
interrupts = <44 0>;
36+
interrupt-names = "hfxo";
37+
};
38+
3439
&msc {
3540
flash0: flash@0 {
3641
compatible = "soc-nv-flash";

dts/arm/silabs/efr32bg27.dtsi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
interrupts = <52 0>;
4242
};
4343

44+
&hfxo {
45+
interrupts = <50 0>;
46+
interrupt-names = "hfxo";
47+
};
48+
4449
&msc {
4550
flash0: flash@8000000 {
4651
compatible = "soc-nv-flash";

dts/arm/silabs/efr32mg21.dtsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@
138138
#clock-cells = <0>;
139139
compatible = "silabs,hfxo";
140140
reg = <0x5000c000 0x4000>;
141+
interrupts = <45 0>;
142+
interrupt-names = "hfxo";
141143
clock-frequency = <DT_FREQ_K(38400)>;
142144
ctune = <140>;
143145
precision = <50>;

dts/arm/silabs/efr32mg24.dtsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@
208208
#clock-cells = <0>;
209209
compatible = "silabs,hfxo";
210210
reg = <0x5a004000 0x4000>;
211+
interrupts = <44 0>;
212+
interrupt-names = "hfxo";
211213
clock-frequency = <DT_FREQ_M(39)>;
212214
ctune = <140>;
213215
precision = <50>;

modules/hal_silabs/simplicity_sdk/CMakeLists.txt

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,6 @@ zephyr_compile_definitions(
114114
${SILABS_DEVICE_PART_NUMBER}
115115
)
116116

117-
zephyr_compile_definitions_ifdef(CONFIG_SOC_GECKO_DEV_INIT
118-
SL_CATALOG_POWER_MANAGER_PRESENT
119-
SL_CATALOG_HFXO_MANAGER_PRESENT
120-
)
121-
122117
zephyr_library_sources(
123118
${DEVICE_DIR}/SiliconLabs/${SILABS_DEVICE_FAMILY}/Source/system_${CONFIG_SOC_SERIES}.c
124119
${EMLIB_DIR}/src/em_system.c
@@ -131,6 +126,7 @@ zephyr_library_sources(
131126
${SERVICE_DIR}/device_manager/src/sl_device_clock.c
132127
${SERVICE_DIR}/device_manager/src/sl_device_gpio.c
133128
${SERVICE_DIR}/device_manager/src/sl_device_peripheral.c
129+
${SERVICE_DIR}/memory_manager/profiler/src/sli_memory_profiler_stubs.c
134130
)
135131

136132
if(NOT SILABS_DEVICE_FAMILY_NUMBER EQUAL "21")
@@ -156,18 +152,37 @@ zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_IADC ${EMLIB_DIR}/src/em_i
156152
zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_BURTC ${EMLIB_DIR}/src/em_burtc.c)
157153
zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CMU ${EMLIB_DIR}/src/em_cmu.c)
158154

155+
# Device Init
159156
if(CONFIG_SOC_GECKO_DEV_INIT)
160-
zephyr_library_sources_ifdef(CONFIG_DT_HAS_SILABS_SERIES2_DCDC_ENABLED
161-
${SERVICE_DIR}/device_init/src/sl_device_init_dcdc_s2.c
162-
)
157+
zephyr_library_sources_ifdef(CONFIG_DT_HAS_SILABS_SERIES2_DCDC_ENABLED
158+
${SERVICE_DIR}/device_init/src/sl_device_init_dcdc_s2.c
159+
)
160+
endif()
161+
162+
# Power Manager
163+
if(CONFIG_SOC_GECKO_PM_BACKEND_PMGR)
164+
zephyr_library_sources(
165+
${SERVICE_DIR}/power_manager/src/sl_power_manager.c
166+
${SERVICE_DIR}/power_manager/src/sl_power_manager_hal_s2.c
167+
)
168+
zephyr_compile_definitions(
169+
SL_CATALOG_POWER_MANAGER_PRESENT
170+
)
171+
zephyr_compile_definitions_ifdef(CONFIG_SOC_GECKO_RTCC
172+
SL_CATALOG_POWER_MANAGER_DEEPSLEEP_BLOCKING_HFXO_RESTORE_PRESENT
173+
)
174+
endif()
175+
176+
# HFXO Manager
177+
if(CONFIG_SOC_SILABS_HFXO_MANAGER)
178+
zephyr_library_sources(
179+
${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager.c
180+
${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager_hal_s2.c
181+
)
182+
zephyr_compile_definitions(
183+
SL_CATALOG_HFXO_MANAGER_PRESENT
184+
)
163185
endif()
164-
zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT
165-
${SERVICE_DIR}/power_manager/src/sl_power_manager.c
166-
${SERVICE_DIR}/power_manager/src/sl_power_manager_hal_s2.c
167-
${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager.c
168-
${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager_hal_s2.c
169-
${SERVICE_DIR}/memory_manager/profiler/src/sli_memory_profiler_stubs.c
170-
)
171186

172187
zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT ${COMMON_DIR}/src/sl_slist.c)
173188
zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CORE

soc/silabs/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ config SOC_SILABS_SLEEPTIMER
128128
help
129129
Set if the Sleeptimer HAL module is used.
130130

131+
config SOC_SILABS_HFXO_MANAGER
132+
bool
133+
default y if PM && $(dt_nodelabel_enabled,sysrtc0) && $(dt_nodelabel_enabled,hfxo)
134+
help
135+
Set if the HFXO Manager HAL module is used.
136+
131137
if PM
132138

133139
config SOC_GECKO_PM_BACKEND_PMGR

soc/silabs/silabs_s2/soc.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232

3333
LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
3434

35+
#if defined(CONFIG_SOC_SILABS_HFXO_MANAGER)
36+
Z_ISR_DECLARE_DIRECT(DT_IRQ(DT_NODELABEL(hfxo), irq), 0, sl_hfxo_manager_irq_handler);
37+
#endif
38+
3539
void soc_early_init_hook(void)
3640
{
3741
/* Handle chip errata */
@@ -42,9 +46,12 @@ void soc_early_init_hook(void)
4246
}
4347
sl_clock_manager_init();
4448

49+
if (IS_ENABLED(CONFIG_SOC_SILABS_HFXO_MANAGER)) {
50+
sl_hfxo_manager_init_hardware();
51+
sl_hfxo_manager_init();
52+
}
4553
if (IS_ENABLED(CONFIG_PM)) {
4654
sl_power_manager_init();
47-
sl_hfxo_manager_init();
4855
}
4956
}
5057

0 commit comments

Comments
 (0)