From c4d3306042f78ec1f27030b38c17d80cf191893a Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Fri, 2 Apr 2021 17:13:27 +0200 Subject: [PATCH] soc/arm: st_stm32: Optionally Set SYS_CLOCK_HW_CYCLES_PER_SEC using dt Optionally configure Kconfig SYS_CLOCK_HW_CYCLES_PER_SEC using clock-frequency provided by dt if sysclk node is enabled Signed-off-by: Erwan Gouriou --- soc/arm/st_stm32/common/Kconfig.defconfig.series | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/soc/arm/st_stm32/common/Kconfig.defconfig.series b/soc/arm/st_stm32/common/Kconfig.defconfig.series index 146bb7208c8..16f7b8c4bcb 100644 --- a/soc/arm/st_stm32/common/Kconfig.defconfig.series +++ b/soc/arm/st_stm32/common/Kconfig.defconfig.series @@ -10,6 +10,12 @@ if SOC_FAMILY_STM32 config CORTEX_M_SYSTICK default n if STM32_LPTIM_TIMER +DT_STM32_RCC_PATH := $(dt_nodelabel_path,rcc) +DT_STM32_RCC_CLOCK_FREQ := $(dt_node_int_prop_int,$(DT_STM32_RCC_PATH),clock-frequency) + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default "$(DT_STM32_RCC_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,rcc)" + # set the tick per sec as a divider of the LPTIM clock source config SYS_CLOCK_TICKS_PER_SEC default 4096 if STM32_LPTIM_TIMER && STM32_LPTIM_CLOCK_LSE