From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=193.175.24.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796470554; b=YqFhYP4PhPc8/X3sM+1Sp1xWZov66tThwEeA2HQVL7Qjyh2hxtoQoP7WnugJrtyF2r5M QbaMmQRqYHIlvq7pdqWhAKy/+QH5C9u7hgLId4mNp0syVLV7vAUqIhu3pK1uCf3NW5BU7 2mg2YCUZopeLhBEpNOPdP4xL1iqXMVQzhOQytLWnoNdRL+fBKOF6VU8js8CrWKNFgB662 +Dh7jklyZbFMIuW5BTSixXxxtECC3uUPgp8YTPdToOr0o0Szm1azW1AJgWQJAXD3+xl/a 6cHp7v/ji8t7G6m/hUoNoWovB+esnGHHM09//MxXb++Df+4nKVqs+3CuyMzwHjbCuoA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796470554; h=DMARC-Filter:Received:Received:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=xp6RMuxSJFdz/0lXpakuUIeBEfvEfWw1l6KDXceI1Os=; b=XlAeXI3ixT1PTatOsFq3wYGLQSm+Mco0ymYMohuAVerfvA0KvakO172npV9dk5dSNiwe UnUZs4UANyCckJaHp7KlZ9u6g6bYZya7N06eLerkeNy5G9gZ6F4feGDZIkc+gWhNQZ83o Jyi+DLTthWSc1UguzsJM9mtUnhraBlP7RH0Kp0KXdLc9urKylmR2Td7N0VN8eayBYrHjZ wXgCWjXZExcL4QlN1CAcri/jLn2U47MLdj2FJRV98PVT+3FYer3vKkxkx4QOFUWbeKAG6 hKqsBFhaaCwcTu7wFDSH+e1Tgb/5Ftre3YGwgDupjKQzUXLM1ZX3zPrg8eT+CKMsEtg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=alpha.franken.de; spf=pass smtp.mailfrom=alpha.franken.de; arc=none smtp.remote-ip=193.175.24.41 Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55B78606A332; Sat, 5 Dec 2026 11:35:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 55B78606A332 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=alpha.franken.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alpha.franken.de Received: by elvis.franken.de (Postfix, from userid 10) id 178CF100453; Sat, 5 Dec 2026 12:35:51 +0100 (CET) Received: by alpha.franken.de (Postfix, from userid 1000) id 5CB4DC0A20; Sat, 5 Dec 2026 12:30:54 +0100 (CET) Date: Sat, 5 Dec 2026 12:30:54 +0100 From: Thomas Bogendoerfer To: Nicolas Thibert Cc: linux-mips@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] MIPS: ath79: qca953x: use the mean CPU PLL fraction when dithering Message-ID: References: <20261202104345.973534-1-nithibert@gmail.com> X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > --- > 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 ]