From: Stefan Kerkmann <s.kerkmann@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: Re: [PATCH v3 4/8] drivers: arm_architected_timer: refactor for pbl compatibility
Date: Thu, 20 Aug 2026 10:07:51 +0200 [thread overview]
Message-ID: <285f8e75-d674-465b-b5b0-0669ad4b446d@pengutronix.de> (raw)
In-Reply-To: <a56adf74-a3e3-4ed1-96c5-38619b31fa33@pengutronix.de>
Hi Sascha,
On 8/20/26 10:00, Sascha Hauer wrote:
> On 2026-08-20 09:32, Stefan Kerkmann wrote:
>>>> diff --git a/drivers/clocksource/arm_architected_timer.c b/drivers/clocksource/arm_architected_timer.c
>>>> index daced94c0e..ea5f5b8e05 100644
>>>> --- a/drivers/clocksource/arm_architected_timer.c
>>>> +++ b/drivers/clocksource/arm_architected_timer.c
>>>> @@ -9,6 +9,7 @@
>>>> #include <linux/clk.h>
>>>> #include <io.h>
>>>> #include <asm/system.h>
>>>> +#include <asm/hardware/arm_architected_timer.h>
>>>>
>>>> static uint64_t arm_arch_clocksource_read(void)
>>>> {
>>>> @@ -22,22 +23,29 @@ static struct clocksource cs = {
>>>> .priority = 70,
>>>> };
>>>>
>>>> -static int arm_arch_timer_probe(struct device *dev)
>>>> +int arm_arch_timer_init(uint64_t cntfrq)
>>>> {
>>>> - u32 cntfrq;
>>>> - int ret;
>>>> -
>>>> - /* Some platforms don't set CNTFRQ_EL0 before barebox */
>>>> - ret = of_property_read_u32(dev->of_node, "clock-frequency", &cntfrq);
>>>> -
>>>> - if (ret)
>>>> + if (!cntfrq)
>>>> cntfrq = get_cntfrq();
>>>
>>> I wonder if we should just drop the cntfrq argument. All users call
>>> set_cntfrq() before calling this, so get_cntfrq() should return the
>>> correct value and we can rely on it.
>>>
>>
>> Maybe keep the argument and use set_cntfrq in arm_arch_timer_init if the
>> argument is !=0? Then arm_arch_timer_init is the function to use if a C
>> environment is available? This would prevent any inconsistency.
>
> I am not sure, but set_cntfrq() might only be usable in EL3, so you
> would have to be careful about the exception level when calling
> arm_arch_timer_init() with a non zero argument.
>
Yes, it would have to be guarded by an el3 check.
> Sascha
>
Best regards,
Stefan
--
Pengutronix e.K. | Stefan Kerkmann |
Steuerwalder Str. 21 | https://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-128 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
next prev parent reply other threads:[~2026-08-20 8:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 14:01 [PATCH v3 0/8] PBL: enable timeouts in read_poll_timeout macros Stefan Kerkmann
2026-08-17 14:01 ` [PATCH v3 1/8] RISC-V: setup_c: avoid clearing BSS twice Stefan Kerkmann
2026-08-17 14:01 ` [PATCH v3 2/8] ARM/ARM64/RISC-V: pbl: add constructor support Stefan Kerkmann
2026-08-18 12:08 ` [PATCH] amend! " Stefan Kerkmann
2026-08-19 9:39 ` [PATCH v3 2/8] " Sascha Hauer
2026-08-17 14:01 ` [PATCH v3 3/8] clocksource: allow re-init for same clock Stefan Kerkmann
2026-08-17 14:01 ` [PATCH v3 4/8] drivers: arm_architected_timer: refactor for pbl compatibility Stefan Kerkmann
2026-08-20 7:04 ` Sascha Hauer
2026-08-20 7:32 ` Stefan Kerkmann
2026-08-20 8:00 ` Sascha Hauer
2026-08-20 8:07 ` Stefan Kerkmann [this message]
2026-08-17 14:01 ` [PATCH v3 5/8] ARM: layerscape: re-init pbl clocksource Stefan Kerkmann
2026-08-17 15:42 ` Ahmad Fatoum
2026-08-20 6:59 ` Sascha Hauer
2026-08-20 8:06 ` Stefan Kerkmann
2026-08-17 14:01 ` [PATCH v3 6/8] ARM: socfpga: agilex5: " Stefan Kerkmann
2026-08-17 14:01 ` [PATCH v3 7/8] ARM64: enable PBL_CLOCKSOURCE compatibility Stefan Kerkmann
2026-08-17 14:01 ` [PATCH v3 8/8] linux/iopoll: enable polled timeouts for PBL_CLOCKSOURCE Stefan Kerkmann
2026-08-19 7:03 ` [PATCH v3 0/8] PBL: enable timeouts in read_poll_timeout macros Sascha Hauer
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=285f8e75-d674-465b-b5b0-0669ad4b446d@pengutronix.de \
--to=s.kerkmann@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/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