devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/3] Add the System Timer Module counter
@ 2025-12-08  3:04 Daniel Lezcano
  2025-12-08  3:04 ` [PATCH v1 1/3] counters: Reorder the Makefile Daniel Lezcano
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Daniel Lezcano @ 2025-12-08  3:04 UTC (permalink / raw)
  To: wbg, robh, conor+dt, krzk+dt; +Cc: s32, devicetree, linux-kernel, linux-iio

The NXP S32 family provides a System Timer Module (STM), a 32-bit
free-running counter clocked from a peripheral clock. The STM includes
a prescaler and one or more compare channels generating optional
interrupts. When used as a generic hardware counter, only the main
free-running counter is required, while the compare channels are
typically unused.

On S32G2 devices, the STM is exposed as a simple counter block that
can operate continuously and be shared across subsystems such as the
Linux kernel, firmware components running on Cortex-M7 cores, or other
co-processors. The counter can be read atomically and provides a
stable timestamp source to correlate events occurring in different
execution contexts.

The Linux kernel controls the STM through a memory-mapped interface,
configuring the prescaler, enabling or disabling the counter, and
accounting for wrap-arounds. Other subsystems access the counter in
read-only mode, making it a shared timestamp reference across the
platform.

This driver adds support for the STM when used as a counter on S32G2
platforms. The device is described in the device tree using the
following compatible:

compatible = "nxp,s32g2-stm-cnt";

The driver exposes basic counter functionality: start, stop, reset,
prescaler configuration, and overflow handling.

Daniel Lezcano (3):
  counters: Reorder the Makefile
  dt-bindings: counter: Add NXP System Timer Module Counter
  counter: Add STM based counter

 .../bindings/counter/nxp,s32g2-stm-cnt.yaml   |  64 +++
 drivers/counter/Kconfig                       |  10 +
 drivers/counter/Makefile                      |  21 +-
 drivers/counter/nxp-stm-cnt.c                 | 387 ++++++++++++++++++
 4 files changed, 473 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/counter/nxp,s32g2-stm-cnt.yaml
 create mode 100644 drivers/counter/nxp-stm-cnt.c

-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-12-09 21:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-08  3:04 [PATCH v1 0/3] Add the System Timer Module counter Daniel Lezcano
2025-12-08  3:04 ` [PATCH v1 1/3] counters: Reorder the Makefile Daniel Lezcano
2025-12-08  3:04 ` [PATCH v1 2/3] dt-bindings: counter: Add NXP System Timer Module Counter Daniel Lezcano
2025-12-09 21:27   ` Rob Herring (Arm)
2025-12-08  3:04 ` [PATCH v1 3/3] counter: Add STM based counter Daniel Lezcano
2025-12-08 20:25   ` kernel test robot
2025-12-08 21:29   ` kernel test robot
2025-12-08 23:45   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).