From: Philipp Zabel <p.zabel@pengutronix.de>
To: Troy Mitchell <troy.mitchell@linux.spacemit.com>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
Thomas Gleixner <tglx@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Yixun Lan <dlan@kernel.org>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-riscv@lists.infradead.org, spacemit@lists.linux.dev
Subject: Re: [PATCH v2 2/5] clocksource/drivers/spacemit: Add K1 timer support
Date: Tue, 17 Nov 2026 10:52:27 +0100 [thread overview]
Message-ID: <8b5be415e255b5387099d9f8a9b8f5f05d4cb038.camel@pengutronix.de> (raw)
In-Reply-To: <20261117-spacemit-soc-timer-v2-2-9264d0ea7755@linux.spacemit.com>
On Di, 2026-11-17 at 09:45 +0000, Troy Mitchell wrote:
> SpacemiT K1 and K3 have APB timers that can provide a shared clockevent
> alongside the per-CPU RISC-V timer. Use counter 0 and its first match
> comparator as a oneshot device available to the tick broadcast framework.
>
> Counter enable changes cross clock domains. Wait for the synchronized
> counter value to stop changing before reprogramming the match register,
> and check interrupt acknowledgment through the status register rather
> than reading the write-only clear register. Bound all synchronization
> waits and propagate programming failures to the clockevent core.
>
> Obtain the counter rate from the functional clock and protect it against
> rate changes. Keep the clocks enabled for the clockevent lifetime and
> restore counter configuration through the tick resume callback without
> sleeping clock operations. Use a platform driver so clock and reset
> providers can probe before the timer is registered.
>
> Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
> ---
> drivers/clocksource/Kconfig | 11 ++
> drivers/clocksource/Makefile | 1 +
> drivers/clocksource/timer-spacemit.c | 317 +++++++++++++++++++++++++++++++++++
> 3 files changed, 329 insertions(+)
>
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index da83483296d5..3e7dd5d628cd 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -163,6 +163,17 @@ config RZN1_TIMER
> - 2 32-bit timers
> Two timers blocks are available in RZ/N1 SoCs.
>
> +config SPACEMIT_TIMER
> + bool "SpacemiT K1/K3 timer"
> + depends on ARCH_SPACEMIT || COMPILE_TEST
> + depends on OF && COMMON_CLK && RESET_CONTROLLER && HAS_IOMEM
Drop the unnecessary RESET_CONTROLLER dependency, the reset controller
API has stubs for consumers.
regards
Philipp
next prev parent reply other threads:[~2026-11-17 9:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 9:45 [PATCH v2 0/5] Add SpacemiT K1/K3 SoC " Troy Mitchell
2026-11-17 9:45 ` [PATCH v2 1/5] dt-bindings: timer: Add SpacemiT K1 timer Troy Mitchell
2026-11-17 9:45 ` [PATCH v2 2/5] clocksource/drivers/spacemit: Add K1 timer support Troy Mitchell
2026-11-17 9:52 ` Philipp Zabel [this message]
2026-11-17 9:45 ` [PATCH v2 3/5] riscv: dts: spacemit: Add the K1 APB timer Troy Mitchell
2026-11-17 9:45 ` [PATCH v2 4/5] riscv: dts: spacemit: Add the K3 " Troy Mitchell
2026-11-17 9:45 ` [PATCH v2 5/5] MAINTAINERS: Add entry for SpacemiT timer Troy Mitchell
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=8b5be415e255b5387099d9f8a9b8f5f05d4cb038.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=daniel.lezcano@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlan@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=robh@kernel.org \
--cc=spacemit@lists.linux.dev \
--cc=tglx@kernel.org \
--cc=troy.mitchell@linux.spacemit.com \
/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®