From nobody Tue Apr 7 04:27:28 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F5643A63FB for ; Mon, 16 Mar 2026 15:26:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773674767; cv=none; b=ubqXnbPE4yeANHyZgXS0NCHwM8pdl8dQxU8Ut0HRsExrn3jWJ4nqreBezJuXOb2gCVTYP1ehpYbQZY7OjSyvLXneCJ2iU2lr9tWv8hB+veKXNjoakMuXtfMLSVau7wkomNL0mols95LfkirLGZvXoCwnwg1oZri47iLYqRRPtp0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773674767; c=relaxed/simple; bh=kz55thIenPw3bekdJ4aFbt2VUZoLFRkqCicN/30NKDE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Vr7VGgy6/pcn+fAPAlcipBq15NF+7G8o5pG9HDmQ25whxAmPLr9UiqhEJ2KFVu3r2ZCWT4eB2jOPCHUCG+ENdX1kt/VQo51inMEgBVQuW6EgAB5STArBMQaMLzSxTH+8dlRjg/ayYLlDGQrwWR654gBag4PgdhqKDgccErJX+Jk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=rlU0bcoB; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="rlU0bcoB" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 26E174E426C0; Mon, 16 Mar 2026 15:26:05 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id F06C15FC4A; Mon, 16 Mar 2026 15:26:04 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 077EB103721F3; Mon, 16 Mar 2026 16:26:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1773674763; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=fzigpU/p/PzFO6PSD51srQn9vza1EMhFgBBVZX2t/WQ=; b=rlU0bcoBsAEncaYDD+0VdD6lcTC9bnCiZpMYDYsdY6ojDX99uDmfKJD9T2A5Gk8dI0iDFt oL0oO6N5nzKT6QIS7Y+01P1EkoDE4SL0/X+QhNQafTX+rOOGBhDiffozrQA6Lo3pPW61eS AWKUP8nUY2+JuwsOeGme6AcSmezQeXFCKWRkI0UIu3wMCnzGFjnmQnbsYGVfOeamVHr8rP YC/y/2H2S/49v092H3iE0Qk680IOv94tf+U4U4J67EiVZjx+PS+vSzfJ1AGEusSaZHrp+F E2FJ8XCKiRcqh6ThxxPUE6frhW48dFE8zAfcozUCAHcrOd8gWWbFfVQjLFvWgw== From: =?utf-8?q?Beno=C3=AEt_Monin?= Date: Mon, 16 Mar 2026 16:25:45 +0100 Subject: [PATCH v4 08/13] clk: eyeq: Adjust PLL accuracy computation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260316-eyeq6lplus-v4-8-bf44dfc7a261@bootlin.com> References: <20260316-eyeq6lplus-v4-0-bf44dfc7a261@bootlin.com> In-Reply-To: <20260316-eyeq6lplus-v4-0-bf44dfc7a261@bootlin.com> To: Vladimir Kondratiev , Gregory CLEMENT , =?utf-8?q?Th=C3=A9o_Lebrun?= , Thomas Bogendoerfer , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Turquette , Stephen Boyd , Philipp Zabel , Linus Walleij Cc: Thomas Petazzoni , Tawfik Bayouk , linux-mips@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Beno=C3=AEt_Monin?= X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The spread spectrum of the PLL found in eyeQ OLB is in 1/1024 parts of the frequency, not in 1/1000, so adjust the computation of the accuracy. Also correct the downspreading to match. Signed-off-by: Beno=C3=AEt Monin Acked-by: Stephen Boyd --- drivers/clk/clk-eyeq.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/clk/clk-eyeq.c b/drivers/clk/clk-eyeq.c index 904d7d77d415..abffa46364f5 100644 --- a/drivers/clk/clk-eyeq.c +++ b/drivers/clk/clk-eyeq.c @@ -164,7 +164,7 @@ static void eqc_pll_downshift_factors(unsigned long *mu= lt, unsigned long *div) static int eqc_pll_parse_registers(u32 r0, u32 r1, unsigned long *mult, unsigned long *div, unsigned long *acc) { - u32 spread; + unsigned long spread; =20 if (r0 & PCSR0_BYPASS) { *mult =3D 1; @@ -196,23 +196,23 @@ static int eqc_pll_parse_registers(u32 r0, u32 r1, un= signed long *mult, /* * Spread spectrum. * - * Spread is 1/1000 parts of frequency, accuracy is half of - * that. To get accuracy, convert to ppb (parts per billion). + * Spread is in 1/1024 parts of frequency. Clock accuracy + * is half the spread value expressed in parts per billion. * - * acc =3D spread * 1e6 / 2 - * with acc in parts per billion and, - * spread in parts per thousand. + * accuracy =3D (spread * 1e9) / (1024 * 2) + * + * Care is taken to avoid overflowing or losing precision. */ spread =3D FIELD_GET(PCSR1_SPREAD, r1); - *acc =3D spread * 500000; + *acc =3D DIV_ROUND_CLOSEST(spread * 1000000000, 1024 * 2); =20 if (r1 & PCSR1_DOWN_SPREAD) { /* * Downspreading: the central frequency is half a * spread lower. */ - *mult *=3D 2000 - spread; - *div *=3D 2000; + *mult *=3D 2048 - spread; + *div *=3D 2048; =20 /* * Previous operation might overflow 32 bits. If it --=20 2.53.0