Commit graph

967 commits

Author SHA1 Message Date
Hao Luo
6f4b92d64d soc: ambiq: Optimize the inclusion relationship of header files
Optimized the inclusion relationship of header files

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-04-17 09:06:18 +02:00
Tim Lin
a531e71376 drivers/timer: Add timer driver of it51xxx
Add timer driver for ITE it51xxx series.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2025-04-08 10:48:26 +02:00
Khanh Nguyen
7ae800a0c9 drivers: timer: Add ULPT timer for power management on Renesas RA MCUs
drivers:
- Added ULPT timer driver in `renesas_ra_ulpt_timer.c`.
- Updated `clock_control_renesas_ra_cgc.c` for ULPT clock settings.
- Updated `uart_renesas_ra8_sci_b.c` for power management support.
- Updated `CMakeLists.txt` and `Kconfig` to integrate ULPT timer.
- Added `Kconfig.renesas_ra_ulpt` for ULPT-specific configurations.

dts bindings:
- Added `renesas,ra-ulpt.yaml` for ULPT node bindings.
- Added `renesas,ra-ulpt-timer.yaml` for ULPT timer bindings.

modules:
- Updated `Kconfig.renesas_fsp` to support ULPT and LPM.

Signed-off-by: Khanh Nguyen <khanh.nguyen.wz@bp.renesas.com>
2025-04-03 08:41:08 +02:00
S Mohamed Fiaz
701be0c331 driver: sleeptimer: siwx917: Add siwx91x Sleeptimer driver
This commit enables the Sleeptimer driver support for the siwx917 device.

Signed-off-by: S Mohamed Fiaz <fiaz.mohamed@silabs.com>
2025-04-03 06:24:54 +02:00
Raffael Rostagno
4b8dc5f3ff drivers: esp32: Update for shared intc
Drivers update to use shared interrupt allocator for Xtensa
and RISCV devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-04-02 19:02:27 +02:00
Adam Kondraciuk
042c5c6252 drivers: timer: nrf_grtc_timer: Move up GRTC clock selection
Selection of the LF clock source for the GRTC should be performed
as early as possible, before starting GRTC.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2025-04-01 11:52:26 +02:00
Krzysztof Chruściński
40ab30f23f drivers: timer: nrf_grtc_timer: Optimize z_nrf_grtc_timer_get_ticks
Converting absolute system ticks to GRTC ticks is simple and algorithm
can be simplified. Legacy algorithm was copied from nrf_rtc_timer which
back then was working on 32 bits only.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-03-31 14:31:48 +02:00
Titan Chen
10f7218df4 drivers: timer: rts5912: Fix RTMR accurate issue.
Fix RTMR_ADJUST_LIMIT and RTMR_ADJUST_CYCLES

Signed-off-by: Titan Chen <titan.chen@realtek.com>
2025-03-28 21:51:08 +01:00
Anisetti Avinash Krishna
139211772c include: zephyr: sys: time_units: Make z_clock_hw_cycles_per_sec unsigned
Convert z_clock_hw_cycles_per_sec to unsigned int to increase
supported frequency range.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2025-03-28 12:21:07 +01:00
Lucas Tamborrino
c6f84d0ba2 boards: espressif: esp32c6: Add LP Core board support
Add ULP Coprocessor board support for C6.
This requires a change in the board qualifier depending on the build
target.
Update esp32c6 overlay and configuration files to the proper name.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2025-03-21 17:05:20 +01:00
Declan Snyder
b990f96feb dts: counter: Remove old kinetis lptmr binding
Remove deprecated nxp,kinetis-lptmr compatible string
which is superseded by nxp,lptmr compatible due to
removing family specific name.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-03-20 17:14:28 +01:00
Declan Snyder
f013e20bc5 soc: nxp: Add missing resolve of system timer cfg
These socs were missing a config line to disable SYSTICK if the LPTMR is
configured for the system timer, similar to how other SOCs do this for
alternative system timers than systick.

This fixes build errors in the case where that lptmr kconfig is enabled.

Also, the LPTMR kconfig should be default no because it is a secondary
option for the system timer, being lower resolution than systick. This
also resolves build errors.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-03-20 17:14:28 +01:00
Aksel Skauge Mellbye
7dc6fb442f drivers: timer: silabs: Fix calculation of next tick
In the case where more than a full tick was unannounced when
sys_clock_set_timeout() was called, the timer driver would
subtract it from the next timeout. However, this is already
done by the caller through the elapsed() function in timeout.c,
leading to the timer interrupt firing too early.

With this fix, SYS_CLOCK_TICKS_PER_SEC can be increased to the
full speed of the low frequency timer. The underlying sleeptimer
API must be called with a timeout of at least 1, and will if needed
increase the value to the minimum value required by the hardware.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-03-18 16:42:42 +01:00
Peter Mitsis
701aab92e2 kernel: Add Z_IS_TIMEOUT_RELATIVE() macro
Introduces the Z_IS_TIMEOUT_RELATIVE() macro to help ensure that
checking for relative/absolute timeouts is consistent. Using this
macro also helps ensure that we get the correct behavior when using
32-bit timeouts (CONFIG_TIMEOUT_64BIT=n).

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-03-17 02:21:02 +01:00
Camille BAUD
55a3e606bb drivers: timer: Enable CH32V00x timer driver for CH32V20x/30x
This enables CH32V20x/30x to use the driver

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-03-14 14:39:30 +01:00
Emanuele Di Santo
cdc2f2a52c drivers: timer: nrf_rtc_timer: do not start LFCLK unless CLOCK_CONTROL
Do not start the LF clock unless CONFIG_CLOCK_CONTROL_NRF is enabled.
This is similar to how it's done in Nordic's GRTC driver.

Authored-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2025-03-12 19:02:55 +01:00
Alberto Escolar Piedras
b617418532 drivers/timer/native_sim_timer: Correct comments
Correct the introduction comment, removing the native_posix mention,
and something which did not apply for several years.
Also remove an unnecessary include.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-11 18:54:49 +01:00
Alberto Escolar Piedras
ba64291088 drivers timer: Rename native_posix_timer native_sim_timer
Including renaming the kconfig option
NATIVE_POSIX_TIMER into NATIVE_SIM_TIMER deprecating the first one.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-11 18:54:49 +01:00
Alberto Escolar Piedras
8c8db7dd64 drivers/timer/native_posix_timer: Support only native_sim
Now that native_posix has been removed, this driver only needs to
support native_sim. Let's stop using the transitional headers which
supported both.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-08 08:46:34 +01:00
Mathieu Choplain
5ef21f3af2 drivers: timer: cortex_m_systick: support SysTick reset in low-power mode
Modify the Cortex-M SysTick driver to work when the SoC resets SysTick
in low-power mode. This adds an invisible Kconfig symbol that must be
selected by SoCs with such behavior.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2025-03-07 19:46:34 +01:00
Mathieu Choplain
006d6e5cb7 drivers: timer: cortex_m_systick: add hook-based LPM timer support
Add support for a hook-based low-power mode timer to the Cortex-M SysTick
driver, in addition to the existing Counter API-based timer. This is useful
on platforms such as the STM32WB0 where the wake-up timer is too limited
for a Counter API driver to be implemented on top of it.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2025-03-07 19:46:34 +01:00
Mathieu Choplain
677e6275fa drivers: timer: cortex_m_systick: make idle timer a Kconfig choice
The Cortex-M SysTick supported collaboration with a so-called "IDLE timer"
to work even in low-power modes, when the SoC may disable its clock.

Rename "IDLE timer" to "low-power mode timer" to better reflect what this
timer is used for, and transform the single option into a Kconfig choice
to allow other behaviors to be implemented and chosen.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2025-03-07 19:46:34 +01:00
Jan Kowalewski
a9c59d6c85 drivers: timer: sam0: fix MCLK pointer and mask in init function
Init function uses undefined cfg variable causing compilation error.

Signed-off-by: Jan Kowalewski <jkowalewski@cthings.co>
2025-02-28 14:54:59 +01:00
Benjamin Cabé
c3bda347b2 drivers: fix spelling of "swiched"
s/swiched/switched/

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-02-21 11:41:46 +00:00
Adam Kondraciuk
a58588e49d drivers: timer: nrf_grtc: Add support for clock outputs
Add support for GRTC clock output pins.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2025-02-18 18:37:35 +01:00
Abe Kohandel
bc236f98ee drivers: timer: Add MMU awareness to TI DM Timer
Map the timer register space using DEVICE_MMIO_NAMED_MAP so if the MMU
is enabled, the register space is mapped correctly in the virtual
memory.

Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
2025-02-11 03:06:42 +01:00
Mahesh Mahadevan
b1df5f7e4f drivers: timer: Improve the accuracy of the MCUX OS Timer
1. The sys_clock_idle_exit function could be invoked multiple
   times. Hence add code so that is counter is stopped and the
   OS Timer is initialized once.
2. Reset the OS Timer when exiting low power modes where
   the OS Timer loses its state
3. Improve the cycles conversion algorithm. Round to the nearest
   microsecond when converting from ticks to microsecond rather
   than always rounding up to the next highest value.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2025-02-07 17:46:09 +01:00
Gerson Fernando Budke
fb6079999d dts: rtc: sam0: Add clock properties
Add properties to differentiate the timer counter operating modes. This
properties are necessary to spetialize the driver to be used as a normal
16/32-bit counter or to provide the clock/calendar functions.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2025-02-07 07:37:56 +01:00
Vebjorn Myklebust
10c35b8e70 drivers: timer: Add support for cc23x0 systim
Add support for systim to cc23x0 SoC.

Signed-off-by: Lars Thalian Morstad <l-morstad@ti.com>
Signed-off-by: Vebjorn Myklebust <v.myklebust@ti.com>
Signed-off-by: Stoyan Bogdanov <sbogdanov@baylibre.com>
Signed-off-by: Julien Panis <jpanis@baylibre.com>
2025-02-04 11:56:05 +01:00
Jamie McCrae
560db8509a drivers: kconfig: Fix bleeding options
Fixes a multitude of Kconfigs that wrongly appear on devices
where support is literally impossible

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-01-31 11:50:12 +01:00
Camille BAUD
14fa2873b5 drivers: timer: run clang-format on RISC-V machine timer file
Clang-Format changes whitespacing and longer lines are now allowed

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-01-22 05:39:59 +01:00
Camille BAUD
f11f68eade drivers: timer: Harmonize mtime-based RISC-V timers
This commit replaces a bunch of ifdefs and bindings with a single
extensible binding, and makes all standard mtime system timers consistent.

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-01-22 05:39:59 +01:00
Camille BAUD
bf45c496bb drivers: timer: Remove unused divider setter in RISC-V machine timer
This removes a unused function for a unused binding,
and is prelude to a refactoring

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-01-22 05:39:59 +01:00
Ioannis Damigos
b612044a93 smartbond_timer: If PM is set, take into account watchdog for timeout ticks
If PM is enabled, adjust timeout ticks according to watchdog expiration.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2025-01-15 15:04:29 +01:00
Ioannis Damigos
6b9eaa9f47 smartbond_timer: Use hw clock frequency for watchdog expire ticks
Use hardware clock frequency to calculate watchdog expire ticks
instead of kernel's "ticks".

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2025-01-15 15:04:29 +01:00
Gerson Fernando Budke
ea7922195b clocks: atmel: sam0: Fix gclk and mclk clock bindings
The Atmel SAM0 SoC enable peripherals clocks in distinct places: PM and
MCLK. The old devices had defined the peripheral clock enable bit at PM.
On the newer devices this was extracted on a dedicated memory section
called Master Clock (MCLK). This change excludes the dedicated bindings
in favor of a generic approach that cover all cases.

Now the clocks properties is complemented by the atmel,assigned-clocks
property. It gives the liberty to user to customize the clock source
from a generic clock or configure the direct connections.

All peripherals drivers were reworked with the newer solution.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2025-01-14 20:49:03 +01:00
WenBin Zhang
ab0915630e tracing: Add systick tracing
Add the missing SysTick tracing.

Signed-off-by: WenBin Zhang <freey7955@gmail.com>
2025-01-14 00:01:09 +01:00
Lin Yu-Cheng
cfb2074a5e driver: timer: Add timer driver initial version of RTS5912.
Add timer driver for Realtek RTS5912.

Signed-off-by: Lin Yu-Cheng <lin_yu_cheng@realtek.com>
2025-01-10 11:58:02 +01:00
Ruibin Chang
4ce0ff5ef4 drivers/timer/it8xxx2: fix busy wait timer race condition
Command "waitms 50" on ChromeBook EC console, then it will crash EC.

Because arch_busy_wait() is re-entried by two different tasks,
the second calling will reset the timer and may cause the first
calling to fail to reach the waiting destination
(if the first calling's wait time is longer enough).

Verified by follow test pattern:
west build -p auto -b it8xxx2_evb tests/kernel/timer/timer_api
west build -p auto -b it8xxx2_evb tests/kernel/timer/timer_error_case
west build -p auto -b it8xxx2_evb tests/kernel/timer/timer_monotonic
west build -p auto -b it8xxx2_evb tests/kernel/timer/starve
west build -p auto -b it8xxx2_evb tests/kernel/context

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2024-12-25 08:40:53 +01:00
Hao Luo
b56aa0e823 drivers: timer: separate ambiq stimer comparator interrupts
Separate ambiq stimer comparator interrupts to handle the errata

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-12-20 08:33:22 +01:00
Richard Wheatley
745444ea25 drivers: timer: ambiq stimer errata updates
apx needs to set compare b due to errata of XTAL glitch
ap4p needs to set minimum delta to 4
err026 requires XTAL to not be switched off/on when resetting

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
2024-12-20 08:33:22 +01:00
Jun Lin
2bda7b87ee driver: timer: npcx: bypass timer counter reading issue
Originally, when the timer's source clock is 32.768 kHz, the timer driver
uses two consecutive reads to ensure the timer reading is correct.
However, it is not robust enough due to an asynchronous timing issue in
the chip. The workaround is to add at least two NOPs between the
LDR and CMP instructions. This commit implements the workaround in the
assembly code to ensure it is not affected by the compiler toolchain
or optimization flags.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-12-16 15:55:16 +01:00
Jun Lin
bdf0500497 driver: timer: npcx: fix possible vulnerabilities
This commit fixes some potential leakage in the timer driver.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-12-16 15:55:16 +01:00
Jyri Sarha
ff5a4581b2 drivers: timer: Export sys_clock_cycle_get_64() implementations
Export sys_clock_cycle_get_64() implementations to enable k_cycle_get_64()
calls from llext libraries.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
2024-12-06 12:14:19 +01:00
Hao Luo
5d4353dc9a drivers: timer: ambiq: add clock source selection for stimer
Add clock source selection for stimer and make it configurable

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-12-03 04:01:45 +01:00
Andy Ross
fe5c11db05 boards/mediatek: Add mt8196_adsp
Add Zephyr support for the Audio DSP on the MT8196 SOC.  This is a
very similar device to previous designs.  Most of this patch is just
DTS.

The biggest delta is the more complicated second level interrupt
controller, though it is still able to be represented using some
vaguely clever DTS config over the older intc_mtk_adsp driver.

Also the memory layout is slightly different, requiring a little
indirection to set the initial boot stack address and log output
buffer.  And the timer "irq_ack" register bits moved.

Signed-off-by: Andy Ross <andyross@google.com>
2024-11-28 20:51:50 +01:00
Adam Kondraciuk
2e4cf197c1 drivers: timer: grtc: Add LFPRC as the source of GRTC
This commit allows to switch the GRTC clock source to an RC oscillator.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2024-11-27 21:06:20 +00:00
Abe Kohandel
5d5407ee7a drivers: timer: Disable prescalar for TI DM Timer
The timer count calculations are done with the assumption that the
prescalar is disabled. When using u-boot's SPL as an early boot stage,
the omap timer driver enables the prescalar leaving this driver to
calculate incorrect counts. So explicitly disable the prescalar to match
the driver expectation.

Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
2024-11-27 10:39:21 -05:00
Johan Hedberg
19a6ffd403 drivers: timer: gecko_burtc: Remove unused include
This driver doesn't use any pinctrl APIs, so remove the include.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-11-26 15:42:02 -05:00
7e810abc05 drivers: add the ch32v00x systick driver
This commit adds the systick driver for WCH CH32V003.

Signed-off-by: Michael Hope <michaelh@juju.nz>
Signed-off-by: Dhiru Kholia <dhiru.kholia@gmail.com>
2024-11-26 14:41:46 +00:00