From 4d1139de9100a01c9fcb6fd8f576649a7498cb21 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Fri, 4 Apr 2025 11:29:26 -0400 Subject: [PATCH] soc: microchip: mec: Unify kernel timer tick rate configuration Microchip MEC was configuring the kernel timer tick rate at the board level instead of the SoC level. We unify all this by moving the Kconfig logic out of the board level into each mec chip. We also derive SYS_CLOCK_HW_TICKS_PER_SEC from the device tree node enabled for the kernel timer: Microchip's 32 KHz RTOT timer or Cortex-M4 SYSTICK. The soc kconfig rules are loading all mec subdirectories for every build causing warnings when building new socs with this change. We made the changes for all the mec chips. Signed-off-by: Scott Worley --- soc/microchip/mec/mec15xx/Kconfig | 3 --- .../mec/mec15xx/Kconfig.defconfig.series | 16 +++++++++++----- soc/microchip/mec/mec172x/Kconfig | 3 --- .../mec/mec172x/Kconfig.defconfig.series | 16 +++++++++++----- soc/microchip/mec/mec174x/Kconfig | 3 --- .../mec/mec174x/Kconfig.defconfig.series | 11 ++++++++++- soc/microchip/mec/mec175x/Kconfig | 3 --- .../mec/mec175x/Kconfig.defconfig.series | 11 ++++++++++- soc/microchip/mec/mech172x/Kconfig | 3 --- .../mec/mech172x/Kconfig.defconfig.series | 11 ++++++++++- 10 files changed, 52 insertions(+), 28 deletions(-) diff --git a/soc/microchip/mec/mec15xx/Kconfig b/soc/microchip/mec/mec15xx/Kconfig index 510fbd898ea..9a22e03cdc1 100644 --- a/soc/microchip/mec/mec15xx/Kconfig +++ b/soc/microchip/mec/mec15xx/Kconfig @@ -16,9 +16,6 @@ config SOC_MEC1501_HSZ if SOC_SERIES_MEC15XX -config RTOS_TIMER - bool "MEC1501 RTOS timer" - config SOC_MEC1501_PROC_CLK_DIV int "PROC_CLK_DIV" default 1 diff --git a/soc/microchip/mec/mec15xx/Kconfig.defconfig.series b/soc/microchip/mec/mec15xx/Kconfig.defconfig.series index d12e7023128..ba99d185091 100644 --- a/soc/microchip/mec/mec15xx/Kconfig.defconfig.series +++ b/soc/microchip/mec/mec15xx/Kconfig.defconfig.series @@ -13,7 +13,16 @@ config NUM_IRQS rsource "Kconfig.defconfig.mec1501*" -if RTOS_TIMER +config CORTEX_M_SYSTICK + depends on !MCHP_XEC_RTOS_TIMER + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK + default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) if MCHP_XEC_RTOS_TIMER + +if MCHP_XEC_RTOS_TIMER +config SYS_CLOCK_TICKS_PER_SEC + default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) config SOC_HAS_TIMING_FUNCTIONS default y if !CORTEX_M_DWT @@ -21,9 +30,6 @@ config SOC_HAS_TIMING_FUNCTIONS config ARCH_HAS_CUSTOM_BUSY_WAIT default y -endif # RTOS_TIMER - -config CORTEX_M_SYSTICK - depends on !RTOS_TIMER +endif # MCHP_XEC_RTOS_TIMER endif # SOC_SERIES_MEC15XX diff --git a/soc/microchip/mec/mec172x/Kconfig b/soc/microchip/mec/mec172x/Kconfig index 85f579ec776..2a7589be700 100644 --- a/soc/microchip/mec/mec172x/Kconfig +++ b/soc/microchip/mec/mec172x/Kconfig @@ -15,9 +15,6 @@ config SOC_SERIES_MEC172X if SOC_SERIES_MEC172X -config RTOS_TIMER - bool "MEC172x RTOS Timer(32KHz) as kernel timer" - choice prompt "MEC172x debug interface general configuration" default SOC_MEC172X_DEBUG_WITHOUT_TRACING diff --git a/soc/microchip/mec/mec172x/Kconfig.defconfig.series b/soc/microchip/mec/mec172x/Kconfig.defconfig.series index 016d13b6818..b64aeb2e022 100644 --- a/soc/microchip/mec/mec172x/Kconfig.defconfig.series +++ b/soc/microchip/mec/mec172x/Kconfig.defconfig.series @@ -13,7 +13,16 @@ config NUM_IRQS rsource "Kconfig.defconfig.mec172x*" -if RTOS_TIMER +config CORTEX_M_SYSTICK + depends on !MCHP_XEC_RTOS_TIMER + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK + default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) if MCHP_XEC_RTOS_TIMER + +if MCHP_XEC_RTOS_TIMER +config SYS_CLOCK_TICKS_PER_SEC + default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) config SOC_HAS_TIMING_FUNCTIONS default y if !CORTEX_M_DWT @@ -21,10 +30,7 @@ config SOC_HAS_TIMING_FUNCTIONS config ARCH_HAS_CUSTOM_BUSY_WAIT default y -endif # RTOS_TIMER - -config CORTEX_M_SYSTICK - depends on !RTOS_TIMER +endif # MCHP_XEC_RTOS_TIMER config PS2_XEC default y diff --git a/soc/microchip/mec/mec174x/Kconfig b/soc/microchip/mec/mec174x/Kconfig index 037a0e5989e..bdee97015bc 100644 --- a/soc/microchip/mec/mec174x/Kconfig +++ b/soc/microchip/mec/mec174x/Kconfig @@ -15,7 +15,4 @@ config SOC_SERIES_MEC174X if SOC_SERIES_MEC174X -config RTOS_TIMER - bool "MEC174x RTOS Timer(32KHz) as kernel timer" - endif # SOC_SERIES_MEC174X diff --git a/soc/microchip/mec/mec174x/Kconfig.defconfig.series b/soc/microchip/mec/mec174x/Kconfig.defconfig.series index f434af93409..2b750776fe9 100644 --- a/soc/microchip/mec/mec174x/Kconfig.defconfig.series +++ b/soc/microchip/mec/mec174x/Kconfig.defconfig.series @@ -12,6 +12,15 @@ config NUM_IRQS default 194 config CORTEX_M_SYSTICK - depends on !RTOS_TIMER + depends on !MCHP_MEC5_KTIMER + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK + default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) if MCHP_MEC5_KTIMER + +if MCHP_MEC5_KTIMER +config SYS_CLOCK_TICKS_PER_SEC + default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) +endif # MCHP_MEC5_KTIMER endif # SOC_SERIES_MEC174X diff --git a/soc/microchip/mec/mec175x/Kconfig b/soc/microchip/mec/mec175x/Kconfig index 80278e8513c..e2136d7a2df 100644 --- a/soc/microchip/mec/mec175x/Kconfig +++ b/soc/microchip/mec/mec175x/Kconfig @@ -15,7 +15,4 @@ config SOC_SERIES_MEC175X if SOC_SERIES_MEC175X -config RTOS_TIMER - bool "MEC175x RTOS Timer(32KHz) as kernel timer" - endif # SOC_SERIES_MEC175X diff --git a/soc/microchip/mec/mec175x/Kconfig.defconfig.series b/soc/microchip/mec/mec175x/Kconfig.defconfig.series index 01abcebfe87..e32cacf68cd 100644 --- a/soc/microchip/mec/mec175x/Kconfig.defconfig.series +++ b/soc/microchip/mec/mec175x/Kconfig.defconfig.series @@ -12,6 +12,15 @@ config NUM_IRQS default 198 config CORTEX_M_SYSTICK - depends on !RTOS_TIMER + depends on !MCHP_MEC5_KTIMER + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK + default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) if MCHP_MEC5_KTIMER + +if MCHP_MEC5_KTIMER +config SYS_CLOCK_TICKS_PER_SEC + default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) +endif # MCHP_MEC5_KTIMER endif # SOC_SERIES_MEC175X diff --git a/soc/microchip/mec/mech172x/Kconfig b/soc/microchip/mec/mech172x/Kconfig index 3ab0dec2c7d..7154644bf1f 100644 --- a/soc/microchip/mec/mech172x/Kconfig +++ b/soc/microchip/mec/mech172x/Kconfig @@ -15,7 +15,4 @@ config SOC_SERIES_MECH172X if SOC_SERIES_MECH172X -config RTOS_TIMER - bool "MECH172x RTOS Timer(32KHz) as kernel timer" - endif # SOC_SERIES_MECH172X diff --git a/soc/microchip/mec/mech172x/Kconfig.defconfig.series b/soc/microchip/mec/mech172x/Kconfig.defconfig.series index cec629c0e47..ddb1a4a2850 100644 --- a/soc/microchip/mec/mech172x/Kconfig.defconfig.series +++ b/soc/microchip/mec/mech172x/Kconfig.defconfig.series @@ -12,6 +12,15 @@ config NUM_IRQS default 181 config CORTEX_M_SYSTICK - depends on !RTOS_TIMER + depends on !MCHP_MEC5_KTIMER + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK + default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) if MCHP_MEC5_KTIMER + +if MCHP_MEC5_KTIMER +config SYS_CLOCK_TICKS_PER_SEC + default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) +endif # MCHP_MEC5_KTIMER endif # SOC_SERIES_MECH172X