Skip to content

driver: sleeptimer: siwx917: Add siwx91x Sleeptimer driver #87603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@
};
};

&sysrtc0 {
status = "okay";
};

&bt_hci0 {
status = "okay";
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/timer/Kconfig.silabs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

config SILABS_SLEEPTIMER_TIMER
bool "Silabs Sleeptimer system clock driver"
depends on SOC_FAMILY_SILABS_S2
depends on SOC_FAMILY_SILABS_S2 || SOC_FAMILY_SILABS_SIWX91X
depends on DT_HAS_SILABS_GECKO_STIMER_ENABLED
select SOC_SILABS_SLEEPTIMER
select TICKLESS_CAPABLE
Expand Down
11 changes: 11 additions & 0 deletions dts/arm/silabs/siwg917.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <arm/armv7-m.dtsi>
#include <zephyr/dt-bindings/clock/silabs/siwx91x-clock.h>
#include <freq.h>

/ {
chosen {
Expand Down Expand Up @@ -285,6 +286,16 @@
clocks = <&clock0 SIWX91X_CLK_WATCHDOG>;
status = "disabled";
};

sysrtc0: sysrtc@24048c00 {
compatible = "silabs,gecko-stimer";
reg = <0x24048c00 0x78>;
interrupts = <22 0>;
interrupt-names = "sysrtc";
clock-frequency = <DT_FREQ_K(32)>;
prescaler = <1>;
status = "disabled";
};
};
};

Expand Down
18 changes: 18 additions & 0 deletions modules/hal_silabs/wiseconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,23 @@ if(CONFIG_WISECONNECT_NETWORK_STACK)
)
endif() # CONFIG_WISECONNECT_NETWORK_STACK

if(CONFIG_SOC_SILABS_SLEEPTIMER)
zephyr_include_directories(
${SISDK_DIR}/platform/service/sleeptimer/inc
${SISDK_DIR}/platform/service/sleeptimer/src
${SISDK_DIR}/platform/service/sleeptimer/config
)

zephyr_library_sources(
${SISDK_DIR}/platform/service/sleeptimer/src/sl_sleeptimer.c
${WISECONNECT_DIR}/components/device/silabs/si91x/mcu/drivers/service/sleeptimer/src/sl_sleeptimer_hal_si91x_sysrtc.c
)
zephyr_compile_definitions(
SL_CATALOG_SLEEPTIMER_PRESENT
SL_CODE_COMPONENT_SLEEPTIMER=sleeptimer
SL_CODE_COMPONENT_HAL_SYSRTC=hal_sysrtc
)
endif() # CONFIG_SOC_SILABS_SLEEPTIMER

zephyr_linker_sources(ROM_SECTIONS linker/code_classification_text.ld)
zephyr_linker_sources(RAMFUNC_SECTION linker/code_classification_ramfunc.ld)
5 changes: 5 additions & 0 deletions soc/silabs/silabs_siwx91x/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ config SOC_FAMILY_SILABS_SIWX91X
select CPU_HAS_ARM_MPU
select HAS_SILABS_WISECONNECT
select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE

config SOC_SILABS_SLEEPTIMER
bool
help
The Sleeptimer HAL module is used for SIWX91X.
10 changes: 10 additions & 0 deletions soc/silabs/silabs_siwx91x/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@

if SOC_FAMILY_SILABS_SIWX91X

configdefault SILABS_SLEEPTIMER_TIMER
default y
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SLEEPTIMER has some drawbacks. Maybe default y if PM?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrt PM is still under developement, its noted and would be addressed in that PR.


configdefault CORTEX_M_SYSTICK
default n if SILABS_SLEEPTIMER_TIMER

configdefault SYS_CLOCK_TICKS_PER_SEC
default 128 if !TICKLESS_KERNEL && SILABS_SLEEPTIMER_TIMER
default 1024 if SILABS_SLEEPTIMER_TIMER

config WISECONNECT_NETWORK_STACK
bool
select CMSIS_RTOS_V2
Expand Down
2 changes: 2 additions & 0 deletions soc/silabs/silabs_siwx91x/siwg917/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@

#include "si91x_device.h"

#define SYSRTC_IRQHandler IRQ022_Handler

#endif
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ manifest:
groups:
- hal
- name: hal_silabs
revision: 9d32354344f6c816410e2642c2f81677f8a60e96
revision: 40a0237e4812241de677441e02131d6c75830636
path: modules/hal/silabs
groups:
- hal
Expand Down