From: Arun Iyengar <aiyengar1990@gmail.com>
To: wens@kernel.org
Cc: Daniel Lezcano <daniel.lezcano@kernel.org>,
Thomas Gleixner <tglx@kernel.org>,
linux-kernel@vger.kernel.org,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Michal Piekos <michal.piekos@mmpsystems.pl>,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev
Subject: Re: [PATCH] clocksource/drivers/sun5i: Allow enabling the driver on 64-bit sunxi
Date: Thu, 12 Nov 2026 01:24:53 -0800 [thread overview]
Message-ID: <CAEy9hNXfqPHEhDnfP+S5zbvFbVSiuMUALVRNQLPEdOLTsehRZg@mail.gmail.com> (raw)
In-Reply-To: <CAGb2v66=UbyC0jaW6tjeux5VruUAXN_64bAs3+LyS=CRG1qm9Q@mail.gmail.com>
Hi Chen-Yu,
On Wed, Nov 11, 2026, Chen-Yu Tsai wrote:
> This doesn't really say _why_ a user might want to enable it though.
> The only reason to do so is to get a higher resolution timer, but
> the rating for sun5i-timer is lower than sun4i-timer for both clocksource
> and clockevents. Realistically speaking this is never going to get used.
Thanks for the review. You're right: with its rating below both the
architected timer and the sun4i timer, the kernel never picks it, and I
have no use case that would. I'll drop this patch.
Best regards,
Arun
On Tue, Nov 10, 2026 at 11:33 PM Chen-Yu Tsai <wens@kernel.org> wrote:
>
> On Tue, Nov 10, 2026 at 3:07 PM Arun Iyengar via B4 Relay
> <devnull+aiyengar1990.gmail.com@kernel.org> wrote:
> >
> > From: Arun Iyengar <aiyengar1990@gmail.com>
> >
> > The high-speed timer driver binds "allwinner,sun20i-d1-hstimer", which
> > the H616 device tree uses as the fallback compatible of its
> > "allwinner,sun50i-h616-hstimer" node and the D1/T113 device tree uses
> > directly. SUN5I_HSTIMER, however, only has a prompt under COMPILE_TEST
> > and is selected by the 32-bit sunxi machine Kconfig alone, so arm64 and
> > RISC-V sunxi kernels cannot enable it and these nodes never probe.
>
> This could be simplified: the high speed timer is available on many
> newer platforms, but it is only selected by the few original platforms,
> and not visible to the user.
>
> > Make the prompt visible on ARCH_SUNXI. The driver registers its
> > clocksource and clockevent at rating 340: below the architected timer's
> > clocksource (400) and below the sun4i timer (350), which ARCH_SUNXI
> > already selects on arm64 and RISC-V. Enabling it therefore adds a
> > second hardware time base without changing which one the kernel uses.
> >
> > Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
> > ---
> > The H616 and D1/T113 hstimer nodes and the D1 driver support were merged
> > for 7.2, but the driver still cannot be enabled outside COMPILE_TEST on
> > arm64 and RISC-V.
> >
> > Tested on an Orange Pi Zero2 (H616) with a 7.3 kernel carrying this
> > patch and CONFIG_SUN5I_HSTIMER=y: the hstimer node at 0x3005000
> > probes and available_clocksource lists "arch_sys_counter timer
> > hstimer".
> >
> > This patch was developed with Claude (Anthropic) as a coding
> > assistant. It investigated the problem and wrote the code and the commit
> > message; I reviewed it, and it was tested on an Orange Pi Zero2 (H616)
> > as described above.
> > ---
> > drivers/clocksource/Kconfig | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> > index da83483296d5..971491d2e584 100644
> > --- a/drivers/clocksource/Kconfig
> > +++ b/drivers/clocksource/Kconfig
> > @@ -172,12 +172,17 @@ config SUN4I_TIMER
> > Enables support for the Sun4i timer.
> >
> > config SUN5I_HSTIMER
> > - bool "Sun5i timer driver" if COMPILE_TEST
> > + bool "Sun5i timer driver" if COMPILE_TEST || ARCH_SUNXI
>
> Nit: I would probably write "if ARCH_SUNXI || COMPILE_TEST" just to match
> the other instances.
>
> > select CLKSRC_MMIO
> > depends on COMMON_CLK
> > help
> > Enables support the Sun5i timer.
> >
> > + The 32-bit sunxi platforms that have this timer select it. On
>
> "selected"? BTW I think we can drop the "selects" from those platforms
> if the option is now visible to the user.
>
> > + 64-bit (ARM64, RISC-V) sunxi SoCs such as the H616 and D1 it
> > + registers an additional clocksource and clockevent device, rated
> > + below the ones the kernel already uses there.
> > +
>
> This doesn't really say _why_ a user might want to enable it though.
> The only reason to do so is to get a higher resolution timer, but
> the rating for sun5i-timer is lower than sun4i-timer for both clocksource
> and clockevents. Realistically speaking this is never going to get used.
>
>
> ChenYu
>
> > config TEGRA_TIMER
> > bool "Tegra timer driver" if COMPILE_TEST
> > select CLKSRC_MMIO
> >
> > ---
> > base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
> > change-id: 20261110-sun5i-hstimer-arch-sunxi-167ea2ebcbd7
> >
> > Best regards,
> > --
> > Arun Iyengar <aiyengar1990@gmail.com>
> >
> >
prev parent reply other threads:[~2026-11-12 9:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 6:07 Arun Iyengar via B4 Relay
2026-11-11 7:32 ` Chen-Yu Tsai
2026-11-12 9:24 ` Arun Iyengar [this message]
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=CAEy9hNXfqPHEhDnfP+S5zbvFbVSiuMUALVRNQLPEdOLTsehRZg@mail.gmail.com \
--to=aiyengar1990@gmail.com \
--cc=daniel.lezcano@kernel.org \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=michal.piekos@mmpsystems.pl \
--cc=samuel@sholland.org \
--cc=tglx@kernel.org \
--cc=wens@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®