From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: wbg@kernel.org, robh@kernel.org, conor+dt@kernel.org, krzk+dt@kernel.org
Cc: s32@nxp.com, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Subject: [PATCH v3 0/3] Add the System Timer Module counter
Date: Wed, 17 Dec 2025 08:49:54 +0100 [thread overview]
Message-ID: <20251217075000.2592966-1-daniel.lezcano@linaro.org> (raw)
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.
Changelog:
* v3
- Fixed compatible typo "nxp,s32g2-stm" to "nxp,s32g2-stm-cnt"
* v2
- Added Rob's tag
** kbuild
- Reordered alphabetically the headers
- Added bitfield.h header
- Use DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
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 | 386 ++++++++++++++++++
4 files changed, 472 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
next reply other threads:[~2025-12-17 7:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-17 7:49 Daniel Lezcano [this message]
2025-12-17 7:49 ` [PATCH v3 1/3] counters: Reorder the Makefile Daniel Lezcano
2025-12-17 7:49 ` [PATCH v3 2/3] dt-bindings: counter: Add NXP System Timer Module Counter Daniel Lezcano
2025-12-17 7:49 ` [PATCH v3 3/3] counter: Add STM based counter Daniel Lezcano
2025-12-28 6:52 ` William Breathitt Gray
2025-12-28 17:37 ` Daniel Lezcano
2025-12-29 13:50 ` William Breathitt Gray
2025-12-24 10:31 ` [PATCH v3 0/3] Add the System Timer Module counter Daniel Lezcano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251217075000.2592966-1-daniel.lezcano@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=s32@nxp.com \
--cc=wbg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®