mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>,
	Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v1 2/4] clocksource: arm_architected_timer: support clock-frequency
Date: Wed, 30 Jul 2025 10:13:06 +0200	[thread overview]
Message-ID: <a62d9aec-d1da-4e62-9b15-efbf67440893@pengutronix.de> (raw)
In-Reply-To: <20250729203659.1858575-3-ivo.ivanov.ivanov1@gmail.com>

On 7/29/25 22:36, Ivaylo Ivanov wrote:
> Some platforms, like the Samsung Galaxy S8, leave CNTFRQ_EL0 unset in
> the previous stage bootloader. Therefore reading it causes a hang and
> the boot proccess is halted.
> 
> Since on such retail devices there is no way to set it without replacing
> the entire boot chain, allow setting a value from clock-frequency
> whenever it's passed.
> 
> Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Linux does this too, so I think regressions are unlikely.

Cheers,
Ahmad

> ---
>  drivers/clocksource/arm_architected_timer.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clocksource/arm_architected_timer.c b/drivers/clocksource/arm_architected_timer.c
> index 9a1f2d2b..daced94c 100644
> --- a/drivers/clocksource/arm_architected_timer.c
> +++ b/drivers/clocksource/arm_architected_timer.c
> @@ -24,7 +24,16 @@ static struct clocksource cs = {
>  
>  static int arm_arch_timer_probe(struct device *dev)
>  {
> -	cs.mult = clocksource_hz2mult(get_cntfrq(), cs.shift);
> +	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)
> +		cntfrq = get_cntfrq();
> +
> +	cs.mult = clocksource_hz2mult(cntfrq, cs.shift);
>  
>  	return init_clock(&cs);
>  }

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2025-07-30  8:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29 20:36 [PATCH v1 0/4] ARM: boards: add support for Samsung Galaxy S8 and S20 5G Ivaylo Ivanov
2025-07-29 20:36 ` [PATCH v1 1/4] video: simplefb-client: switch to dev_get_resource Ivaylo Ivanov
2025-07-30  8:11   ` Ahmad Fatoum
2025-07-30 11:28     ` Ivaylo Ivanov
2025-07-30 12:31       ` Ahmad Fatoum
2025-07-29 20:36 ` [PATCH v1 2/4] clocksource: arm_architected_timer: support clock-frequency Ivaylo Ivanov
2025-07-30  8:13   ` Ahmad Fatoum [this message]
2025-08-05  7:40   ` (subset) " Sascha Hauer
2025-07-29 20:36 ` [PATCH v1 3/4] ARM: boards: add support for Samsung Galaxy S8 (dreamlte) Ivaylo Ivanov
2025-07-30  8:31   ` Ahmad Fatoum
2025-07-30  9:09     ` Ivaylo Ivanov
2025-07-30  9:33       ` Ahmad Fatoum
2025-07-30 11:12         ` Ivaylo Ivanov
2025-07-29 20:36 ` [PATCH v1 4/4] ARM: boards: add support for Samsung Galaxy S20 5G (x1s) Ivaylo Ivanov
2025-07-30  8:48   ` Ahmad Fatoum
2025-07-30  9:16     ` Ivaylo Ivanov
2025-07-30  9:44       ` Ahmad Fatoum
2025-07-30 11:18         ` Ivaylo Ivanov
2025-07-30 12:50           ` Ahmad Fatoum
2025-07-30 13:12             ` Ivaylo Ivanov
2025-07-30 13:26               ` Ahmad Fatoum

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=a62d9aec-d1da-4e62-9b15-efbf67440893@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=ivo.ivanov.ivanov1@gmail.com \
    --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