driver: timer: Support for RX system timer

This commit add a system timer driver for Renesas RX using the
CMT peripheral. The driver supports both system ticks and
high-resolution cycle counting
- Configures CMT0 as the system tick timer
- Configures CMT1 as a free-running cycle timer for precise
  time tracking
- Handles timer overflows to maintain a continuous cycle count.
- Implements sys_clock_cycle_get_32() and sys_clock_cycle_get_64()
  for  high-resolution timing
- Supports Zephyr tickless kernel mode by tracking elapsed cycles
- Enables interrupt-based tick announcement using CMT0

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
Signed-off-by: Yuichi Nakada <yuichi.nakada.sx@renesas.com>
This commit is contained in:
Duy Nguyen 2025-02-26 11:04:26 +07:00 committed by Benjamin Cabé
commit ad42e4d87d
9 changed files with 332 additions and 7 deletions

View file

@ -3,6 +3,17 @@
if SOC_SERIES_RX130
DT_CMT_PATH := $(dt_nodelabel_path,cmt)
config SYS_CLOCK_HW_CYCLES_PER_SEC
default $(dt_node_int_prop_int,$(DT_CMT_PATH),clock-frequency)
# SYS_CLOCK_TICKS_PER_SEC is set to 100 if PCLKB is 48MHz or less.
# (PCLKB = SYS_CLOCK_HW_CYCLES_PER_SEC * 8)
config SYS_CLOCK_TICKS_PER_SEC
default 100 if SYS_CLOCK_HW_CYCLES_PER_SEC <= 6000000
default 1000
config INITIALIZATION_STACK_SIZE
default 512

View file

@ -3,6 +3,17 @@
if SOC_SERIES_RX62N
DT_CMT_PATH := $(dt_nodelabel_path,cmt)
config SYS_CLOCK_HW_CYCLES_PER_SEC
default $(dt_node_int_prop_int,$(DT_CMT_PATH),clock-frequency)
# SYS_CLOCK_TICKS_PER_SEC is set to 100 if PCLKB is 48MHz or less.
# (PCLKB = SYS_CLOCK_HW_CYCLES_PER_SEC * 8)
config SYS_CLOCK_TICKS_PER_SEC
default 100 if SYS_CLOCK_HW_CYCLES_PER_SEC <= 6000000
default 10000
config INITIALIZATION_STACK_SIZE
default 512