Skip to content

Commit e524c1f

Browse files
Martinhoff-makernashif
authored andcommitted
soc: silabs: siwx91x: define hardware sys clock from dts
This patch introduce configuration of the symbol 'SYS_CLOCK_HW_CYCLES_PER_SEC' with dts entry rather than a hardcoded value. Clock control on siwx91x needs to use the clock frequency of the cpu to init rather than the 'SYS_CLOCK_HW_CYCLES_PER_SEC' symbol, otherwise we initialize the m4 clock with the ULP ref clock. Signed-off-by: Martin Hoff <[email protected]>
1 parent 470290c commit e524c1f

File tree

8 files changed

+20
-5
lines changed

8 files changed

+20
-5
lines changed

boards/silabs/dev_kits/siwx917_dk2605a/siwx917_dk2605a.dts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@
8585
};
8686
};
8787

88+
&cpu0 {
89+
clock-frequency = <180000000>;
90+
};
91+
8892
&ulpuart {
8993
pinctrl-0 = <&ulpuart_default>;
9094
pinctrl-names = "default";

boards/silabs/dev_kits/siwx917_dk2605a/siwx917_dk2605a_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Copyright (c) 2025 Silicon Laboratories Inc.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=180000000
54
CONFIG_USE_DT_CODE_PARTITION=y
65
CONFIG_CONSOLE=y
76
CONFIG_UART_CONSOLE=y

boards/silabs/radio_boards/siwx917_rb4338a/siwx917_rb4338a.dts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@
7777
};
7878
};
7979

80+
&cpu0 {
81+
clock-frequency = <180000000>;
82+
};
83+
8084
&ulpuart {
8185
pinctrl-0 = <&ulpuart_default>;
8286
pinctrl-names = "default";

boards/silabs/radio_boards/siwx917_rb4338a/siwx917_rb4338a_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Copyright (c) 2024 Silicon Laboratories Inc.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=180000000
54
CONFIG_USE_DT_CODE_PARTITION=y
65
CONFIG_CONSOLE=y
76
CONFIG_UART_CONSOLE=y

boards/silabs/radio_boards/siwx917_rb4342a/siwx917_rb4342a.dts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@
7878
};
7979
};
8080

81+
&cpu0 {
82+
clock-frequency = <180000000>;
83+
};
84+
8185
&ulpuart {
8286
pinctrl-0 = <&ulpuart_default>;
8387
pinctrl-names = "default";

boards/silabs/radio_boards/siwx917_rb4342a/siwx917_rb4342a_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Copyright (c) 2025 Silicon Laboratories Inc.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=180000000
54
CONFIG_USE_DT_CODE_PARTITION=y
65
CONFIG_CONSOLE=y
76
CONFIG_UART_CONSOLE=y

drivers/clock_control/clock_control_silabs_siwx91x.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,12 @@ static int siwx91x_clock_init(const struct device *dev)
245245
sl_si91x_clock_manager_init();
246246

247247
/* Use SoC PLL at configured frequency as core clock */
248-
sl_si91x_clock_manager_m4_set_core_clk(M4_SOCPLLCLK, CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC);
248+
sl_si91x_clock_manager_m4_set_core_clk(M4_SOCPLLCLK,
249+
DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency));
249250

250251
/* Use interface PLL at configured frequency as peripheral clock */
251-
sl_si91x_clock_manager_set_pll_freq(INFT_PLL, CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC,
252+
sl_si91x_clock_manager_set_pll_freq(INFT_PLL,
253+
DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency),
252254
PLL_REF_CLK_VAL_XTAL);
253255

254256
/* FIXME: Currently the clock consumer use clocks without power on them.

soc/silabs/silabs_siwx91x/Kconfig.defconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ if SOC_FAMILY_SILABS_SIWX91X
66
configdefault CORTEX_M_SYSTICK
77
default n if SILABS_SLEEPTIMER_TIMER
88

9+
configdefault SYS_CLOCK_HW_CYCLES_PER_SEC
10+
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK
11+
default 32768
12+
913
configdefault SYS_CLOCK_TICKS_PER_SEC
1014
default 128 if !TICKLESS_KERNEL && SILABS_SLEEPTIMER_TIMER
1115
default 1024 if SILABS_SLEEPTIMER_TIMER

0 commit comments

Comments
 (0)