Skip to content

Commit 349e9e6

Browse files
committed
driver: sleeptimer: siwx917: Add siwx91x Sleeptimer driver
This commit enables the Sleeptimer driver support for the siwx917 device. Signed-off-by: S Mohamed Fiaz <[email protected]>
1 parent 3d9ac79 commit 349e9e6

File tree

9 files changed

+71
-2
lines changed

9 files changed

+71
-2
lines changed

boards/silabs/radio_boards/siwx917_rb4338a/siwx917_rb4338a.dts

+4
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@
106106
};
107107
};
108108

109+
&sysrtc0 {
110+
status = "okay";
111+
};
112+
109113
&bt_hci0 {
110114
status = "okay";
111115
};

drivers/timer/Kconfig.silabs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
config SILABS_SLEEPTIMER_TIMER
55
bool "Silabs Sleeptimer system clock driver"
6-
depends on SOC_FAMILY_SILABS_S2
6+
depends on SOC_FAMILY_SILABS_S2 || SOC_FAMILY_SILABS_SIWX91X
77
depends on DT_HAS_SILABS_GECKO_STIMER_ENABLED
88
select SOC_SILABS_SLEEPTIMER
99
select TICKLESS_CAPABLE

drivers/timer/silabs_sleeptimer_timer.c

+6
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,15 @@ static int sleeptimer_init(void)
121121
sl_status_t status = SL_STATUS_OK;
122122
struct sleeptimer_timer_data *timer = &g_sleeptimer_timer_data;
123123

124+
#ifdef CONFIG_SOC_FAMILY_SILABS_SIWX91X
125+
IRQ_CONNECT(DT_IRQ(DT_RTC, irq), DT_IRQ(DT_RTC, priority),
126+
CONCAT(DT_STRING_UPPER_TOKEN_BY_IDX(DT_RTC, interrupt_names, 0), _Handler), 0,
127+
0);
128+
#else
124129
IRQ_CONNECT(DT_IRQ(DT_RTC, irq), DT_IRQ(DT_RTC, priority),
125130
CONCAT(DT_STRING_UPPER_TOKEN_BY_IDX(DT_RTC, interrupt_names, 0), _IRQHandler),
126131
0, 0);
132+
#endif
127133

128134
sl_sleeptimer_init();
129135

dts/arm/silabs/siwg917.dtsi

+11
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,17 @@
285285
clocks = <&clock0 SIWX91X_CLK_WATCHDOG>;
286286
status = "disabled";
287287
};
288+
289+
sysrtc0: sysrtc@24048c00 {
290+
compatible = "silabs,gecko-stimer";
291+
reg = <0x24048c00 0x78>;
292+
interrupts = <22 0>;
293+
interrupt-parent = <&nvic>;
294+
interrupt-names = "irq022";
295+
clock-frequency = <32768>;
296+
prescaler = <1>;
297+
status = "disabled";
298+
};
288299
};
289300
};
290301

modules/hal_silabs/wiseconnect/CMakeLists.txt

+28
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ zephyr_compile_definitions(
1616
SLI_SI91X_MCU_INTERFACE
1717
SLI_SI917
1818
SLI_SI917B0
19+
SLI_SI91X_ENABLE_OS
1920
CLOCK_ROMDRIVER_PRESENT
2021
)
2122

@@ -151,5 +152,32 @@ if(CONFIG_WISECONNECT_NETWORK_STACK)
151152
)
152153
endif() # CONFIG_WISECONNECT_NETWORK_STACK
153154

155+
# Sleeptimer for 917 devices
156+
if(CONFIG_SOC_SILABS_SLEEPTIMER)
157+
zephyr_include_directories(
158+
${SISDK_DIR}/platform/service/sleeptimer/inc
159+
${SISDK_DIR}/platform/service/sleeptimer/src
160+
${SISDK_DIR}/platform/service/sleeptimer/config
161+
)
162+
163+
zephyr_library_sources(
164+
${SISDK_DIR}/platform/service/sleeptimer/src/sl_sleeptimer.c
165+
${WISECONNECT_DIR}/components/device/silabs/si91x/mcu/drivers/service/sleeptimer/src/sl_sleeptimer_hal_si91x_sysrtc.c
166+
)
167+
zephyr_code_relocate(FILES
168+
${ZEPHYR_BASE}/arch/arm/core/cortex_m/isr_wrapper.c
169+
${SISDK_DIR}/platform/service/sleeptimer/src/sl_sleeptimer.c
170+
${WISECONNECT_DIR}/components/device/silabs/si91x/mcu/drivers/service/sleeptimer/src/sl_sleeptimer_hal_si91x_sysrtc.c
171+
${WISECONNECT_DIR}/components/device/silabs/si91x/mcu/drivers/peripheral_drivers/src/rsi_sysrtc.c
172+
LOCATION RAM
173+
FILTER ".*"
174+
)
175+
zephyr_compile_definitions(
176+
SL_CATALOG_SLEEPTIMER_PRESENT
177+
SL_CODE_COMPONENT_SLEEPTIMER=sleeptimer
178+
SL_CODE_COMPONENT_HAL_SYSRTC=hal_sysrtc
179+
)
180+
endif() # CONFIG_SOC_SILABS_SLEEPTIMER
181+
154182
zephyr_linker_sources(ROM_SECTIONS linker/code_classification_text.ld)
155183
zephyr_linker_sources(RAMFUNC_SECTION linker/code_classification_ramfunc.ld)

soc/silabs/Kconfig

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
rsource "*/Kconfig"
66

7+
if SOC_FAMILY_SILABS_SIWX91X
8+
source "soc/silabs/Kconfig.siwx91x"
9+
endif
10+
711
if SOC_FAMILY_SILABS_S0 || SOC_FAMILY_SILABS_S1 || SOC_FAMILY_SILABS_S2
812

913
config SOC_GECKO_SDID

soc/silabs/Kconfig.siwx91x

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Kconfig entries for SOC_FAMILY_SILABS_SIWX91X
2+
3+
config SOC_SILABS_SLEEPTIMER
4+
bool
5+
select CODE_DATA_RELOCATION
6+
help
7+
Set if the Sleeptimer HAL module is used for SIWX91X.

soc/silabs/silabs_siwx91x/Kconfig.defconfig

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33

44
if SOC_FAMILY_SILABS_SIWX91X
55

6+
configdefault SILABS_SLEEPTIMER_TIMER
7+
default y
8+
9+
configdefault CORTEX_M_SYSTICK
10+
default n if SILABS_SLEEPTIMER_TIMER
11+
12+
configdefault SYS_CLOCK_TICKS_PER_SEC
13+
default 1024 if SILABS_SLEEPTIMER_TIMER
14+
615
config WISECONNECT_NETWORK_STACK
716
bool
817
select CMSIS_RTOS_V2

west.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ manifest:
228228
groups:
229229
- hal
230230
- name: hal_silabs
231-
revision: 9d32354344f6c816410e2642c2f81677f8a60e96
231+
revision: pull/93/head
232232
path: modules/hal/silabs
233233
groups:
234234
- hal

0 commit comments

Comments
 (0)