Skip to content

Commit ef15c3d

Browse files
mathieuchopstmjhedberg
authored andcommitted
drivers: clock_control: stm32: define STM32_HSE_CLOCK based only on DT
Ensure the CONFIG_CLOCK_STM32_HSE_CLOCK symbol cannot be overridden by making it depend on the Device Tree node "clk_hse" being enabled. The symbol's value is also directly sourced from that node instead of being user-configurable. Signed-off-by: Mathieu Choplain <[email protected]>
1 parent 5f1ced7 commit ef15c3d

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

drivers/clock_control/Kconfig.stm32

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,30 @@ menuconfig CLOCK_CONTROL_STM32_CUBE
2222

2323
if CLOCK_CONTROL_STM32_CUBE
2424

25-
DT_STM32_HSE_CLOCK := $(dt_nodelabel_path,clk_hse)
26-
DT_STM32_HSE_CLOCK_FREQ := $(dt_node_int_prop_int,$(DT_STM32_HSE_CLOCK),clock-frequency)
27-
2825
config CLOCK_STM32_HSE_CLOCK
29-
int "HSE clock value"
30-
default "$(DT_STM32_HSE_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,clk_hse)"
31-
default 8000000
26+
int
27+
default $(dt_nodelabel_int_prop,clk_hse,clock-frequency)
28+
depends on $(dt_nodelabel_enabled,clk_hse)
3229
help
33-
Value of external high-speed clock (HSE). This symbol could be optionally
34-
configured using device tree by setting "clock-frequency" value of clk_hse
35-
node. For instance:
36-
&clk_hse{
37-
status = "okay";
38-
clock-frequency = <DT_FREQ_M(25)>;
39-
};
40-
Note: Device tree configuration is overridden when current symbol is set:
41-
CONFIG_CLOCK_STM32_HSE_CLOCK=32000000
30+
Frequency of external high-speed clock (HSE).
31+
32+
The value of this symbol is used to set the preprocessor
33+
definition "HSE_VALUE" notably consumed by the HAL.
34+
35+
This symbol cannot be set externally: its value is directly
36+
taken from the "clock-frequency" property of the "clk_hse"
37+
Device Tree node when it is enabled.
38+
39+
This node would usually looks similar to:
40+
41+
&clk_hse {
42+
clock-frequency = <DT_FREQ_M(25)>;
43+
status = "okay";
44+
};
45+
46+
If the "clk_hse" node does not exist or is not enabled
47+
(status != "okay"), this symbol is not defined and the
48+
HSE_VALUE preprocessor definition does not exist.
4249

4350
config CLOCK_STM32_MUX
4451
bool "STM32 clock mux driver"

0 commit comments

Comments
 (0)