Commit graph

940 commits

Author SHA1 Message Date
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
Sven Ginka
fe4215462d soc: sensry: udma, pad renaming
Before that fix the names for UDMA could be misleading.
With that fix the namespace is clear and easy to follow.
Same applies for peripheral addresses and pad config.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2024-11-16 15:06:43 -05:00
Francois Ramu
27bb4961b3 drivers: stm32 lptim driver with a exact LPTIM timeout value
With this change, the LPTIM counter will be able to set
its timeout to the st,timeout value. So that system can
sleep for that period without interruption.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-11-16 15:05:26 -05:00
Gerson Fernando Budke
0cc8f93e8a soc: atmel: Drop PINCTRL from Kconfig.defconfig
This Kconfig has wrongly been added to defconfig files. It is not the
right place for it. It has never been the right place for it. Drivers
that need it should select the symbol in their Kconfig entries. Drop
PINCTL from Kconfig.defconfig and add proper select at Kconfig.sam*.

Fixes #78619

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2024-11-04 13:43:26 -06:00
Aksel Skauge Mellbye
da6ddc92cd drivers: timer: silabs: Add sleeptimer timer driver
Add OS timer implementation making use of the Sleeptimer HAL.
Sleeptimer integrates tightly with the Silabs Power Manager HAL,
and must be used as the OS timer to achieve optimal power consumption
when using the radio.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2024-10-24 17:51:01 +02:00
Scott Worley
62d7db4d4d drivers: timer: mec5: Driver using Microchip RTOS timer as kernel tick
Timer driver using Microchip 32KHz based RTOS timer as the kernel
timer tick. The driver uses one of the 32-bit basic timers to
support the kernel's k_busy_wait API which is passed a wait
count in 1 us units. The 32-bit basic timer is selected by using
device tree chosen rtimer-busy-wait-timer set to the handle
of the desired 32-bit basic timer. If this driver is disabled,
the build system will select the ARM Cortex-M4 SysTick as the
kernel timer tick driver. The user should specify RTOS timer
as kernel tick by adding the compatible properity and setting
the status property to "okay" at the board or application level
device tree. The driver implements two internal API's for use
by the SoC PM. These two API's allow the SoC PM layer to disable
the timer used for k_busy_wait so the PLL can be disabled in
deep sleep. We used a custom API so we can disable this timer
in the deep sleep path when we know k_busy_wait will not be
called by other drivers or applications.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2024-10-22 20:41:32 +02:00
Aksel Skauge Mellbye
cfccd11026 drivers: timer: gecko: Remove clock configuration
Clock setup is now done by the clock manager based
on device tree configuration.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2024-10-22 20:41:23 +02:00
Adam Kondraciuk
bc7a5b6781 drivers: timer: nrf_grtc_timer: Align Zephyr to new AUTOEN read manner
The new GRTC reading manner of the SYSCOUNTER uses hardware mechanism which
allows to keep it alive when any of CPUs is not sleeping. Otherwise
the SYSCOUNTER goes into sleep mode. Thus there is no
longer need to maintain the `CONFIG_NRF_GRTC_SLEEP_ALLOWED` symbol, however
if the user wants to have the SYSCOUNTER enabled all the time the
`CONFIG_NRF_GRTC_ALWAYS_ON` can be used instead.
The nrfx_grtc  driver no longer provides the `wakeup-read-sleep` reading
manner.
Also setting the GRTC clock source is performed by the nrfx_grtc driver so
it has been removed from the `sys_clock_driver_init()` function.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2024-10-07 18:42:14 +02:00
Yong Cong Sin
52a202309b zephyr: bulk update to DT_NODE_HAS_STATUS_OKAY
Change instances of:

DT_NODE_HAS_STATUS(<node_id>, okay)

to

DT_NODE_HAS_STATUS_OKAY(<node_id>)

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-10-03 17:06:52 +01:00
Alberto Escolar Piedras
517d51e33a drivers/timer native_posix: Allow without BOARD_NATIVE_POSIX
This driver works both with native_posix and native_sim.
native_sim will eventually not set NATIVE_SIM_NATIVE_POSIX_COMPAT
(i.e. not pretend to be native_posix) so let's correct the
dependencies.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-10-01 10:47:55 +01:00
Sven Ginka
686cbc90f6 driver: timer: Add support for sy1xx
Add sys timer driver for Sensry's RISCV32 based SY1xx.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2024-09-16 20:19:31 +02:00
Pisit Sawangvonganan
847a4eaad2 style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-11 07:40:35 -04:00
Adam Kondraciuk
bae4ff6cf0 drivers: timer: grtc: Switch GRTC clock source to LFXO
GRTC needs to use direct clock source path instead of system clock path
to support ELV mode for nRF54L targets.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2024-09-11 09:30:48 +02:00
Adam Kondraciuk
38575f89ea drivers: timer: nrf_grtc: Add GRTC fix for app and rad cores
Currently function `z_nrf_grtc_wakeup_prepare()` should be available
only for the GRTC manager (`CONFIG_NRF_GRTC_START_SYSCOUNTER` is active).

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2024-09-06 11:29:06 -04:00
Raffael Rostagno
90c6106926 drivers: esp32: Interrupts flags configuration
Allows configuring interrupts flags in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Raffael Rostagno
bb746cdcc5 drivers: esp32: esp_intr_alloc return condition
Add checks to return value of esp_intr_alloc to avoid drivers init
returning 0 when interrupt allocation fails.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Raffael Rostagno
0b3a34cdca drivers: esp32: Interrupts priority configuration
Allows configuring interrupts priority in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Pisit Sawangvonganan
1bcae0ea9f style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-20 10:33:51 +02:00
Raffael Rostagno
0db07994c6 drivers: timer: esp32c2: Add support
Add timer support to ESP32C2 and ESP8684

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-16 14:08:22 -04:00
Neil Chen
19d6217118 drivers: timer: remove fsl_power.h for MCXN236
remove fsl_power.h in os_timer driver for MCXN236

Signed-off-by: Neil Chen <cheng.chen_1@nxp.com>
2024-08-15 10:15:12 +01:00
Andrey VOLKOV
213da72d06 timer: cortex_m_systick: use direct interrupt handler instead of C-function
The current driver implements the global defined "systick" interrupt
callback "sys_clock_isr" as a standard C function with an argument.
However, ARM's direct interrupt handlers do not have any arguments;
they must be declared as "void handler(void)".

Additionally, the direct handler should include some missing special
header/footer.

Fixes: #75693

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
2024-08-14 15:57:15 -05:00
Andrey VOLKOV
59db014f43 timer: cortex_m_systick: minor refactoring
Replace useless "TICKLESS" define by
IS_ENABLED(CONFIG_TICKLESS_KERNEL) one, and replace error-prone
'cycle_t' pseudotype defs by real typedefs.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
2024-08-14 15:57:15 -05:00
Jordan Yates
07870934e3 everywhere: replace double words
Treewide search and replace on a range of double word combinations:
    * `the the`
    * `to to`
    * `if if`
    * `that that`
    * `on on`
    * `is is`
    * `from from`

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-22 05:40:22 -04:00
Adam Berlinger
19b39406eb soc: st: Add support for STOP3 on STM32U5
LPTIM is not available in STOP3 mode, so RTC needs to be used instead.
This code usese similar approach as STM32WBAx for suspend to ram.
The STOP3 is disabled by default in device tree.

Signed-off-by: Adam Berlinger <adam.berlinger@st.com>
2024-06-15 04:44:26 -04:00
Adam Berlinger
2c88cc08b3 drivers: timer: Fix timing in suspend-to-ram
Fix timing in suspend-to-ram when using STM32WBA.
Switch to use RTC timer should be done only when idle is set
and LPTIM clocks should be switched off

Signed-off-by: Adam Berlinger <adam.berlinger@st.com>
2024-06-15 04:44:26 -04:00
Lucas Tamborrino
a62423f391 drivers: Update to add support for esp32c6
Changes to bring support for esp32c6 SoC.
- clock control
- gpio
- pinctrl
- serial
- timer

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2024-06-14 18:51:46 -04:00
Sylvio Alves
f6fdfd4ee1 soc: esp32c3: add systimer clock disable option
When both MCUBoot and application run, systimer is initialized twice.
As a consequence, application freezes as systimer new initialization
conflicts with previous.

This PR adds the systimer clock disable function, that shall be called
before mcuboot jump to application, making sure it will
work as expected.

Fixes #74189

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-06-14 17:10:07 -04:00
David Leach
d45605e6a3 drivers: apic_tsc: revert add dependency of DYNAMIC_INTERRUPTS
PR #74127 introduced a dependency loop that appeared to not be caught
by CI.

Signed-off-by: David Leach <david.leach@nxp.com>
2024-06-13 23:54:29 -05:00