From a62bc0332cee637d6ad8b80f1b2019a13a3e074c Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Tue, 14 Oct 2025 15:07:29 +0200 Subject: [PATCH 1/2] drivers: timer: stm32_lptim: drop clock source configuration via Kconfig Remove the possibility to configure the LPTIM timer clock source through Kconfig. The deprecation warning was added 3 years ago in Zephyr 3.2 by commit bbac316be7867d44bcb9f3600fcb2e77f7237223; more than enough time has elapsed for this option to be removed. Signed-off-by: Mathieu Choplain --- drivers/timer/Kconfig.stm32_lptim | 20 ++++++++------------ drivers/timer/stm32_lptim_timer.c | 18 ++++-------------- soc/st/stm32/Kconfig.defconfig | 5 ----- 3 files changed, 12 insertions(+), 31 deletions(-) diff --git a/drivers/timer/Kconfig.stm32_lptim b/drivers/timer/Kconfig.stm32_lptim index bdd732467559d..b5c53166a9629 100644 --- a/drivers/timer/Kconfig.stm32_lptim +++ b/drivers/timer/Kconfig.stm32_lptim @@ -4,6 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 DT_CHOSEN_STDBY_TIMER := st,lptim-stdby-timer +DT_STM32_LPTIM_PATH := $(dt_nodelabel_path,stm32_lp_tick_source) menuconfig STM32_LPTIM_TIMER bool "STM32 Low Power Timer [EXPERIMENTAL]" @@ -18,23 +19,18 @@ menuconfig STM32_LPTIM_TIMER if STM32_LPTIM_TIMER -choice STM32_LPTIM_CLOCK - prompt "LPTIM clock value configuration" - help - This option is deprecated and configuration of LPTIM domain clock - using devicetree should be preferred. - +# Invisible symbols exposing the selected LPTIM source to Kconfig +# NOTE: the values 2/3 correspond too STM32_SRC_LSE/STM32_SRC_LSI +# defined in include/zephyr/dt-bindings/clock/stm32_common_clocks.h config STM32_LPTIM_CLOCK_LSI - bool "LSI" + def_bool "$(dt_node_ph_array_prop_int,$(DT_STM32_LPTIM_PATH),clocks,1,bus)" = 3 help - Use LSI as LPTIM clock + LSI used as LPTIM clock source config STM32_LPTIM_CLOCK_LSE - bool "LSE" + def_bool "$(dt_node_ph_array_prop_int,$(DT_STM32_LPTIM_PATH),clocks,1,bus)" = 2 help - Use LSE as LPTIM clock - -endchoice + LSE used as LPTIM clock source config STM32_LPTIM_CLOCK int diff --git a/drivers/timer/stm32_lptim_timer.c b/drivers/timer/stm32_lptim_timer.c index ed57b4e5defbb..23fbfcdab7b59 100644 --- a/drivers/timer/stm32_lptim_timer.c +++ b/drivers/timer/stm32_lptim_timer.c @@ -28,23 +28,13 @@ #error Only one LPTIM instance should be enabled #endif +#if DT_INST_NUM_CLOCKS(0) <= 1 +#error "LPTIM source clock must be provided in Device Tree" +#endif + #define LPTIM (LPTIM_TypeDef *) DT_INST_REG_ADDR(0) -#if DT_INST_NUM_CLOCKS(0) == 1 -#warning Kconfig for LPTIM source clock (LSI/LSE) is deprecated, use device tree. -static const struct stm32_pclken lptim_clk[] = { - STM32_CLOCK_INFO(0, DT_DRV_INST(0)), - /* Use Kconfig to configure source clocks fields */ - /* Fortunately, values are consistent across enabled series */ -#ifdef CONFIG_STM32_LPTIM_CLOCK_LSI - {.bus = STM32_SRC_LSI, .enr = LPTIM1_SEL(1)} -#else - {.bus = STM32_SRC_LSE, .enr = LPTIM1_SEL(3)} -#endif -}; -#else static const struct stm32_pclken lptim_clk[] = STM32_DT_INST_CLOCKS(0); -#endif static const struct device *const clk_ctrl = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE); diff --git a/soc/st/stm32/Kconfig.defconfig b/soc/st/stm32/Kconfig.defconfig index 572ebe6085437..c30bf5e1b15a1 100644 --- a/soc/st/stm32/Kconfig.defconfig +++ b/soc/st/stm32/Kconfig.defconfig @@ -72,11 +72,6 @@ config SYS_CLOCK_TICKS_PER_SEC default 250 if "$(dt_node_int_prop_int,$(DT_STM32_LPTIM_PATH),$(DT_ST_PRESCALER))" = 128 depends on STM32_LPTIM_TIMER && STM32_LPTIM_CLOCK_LSI -choice STM32_LPTIM_CLOCK - default STM32_LPTIM_CLOCK_LSE if "$(dt_node_ph_array_prop_int,$(DT_STM32_LPTIM_PATH),clocks,1,bus)" = 2 - default STM32_LPTIM_CLOCK_LSI if "$(dt_node_ph_array_prop_int,$(DT_STM32_LPTIM_PATH),clocks,1,bus)" = 3 -endchoice - config CLOCK_CONTROL_INIT_PRIORITY default 1 depends on CLOCK_CONTROL From 819080511ee51eb05253ac32f046301fe2cd7257 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Tue, 14 Oct 2025 15:18:21 +0200 Subject: [PATCH 2/2] release-notes: 4.3: add STM32 LPTIM clock source Kconfig removal notice Add notice about removal of LPTIM clock source configuration through Kconfig in the Zephyr 4.3 release notes. Signed-off-by: Mathieu Choplain --- doc/releases/release-notes-4.3.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/releases/release-notes-4.3.rst b/doc/releases/release-notes-4.3.rst index b7a137c68cf84..c10a6d82ce95c 100644 --- a/doc/releases/release-notes-4.3.rst +++ b/doc/releases/release-notes-4.3.rst @@ -60,6 +60,8 @@ Removed APIs and options * ``bt_le_set_auto_conn`` * ``CONFIG_BT_BUF_ACL_RX_COUNT`` * ``ok`` enum value has now been removed completely from ``base.yaml`` binding ``status`` property in devicetree. +* STM32 LPTIM clock source selection through Kconfig was removed. Device Tree must now be used instead. + Affected Kconfig symbols: ``CONFIG_STM32_LPTIM_CLOCK_LSI`` / ``CONFIG_STM32_LPTIM_CLOCK_LSI`` Deprecated APIs and options ===========================