diff --git a/boards/oct/osd32mp1_brk/Kconfig.defconfig b/boards/oct/osd32mp1_brk/Kconfig.defconfig index 7ca8f045d0a44..aa485652f7ee9 100644 --- a/boards/oct/osd32mp1_brk/Kconfig.defconfig +++ b/boards/oct/osd32mp1_brk/Kconfig.defconfig @@ -7,7 +7,4 @@ config SPI_STM32_INTERRUPT default y depends on SPI -config CLOCK_STM32_HSE_CLOCK - default 24000000 - endif # BOARD_OSD32MP1_BRK diff --git a/boards/oct/osd32mp1_brk/osd32mp1_brk_defconfig b/boards/oct/osd32mp1_brk/osd32mp1_brk_defconfig index 755f96c194836..fd2de72199ceb 100644 --- a/boards/oct/osd32mp1_brk/osd32mp1_brk_defconfig +++ b/boards/oct/osd32mp1_brk/osd32mp1_brk_defconfig @@ -1,3 +1,7 @@ +# HSE is controlled by Cortex-A but its +# frequency must be provided to the HAL +CONFIG_CLOCK_STM32_HSE_CLOCK=24000000 + # Enable GPIO CONFIG_GPIO=y diff --git a/boards/st/stm32mp157c_dk2/Kconfig.defconfig b/boards/st/stm32mp157c_dk2/Kconfig.defconfig index 40490cb49c3f9..68c16e54abfab 100644 --- a/boards/st/stm32mp157c_dk2/Kconfig.defconfig +++ b/boards/st/stm32mp157c_dk2/Kconfig.defconfig @@ -9,7 +9,4 @@ config SPI_STM32_INTERRUPT default y depends on SPI -config CLOCK_STM32_HSE_CLOCK - default 24000000 - -endif # BOARD_STM32MP157_Dk2 +endif # BOARD_STM32MP157_DK2 diff --git a/boards/st/stm32mp157c_dk2/stm32mp157c_dk2_defconfig b/boards/st/stm32mp157c_dk2/stm32mp157c_dk2_defconfig index 63bc58b126184..02ade46bdb95b 100644 --- a/boards/st/stm32mp157c_dk2/stm32mp157c_dk2_defconfig +++ b/boards/st/stm32mp157c_dk2/stm32mp157c_dk2_defconfig @@ -1,3 +1,7 @@ +# HSE is controlled by Cortex-A but its +# frequency must be provided to the HAL +CONFIG_CLOCK_STM32_HSE_CLOCK=24000000 + # enable GPIO CONFIG_GPIO=y diff --git a/drivers/clock_control/Kconfig.stm32 b/drivers/clock_control/Kconfig.stm32 index 9d76ae2bf2ded..2377e1c6ae634 100644 --- a/drivers/clock_control/Kconfig.stm32 +++ b/drivers/clock_control/Kconfig.stm32 @@ -22,23 +22,31 @@ menuconfig CLOCK_CONTROL_STM32_CUBE if CLOCK_CONTROL_STM32_CUBE -DT_STM32_HSE_CLOCK := $(dt_nodelabel_path,clk_hse) -DT_STM32_HSE_CLOCK_FREQ := $(dt_node_int_prop_int,$(DT_STM32_HSE_CLOCK),clock-frequency) +TMP_HSE := $(dt_nodelabel_path, clk_hse) config CLOCK_STM32_HSE_CLOCK - int "HSE clock value" - default "$(DT_STM32_HSE_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,clk_hse)" - default 8000000 + int "HSE clock value" if !$(dt_nodelabel_enabled,clk_hse) +####### default $(dt_nodelabel_int_prop,clk_hse,clock-frequency) + default $(dt_node_int_prop_int,$(TMP_HSE),clock-frequency) help - Value of external high-speed clock (HSE). This symbol could be optionally - configured using device tree by setting "clock-frequency" value of clk_hse - node. For instance: - &clk_hse{ - status = "okay"; - clock-frequency = ; - }; - Note: Device tree configuration is overridden when current symbol is set: - CONFIG_CLOCK_STM32_HSE_CLOCK=32000000 + Frequency of external high-speed clock (HSE). + + The value of this symbol is used to set the preprocessor + definition "HSE_VALUE" notably consumed by the HAL. + + Usually, this symbol's value is directly taken from the + "clock-frequency" property of the "clk_hse" Device Tree + node, which usually looks similar to: + + &clk_hse { + clock-frequency = ; + status = "okay"; + }; + + If the "clk_hse" node does not exist or is not enabled + (status != "okay"), this symbol becomes visible and can + be assigned a value through Kconfig configuration files. + This mechanism is used on specific STM32 platforms. config CLOCK_STM32_MUX bool "STM32 clock mux driver"