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 <scott.worley@microchip.com>
This commit is contained in:
Scott Worley 2025-04-04 11:29:26 -04:00 committed by Benjamin Cabé
commit 4d1139de91
10 changed files with 52 additions and 28 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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