From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Nicolas Thibert <nithibert@gmail.com>
Cc: linux-mips@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] MIPS: ath79: qca953x: use the mean CPU PLL fraction when dithering
Date: Sat, 5 Dec 2026 12:30:54 +0100 [thread overview]
Message-ID: <axP17nDnnsIx_IQv@alpha.franken.de> (raw)
In-Reply-To: <20261202104345.973534-1-nithibert@gmail.com>
On Wed, Dec 02, 2026 at 11:43:45AM +0100, Nicolas Thibert wrote:
> The QCA953x CPU PLL can dither its fractional part: when bit 31 of the
> CPU_DIT_FRAC register (PLL block offset 0x48) is set, the hardware
> sweeps the fraction between the MIN and MAX fields of that register.
> Mainline U-Boot enables it for QCA953x (MIN 0, MAX 63, so the CPU
> clock sweeps 650 to 674.6 MHz with a 25 MHz reference).
>
> qca953x_clocks_init() reads the fraction once from CPU_PLL_CONFIG, so
> with dithering enabled it gets a random sample of the sweep. The CPU
> clock, the MIPS clocksource and therefore the system time are then off
> by up to the dithering range, differently on every boot.
>
> Measured on a QCA9531 board booted by mainline U-Boot, comparing
> /proc/uptime with an external clock: the kernel reported 652.3, 653.1
> and 673.0 MHz on three boots, and the system time drifted by +16100,
> +12000 and -15600 ppm respectively, while the real mean frequency was
> 661 to 663 MHz every time, i.e. the mean of the sweep (662.3 MHz).
>
> When dithering is enabled, use the mean (MIN + MAX) / 2 of the
> fraction. Without dithering nothing changes.
>
> Tested on the same board, with U-Boot dithering between MIN 30 and
> MAX 63: the kernel now reports 643.164 MHz, the mean of the sweep, on
> every boot.
>
> Note that offset 0x48 is also defined as
> QCA953X_PLL_ETH_SGMII_CONTROL_REG, which has no user.
>
> The problem was analysed and this patch written with the help of an AI
> coding assistant (Claude, Anthropic), from register dumps and the drift
> measurements above; all measurements and tests were run on hardware.
>
> Fixes: af2d1b521bfb ("MIPS: ath79: add support for QCA953x QCA956x TP9343")
> Cc: stable@vger.kernel.org
> Signed-off-by: Nicolas Thibert <nithibert@gmail.com>
> ---
> arch/mips/ath79/clock.c | 19 +++++++++++++++++--
> .../mips/include/asm/mach-ath79/ar71xx_regs.h | 7 +++++++
> 2 files changed, 24 insertions(+), 2 deletions(-)
applied to mips-next
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
prev parent reply other threads:[~2026-12-05 11:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 10:43 [PATCH] MIPS: ath79: qca953x: use the mean CPU PLL fraction when dithering Nicolas Thibert
2026-12-05 11:30 ` Thomas Bogendoerfer [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=axP17nDnnsIx_IQv@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=linux-mips@vger.kernel.org \
--cc=nithibert@gmail.com \
--cc=stable@vger.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