Skip to content

Commit 4d1139d

Browse files
scottwcpgkartben
authored andcommitted
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>
1 parent ab071da commit 4d1139d

File tree

10 files changed

+52
-28
lines changed

10 files changed

+52
-28
lines changed

soc/microchip/mec/mec15xx/Kconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ config SOC_MEC1501_HSZ
1616

1717
if SOC_SERIES_MEC15XX
1818

19-
config RTOS_TIMER
20-
bool "MEC1501 RTOS timer"
21-
2219
config SOC_MEC1501_PROC_CLK_DIV
2320
int "PROC_CLK_DIV"
2421
default 1

soc/microchip/mec/mec15xx/Kconfig.defconfig.series

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,23 @@ config NUM_IRQS
1313

1414
rsource "Kconfig.defconfig.mec1501*"
1515

16-
if RTOS_TIMER
16+
config CORTEX_M_SYSTICK
17+
depends on !MCHP_XEC_RTOS_TIMER
18+
19+
config SYS_CLOCK_HW_CYCLES_PER_SEC
20+
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK
21+
default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) if MCHP_XEC_RTOS_TIMER
22+
23+
if MCHP_XEC_RTOS_TIMER
24+
config SYS_CLOCK_TICKS_PER_SEC
25+
default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency)
1726

1827
config SOC_HAS_TIMING_FUNCTIONS
1928
default y if !CORTEX_M_DWT
2029

2130
config ARCH_HAS_CUSTOM_BUSY_WAIT
2231
default y
2332

24-
endif # RTOS_TIMER
25-
26-
config CORTEX_M_SYSTICK
27-
depends on !RTOS_TIMER
33+
endif # MCHP_XEC_RTOS_TIMER
2834

2935
endif # SOC_SERIES_MEC15XX

soc/microchip/mec/mec172x/Kconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ config SOC_SERIES_MEC172X
1515

1616
if SOC_SERIES_MEC172X
1717

18-
config RTOS_TIMER
19-
bool "MEC172x RTOS Timer(32KHz) as kernel timer"
20-
2118
choice
2219
prompt "MEC172x debug interface general configuration"
2320
default SOC_MEC172X_DEBUG_WITHOUT_TRACING

soc/microchip/mec/mec172x/Kconfig.defconfig.series

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,24 @@ config NUM_IRQS
1313

1414
rsource "Kconfig.defconfig.mec172x*"
1515

16-
if RTOS_TIMER
16+
config CORTEX_M_SYSTICK
17+
depends on !MCHP_XEC_RTOS_TIMER
18+
19+
config SYS_CLOCK_HW_CYCLES_PER_SEC
20+
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK
21+
default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) if MCHP_XEC_RTOS_TIMER
22+
23+
if MCHP_XEC_RTOS_TIMER
24+
config SYS_CLOCK_TICKS_PER_SEC
25+
default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency)
1726

1827
config SOC_HAS_TIMING_FUNCTIONS
1928
default y if !CORTEX_M_DWT
2029

2130
config ARCH_HAS_CUSTOM_BUSY_WAIT
2231
default y
2332

24-
endif # RTOS_TIMER
25-
26-
config CORTEX_M_SYSTICK
27-
depends on !RTOS_TIMER
33+
endif # MCHP_XEC_RTOS_TIMER
2834

2935
config PS2_XEC
3036
default y

soc/microchip/mec/mec174x/Kconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,4 @@ config SOC_SERIES_MEC174X
1515

1616
if SOC_SERIES_MEC174X
1717

18-
config RTOS_TIMER
19-
bool "MEC174x RTOS Timer(32KHz) as kernel timer"
20-
2118
endif # SOC_SERIES_MEC174X

soc/microchip/mec/mec174x/Kconfig.defconfig.series

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ config NUM_IRQS
1212
default 194
1313

1414
config CORTEX_M_SYSTICK
15-
depends on !RTOS_TIMER
15+
depends on !MCHP_MEC5_KTIMER
16+
17+
config SYS_CLOCK_HW_CYCLES_PER_SEC
18+
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK
19+
default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) if MCHP_MEC5_KTIMER
20+
21+
if MCHP_MEC5_KTIMER
22+
config SYS_CLOCK_TICKS_PER_SEC
23+
default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency)
24+
endif # MCHP_MEC5_KTIMER
1625

1726
endif # SOC_SERIES_MEC174X

soc/microchip/mec/mec175x/Kconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,4 @@ config SOC_SERIES_MEC175X
1515

1616
if SOC_SERIES_MEC175X
1717

18-
config RTOS_TIMER
19-
bool "MEC175x RTOS Timer(32KHz) as kernel timer"
20-
2118
endif # SOC_SERIES_MEC175X

soc/microchip/mec/mec175x/Kconfig.defconfig.series

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ config NUM_IRQS
1212
default 198
1313

1414
config CORTEX_M_SYSTICK
15-
depends on !RTOS_TIMER
15+
depends on !MCHP_MEC5_KTIMER
16+
17+
config SYS_CLOCK_HW_CYCLES_PER_SEC
18+
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK
19+
default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) if MCHP_MEC5_KTIMER
20+
21+
if MCHP_MEC5_KTIMER
22+
config SYS_CLOCK_TICKS_PER_SEC
23+
default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency)
24+
endif # MCHP_MEC5_KTIMER
1625

1726
endif # SOC_SERIES_MEC175X

soc/microchip/mec/mech172x/Kconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,4 @@ config SOC_SERIES_MECH172X
1515

1616
if SOC_SERIES_MECH172X
1717

18-
config RTOS_TIMER
19-
bool "MECH172x RTOS Timer(32KHz) as kernel timer"
20-
2118
endif # SOC_SERIES_MECH172X

soc/microchip/mec/mech172x/Kconfig.defconfig.series

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ config NUM_IRQS
1212
default 181
1313

1414
config CORTEX_M_SYSTICK
15-
depends on !RTOS_TIMER
15+
depends on !MCHP_MEC5_KTIMER
16+
17+
config SYS_CLOCK_HW_CYCLES_PER_SEC
18+
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK
19+
default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency) if MCHP_MEC5_KTIMER
20+
21+
if MCHP_MEC5_KTIMER
22+
config SYS_CLOCK_TICKS_PER_SEC
23+
default $(dt_node_int_prop_int,/soc/timer@40007400,clock-frequency)
24+
endif # MCHP_MEC5_KTIMER
1625

1726
endif # SOC_SERIES_MECH172X

0 commit comments

Comments
 (0)