Skip to content

Commit 28edc26

Browse files
asmellbycfriedt
authored andcommitted
modules: hal_silabs: Simplify HFRCO frequency selection
Recent versions of the HAL rely on interpreting the HFRCO frequency selection as a plain integer in preprocessor comparisons. The adaptation layer in Zephyr created a C expression that was not possible to evaluate by the preprocessor. Simplify the logic to directly passing the devicetree value to the driver. This slightly changes the behavior of the code by no longer accepting arbitrary frequencies and mapping them to the closest HFRCO band. However, the binding documentation already states that the frequency should match the band. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
1 parent e6cb52e commit 28edc26

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

modules/hal_silabs/simplicity_sdk/config/sl_clock_manager_oscillator_config.h

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,7 @@
2929
(DT_ENUM_IDX(DT_NODELABEL(lfxo), timeout) << _LFXO_CFG_TIMEOUT_SHIFT)
3030

3131
/* HFRCODPLL */
32-
#define SL_CLOCK_MANAGER_HFRCO_BAND \
33-
(DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 1500000 ? 1000000U \
34-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 3000000 ? 2000000U \
35-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 5500000 ? 4000000U \
36-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 10000000 ? 7000000U \
37-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 14500000 ? 13000000U \
38-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 17500000 ? 16000000U \
39-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 23000000 ? 19000000U \
40-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 29000000 ? 26000000U \
41-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 35000000 ? 32000000U \
42-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 44000000 ? 38000000U \
43-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 52000000 ? 48000000U \
44-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 60000000 ? 56000000U \
45-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 72000000 ? 64000000U \
46-
: DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 90000000 ? 80000000U \
47-
: 100000000U)
32+
#define SL_CLOCK_MANAGER_HFRCO_BAND DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency)
4833
#define SL_CLOCK_MANAGER_HFRCO_DPLL_EN DT_NUM_CLOCKS(DT_NODELABEL(hfrcodpll))
4934
#define SL_CLOCK_MANAGER_DPLL_FREQ DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency)
5035
#define SL_CLOCK_MANAGER_DPLL_N DT_PROP(DT_NODELABEL(hfrcodpll), dpll_n)

0 commit comments

Comments
 (0)