From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796116772; b=Bjjit65cxDFkw1Vl70UO7pW8AyYwbA6fCPvKZk0CWDNFXaxWkjbydq847vqXrAcyonGi isbyK6nphUZVX2mDBL6e0OphTc4Oy+NvT/dXycNC6qRV8zwYleP9abirVDnWb9VnB9AA/ LUZlzB8K+3/E11cH4j+aQylTeccnc7Ver4XkSwn5dS6U8mC9cJNVYLx6+dNugjIVsZFOd GUeE1o+Qj3N39ptGvNNjTVdv5e5az9BaNC4uVmVe36JX2DFf1qvbenK5gnmBRYVKY76hg btcW5vYuzV+r5KgOE3wefs2ftgZgo1oz0WmuU3D158k9OMzasaWqkm7SYxwVYAzPmRw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796116772; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=3TUpti6VKKcsK9tkr8KC6mffj5XUc+YykdHp1BTkQHk=; b=nqDOphJLZtHARKFUU9gNm5II0YqrTR9zA9wuFnoQI0HPjDrtF7KOFq8jYnI+I+9GeV4X A6si/U5qmfKznMX1tH6It+5l5ziD4BJ9D3Mtxa/HJpct8d3Aow0mNnrHNYNBrKOxwHsCv YVFoet5kbvvIz7GWVwNwhB8J050fWwCZ6L51bbwN1jQ0G9th9kg5ZKoU1voOwiErJqL45 f9ng0Oq7RhuRn9GtUt99EE5GeVXruz0AvhO6WDK97MRHq32F0HJgBaRNFQTofDiuoAHxI 693W6I4J7UzC9+b4ATA8ivOR+OktVnHCMNezj/eZsD69RHDPFqBHeJi8YDiB7YyjgPg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=C+AKQe4x; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (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 38BAD606A32F; Tue, 1 Dec 2026 09:19:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=C+AKQe4x Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0F5A1F00925; Tue, 1 Dec 2026 09:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796116771; bh=3TUpti6VKKcsK9tkr8KC6mffj5XUc+YykdHp1BTkQHk=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=C+AKQe4xMXdRb1h+7gEjKZfMMqNIouSY37z3SELpXV/zjz6sOxVK3/Tzuzso05Y+e B5BkvTe4RQXLc62R87WYhw7zjCkRwsObfhfcXnEwaZdkdM0ggjcSnIsytRYTK1SVJM VdFz8b8MBJQwvXfzokvSBvpwKQ9cIm5x16rWVZGA6MFD1iWt8y4JYhzPlT2UKL0x4Q H7ipcWybV6am/6HVd1Zbikl+In5Yui0sNUtO/7Vvk7JitvHuB1aRXKm+9rBPiU6A3B YwMig9Z0seMZ+efL6YGeak1+W3LP+dauuEL/+Aa1gZTIcYBG1+5CHD/gDhyIVzv06D QPIoe820dwe9Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH RFC RFT v3 08/13] clk: meson: g12a: Model the PLL pre-divider as a divider clock Reply-To: sashiko-reviews@lists.linux.dev To: "Jian Hu" Cc: linux-clk@vger.kernel.org, linux-amlogic@lists.infradead.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org, neil.armstrong@linaro.org In-Reply-To: <20261201-meson_refactor_n-v3-8-f85a4460fd80@amlogic.com> References: <20261201-meson_refactor_n-v3-0-f85a4460fd80@amlogic.com> <20261201-meson_refactor_n-v3-8-f85a4460fd80@amlogic.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 09:19:30 +0000 X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] clk: meson: g12a: CLK_GET_RATE_NOCACHE on prediv clocks does not update children -- commit 1cb730ae65d6d705f933c3659db77a276e9bbf91 Author: Jian Hu clk: meson: g12a: Model the PLL pre-divider as a divider clock This commit replaces the embedded n pre-divider parameter on G12A/G12B/SM1 PLL DCO clocks with standalone clk_regmap divider clocks wired as parents of each PLL DCO. > diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c > index beed610e4a825..09eb842e0b1aa 100644 > --- a/drivers/clk/meson/g12a.c > +++ b/drivers/clk/meson/g12a.c [ ... ] > @@ -609,6 +704,32 @@ static struct clk_regmap g12a_hifi_pll =3D { > }, > }; > =20 > +static struct clk_regmap g12a_pcie_prediv =3D { > + .data =3D &(struct clk_regmap_div_data){ > + .offset =3D HHI_PCIE_PLL_CNTL0, > + .shift =3D 10, > + .width =3D 5, > + .table =3D g12a_pll_prediv_div_table, > + .flags =3D CLK_DIVIDER_INVALID_ZERO, > + }, > + .hw.init =3D &(struct clk_init_data){ > + .name =3D "pcie_prediv", > + .ops =3D &clk_regmap_divider_ops, > + .parent_data =3D &(const struct clk_parent_data) { > + .fw_name =3D "xtal", > + }, > + .num_parents =3D 1, > + /* > + * The PCIe prediv register reads zero on power-on. > + * CLK_DIVIDER_INVALID_ZERO makes the first rate return 0 Hz, > + * which gets cached by CCF. The PCIe PLL enable callback > + * later writes a valid non-zero divider value. Use > + * CLK_GET_RATE_NOCACHE to avoid stale cached rate. > + */ > + .flags =3D CLK_GET_RATE_NOCACHE, > + }, > +}; [ ... ] > @@ -674,10 +790,11 @@ static struct clk_regmap g12a_pcie_pll_dco =3D { > .hw.init =3D &(struct clk_init_data){ > .name =3D "pcie_pll_dco", > .ops =3D &meson_clk_pcie_pll_ops, > - .parent_data =3D &(const struct clk_parent_data) { > - .fw_name =3D "xtal", > + .parent_hws =3D (const struct clk_hw *[]) { > + &g12a_pcie_prediv.hw > }, > .num_parents =3D 1, > + .flags =3D CLK_SET_RATE_PARENT, > }, > }; > =20 > @@ -729,6 +846,33 @@ static struct clk_fixed_factor g12a_pcie_pll =3D { > }, > }; > =20 > +static struct clk_regmap g12a_hdmi_prediv =3D { > + .data =3D &(struct clk_regmap_div_data){ > + .offset =3D HHI_HDMI_PLL_CNTL0, > + .shift =3D 10, > + .width =3D 5, > + /* > + * The pre-divider register reads zero until the display driver > + * programs the HDMI PLL, so a zero divisor is not a fault here: > + * treat it as a bypass instead of warning at registration. > + */ > + .flags =3D CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, > + }, > + .hw.init =3D &(struct clk_init_data){ > + .name =3D "hdmi_prediv", > + .ops =3D &clk_regmap_divider_ro_ops, > + .parent_data =3D &(const struct clk_parent_data) { > + .fw_name =3D "xtal", > + }, > + .num_parents =3D 1, > + /* > + * Display directly handle hdmi pll registers ATM, we need > + * NOCACHE to keep our view of the clock as accurate as possible > + */ > + .flags =3D CLK_GET_RATE_NOCACHE, > + }, > +}; [Severity: Medium] Does setting CLK_GET_RATE_NOCACHE on g12a_pcie_prediv and g12a_hdmi_prediv actually refresh their rates when clk_get_rate() is called on descendant clocks such as CLKID_PCIE_PLL or CLKID_HDMI_PLL? In clk_core_get_rate_recalc(), CCF only invokes __clk_recalc_rates() if CLK_GET_RATE_NOCACHE is set on the queried clock itself, and __clk_recalc_rates() walks downward using core->parent->rate from the paren= t's cache without walking upward to recalculate ancestors: drivers/clk/clk.c:clk_core_get_rate_recalc() { if (core && (core->flags & CLK_GET_RATE_NOCACHE)) __clk_recalc_rates(core, false, 0); return clk_core_get_rate_nolock(core); } For PCIe, HHI_PCIE_PLL_CNTL0 reads 0 at boot, so g12a_pcie_prediv and its descendants register with a cached rate of 0 Hz. Because meson_clk_pcie_pl= l_ops has no .set_rate callback and only writes g12a_pcie_pll_init_regs in .enable (meson_clk_pcie_pll_enable()), and none of g12a_pcie_pll_dco..g12a_pcie_pll carry CLK_GET_RATE_NOCACHE, CLKID_PCIE_PLL remains cached at 0 Hz even after clk_prepare_enable(). At this commit (prior to commit "clk: meson: pll: Remove the dedicated n parameter" adding parent rate negotiation to meson_clk_pll_determine_rate()), clk_set_rate(CLKID_PCIE_PLL, 100000000) fr= om assigned-clock-rates on usb3_pcie_phy also fails with -EINVAL because req->best_parent_rate is 0. Similarly, for HDMI, calling clk_get_rate() on g12a_hdmi_pll_dco or g12a_hdmi_pll after the display driver directly updates HHI_HDMI_PLL_CNTL0 recalculates from g12a_hdmi_prediv's cached rate rather than re-reading the pre-divider register. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201-meson_refa= ctor_n-v3-0-f85a4460fd80@amlogic.com?part=3D8