linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@baylibre.com>
To: Markus Schneider-Pargmann <msp@baylibre.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Patrice Chotard <patrice.chotard@foss.st.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, "Mendez,
	Judith" <jm@ti.com>, Markus Schneider-Pargmann <msp@baylibre.com>
Subject: Re: [PATCH] clocksource/drivers/arm_global_timer: Add auto-detection for initial prescaler values
Date: Fri, 08 Aug 2025 10:27:22 -0700	[thread overview]
Message-ID: <7h8qjt7mh1.fsf@baylibre.com> (raw)
In-Reply-To: <20250808-topic-am43-arm-global-timer-v6-16-v1-1-82067d327580@baylibre.com>

Markus Schneider-Pargmann <msp@baylibre.com> writes:

> am43xx has a clock tree where the global timer clock is an indirect child
> of the CPU clock used for frequency scaling:
>
>   dpll_mpu_ck -- CPU/cpufreq
>         |
>         v
>   dpll_mpu_m2_ck -- divider
>         |
>         v
>   mpu_periphclk -- fixed divider by 2 used for global timer
>
> When CPU frequency changes, the global timer's clock notifier rejects
> the change because the hardcoded prescaler (1 or 2) cannot accommodate
> the frequency range across all CPU OPPs (300, 600, 720, 800, 1000 MHz).
>
> Add platform-specific prescaler auto-detection to solve this issue:
>
> - am43xx: prescaler = 50 (calculated as initial_freq/GCD of all OPP
>   freqs) This allows the timer to work across all CPU frequencies after
>   the fixed divider by 2. Tested on am4372-idk-evm.
>
> - zynq-7000: prescaler = 2 (preserves previous Kconfig default)
>
> - Other platforms: prescaler = 1 (previous default)
>
> The Kconfig option now defaults to 0 (auto-detection) but can still
> override the auto-detected value when set to a non-zero value,
> preserving existing customization workflows.
>
> Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>

Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Kevin Hilman <khilman@baylibre.com>

Tested this on my am437x-gp-evm board, and confirm that all the noise
from CPUfreq failing to change frequencies is gone.

Thanks for fixing this!

Kevin

  reply	other threads:[~2025-08-08 17:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-08 10:35 [PATCH] clocksource/drivers/arm_global_timer: Add auto-detection for initial prescaler values Markus Schneider-Pargmann
2025-08-08 17:27 ` Kevin Hilman [this message]
2025-08-20 16:47 ` Judith Mendez

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=7h8qjt7mh1.fsf@baylibre.com \
    --to=khilman@baylibre.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=jm@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=msp@baylibre.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=tglx@linutronix.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;
as well as URLs for NNTP newsgroup(s).