All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Stefan Dösinger" <stefandoesinger@gmail.com>
Cc: linux-clk@vger.kernel.org, olteanv@gmail.com,
	mfd@lists.linux.dev, lee@kernel.org, neil.armstrong@linaro.org,
	devicetree@vger.kernel.org, vkoul@kernel.org, robh@kernel.org,
	conor+dt@kernel.org, linux-phy@lists.infradead.org
Subject: Re: [PATCH v13 08/13] clk: zte: Add zx PLL support infrastructure
Date: Sun, 27 Sep 2026 21:00:39 +0000	[thread overview]
Message-ID: <20260927210040.4F36A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260927-zx29clk-v13-8-70d8f673386c@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] clk: zte: unsafe instant PLL rate changes permitted due to missing CLK_SET_RATE_GATE
--

commit 81b8ceca645bb1aa1a8c8fd73b9fdfcf93600c0d
Author: Stefan Dösinger <stefandoesinger@gmail.com>

clk: zte: Add zx PLL support infrastructure

This patch adds code to decode and program PLL settings on ZTE's zx297520v3
SoC, parsing bootloader-programmed values to fill the clock tree with
appropriately clocked parent clocks instead of hardcoded fixed rates.

> diff --git a/drivers/clk/zte/pll-zx.c b/drivers/clk/zte/pll-zx.c
> index fc76c6524a163..d3687495d06ce 100644
> --- a/drivers/clk/zte/pll-zx.c
> +++ b/drivers/clk/zte/pll-zx.c
[ ... ]
> +static int zx29_pll_set_rate(struct clk_hw *hw, unsigned long rate,
> +			     unsigned long parent_rate)
> +{
> +	struct zx29_clk_pll *pll = to_zx29_clk_pll(hw);
> +	u32 setting;
> +
> +	/*
> +	 * TODO: Implement gradual PLL rate change. PLLs can be changed while they are running and
> +	 * downstream hardware is generally fine with that. The exception is DRAM, which reads
> +	 * incorrect values if changed too fast.
> +	 *
> +	 * Changing the mpll rate is potentially useful for over/underclocking. Gating mpll is
> +	 * unrealistic because too many devices depend on it.
> +	 */
> +	setting = zx29_pll_calc_values(pll, parent_rate, rate, rate, rate);
> +	if (!setting)
> +		return -EINVAL;
> +
> +	dev_dbg(pll->dev, "%s: Setting new configuration: 0x%08x\n", clk_hw_get_name(hw), setting);
> +
> +	return regmap_update_bits(pll->map, pll->reg, 0x00ffffff, setting);

[Severity: Medium]
Will writing the new divider values instantaneously here cause a clock glitch
for large rate changes?

The TODO notes that gradual rate changes are not yet implemented, which could
lead to temporary incorrect clock output or DRAM corruption if a rate change
is requested.

[ ... ]
> +struct clk_hw *zx_clk_register_pll(struct device *dev, struct regmap *regmap,
> +				   const struct zx_pll_desc *desc, struct clk_hw * const *clocks)
> +{
[ ... ]
> +	init.name = desc->name;
> +	init.parent_data = parents;
> +	init.num_parents = desc->num_parents;
> +
> +	/*
> +	 * Disallow live reparent, but allow rate changes. PLLs can handle gradual changes fine, but
> +	 * large ones cause a temporary incorrect output, which can break downstream devices.
> +	 * See zx29_pll_set_rate for considerations on that.
> +	 */
> +	init.flags = CLK_SET_PARENT_GATE;

[Severity: Medium]
Since gradual rate changes are not actually implemented yet, does omitting the
CLK_SET_RATE_GATE flag misinform the clock framework that it is safe to apply
live rate changes to this PLL?

While gating mpll might be unrealistic as noted earlier, leaving out
CLK_SET_RATE_GATE before gradual stepping is implemented might permit unsafe
live jumps if a rate change is ever requested on an active PLL.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260927-zx29clk-v13-0-70d8f673386c@gmail.com?part=8

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Stefan Dösinger" <stefandoesinger@gmail.com>
Cc: linux-clk@vger.kernel.org, olteanv@gmail.com,
	mfd@lists.linux.dev, lee@kernel.org, neil.armstrong@linaro.org,
	devicetree@vger.kernel.org, vkoul@kernel.org, robh@kernel.org,
	conor+dt@kernel.org, linux-phy@lists.infradead.org
Subject: Re: [PATCH v13 08/13] clk: zte: Add zx PLL support infrastructure
Date: Sun, 27 Sep 2026 21:00:39 +0000	[thread overview]
Message-ID: <20260927210040.4F36A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260927-zx29clk-v13-8-70d8f673386c@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] clk: zte: unsafe instant PLL rate changes permitted due to missing CLK_SET_RATE_GATE
--

commit 81b8ceca645bb1aa1a8c8fd73b9fdfcf93600c0d
Author: Stefan Dösinger <stefandoesinger@gmail.com>

clk: zte: Add zx PLL support infrastructure

This patch adds code to decode and program PLL settings on ZTE's zx297520v3
SoC, parsing bootloader-programmed values to fill the clock tree with
appropriately clocked parent clocks instead of hardcoded fixed rates.

> diff --git a/drivers/clk/zte/pll-zx.c b/drivers/clk/zte/pll-zx.c
> index fc76c6524a163..d3687495d06ce 100644
> --- a/drivers/clk/zte/pll-zx.c
> +++ b/drivers/clk/zte/pll-zx.c
[ ... ]
> +static int zx29_pll_set_rate(struct clk_hw *hw, unsigned long rate,
> +			     unsigned long parent_rate)
> +{
> +	struct zx29_clk_pll *pll = to_zx29_clk_pll(hw);
> +	u32 setting;
> +
> +	/*
> +	 * TODO: Implement gradual PLL rate change. PLLs can be changed while they are running and
> +	 * downstream hardware is generally fine with that. The exception is DRAM, which reads
> +	 * incorrect values if changed too fast.
> +	 *
> +	 * Changing the mpll rate is potentially useful for over/underclocking. Gating mpll is
> +	 * unrealistic because too many devices depend on it.
> +	 */
> +	setting = zx29_pll_calc_values(pll, parent_rate, rate, rate, rate);
> +	if (!setting)
> +		return -EINVAL;
> +
> +	dev_dbg(pll->dev, "%s: Setting new configuration: 0x%08x\n", clk_hw_get_name(hw), setting);
> +
> +	return regmap_update_bits(pll->map, pll->reg, 0x00ffffff, setting);

[Severity: Medium]
Will writing the new divider values instantaneously here cause a clock glitch
for large rate changes?

The TODO notes that gradual rate changes are not yet implemented, which could
lead to temporary incorrect clock output or DRAM corruption if a rate change
is requested.

[ ... ]
> +struct clk_hw *zx_clk_register_pll(struct device *dev, struct regmap *regmap,
> +				   const struct zx_pll_desc *desc, struct clk_hw * const *clocks)
> +{
[ ... ]
> +	init.name = desc->name;
> +	init.parent_data = parents;
> +	init.num_parents = desc->num_parents;
> +
> +	/*
> +	 * Disallow live reparent, but allow rate changes. PLLs can handle gradual changes fine, but
> +	 * large ones cause a temporary incorrect output, which can break downstream devices.
> +	 * See zx29_pll_set_rate for considerations on that.
> +	 */
> +	init.flags = CLK_SET_PARENT_GATE;

[Severity: Medium]
Since gradual rate changes are not actually implemented yet, does omitting the
CLK_SET_RATE_GATE flag misinform the clock framework that it is safe to apply
live rate changes to this PLL?

While gating mpll might be unrealistic as noted earlier, leaving out
CLK_SET_RATE_GATE before gradual stepping is implemented might permit unsafe
live jumps if a rate change is ever requested on an active PLL.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260927-zx29clk-v13-0-70d8f673386c@gmail.com?part=8

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2026-09-27 21:00 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27 20:13 [PATCH v13 00/13] ZTE zx297520v3 clock bindings and driver Stefan Dösinger
2026-09-27 20:13 ` Stefan Dösinger
2026-09-27 20:13 ` [PATCH v13 01/13] dt-bindings: clk: zte: Add zx297520v3 top clock and reset controller Stefan Dösinger
2026-09-27 20:13   ` Stefan Dösinger
2026-09-27 20:54   ` sashiko-bot
2026-09-27 20:54     ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 03/13] dt-bindings: clk: zte: Add zx297520v3 LSP " Stefan Dösinger
2026-09-27 20:13   ` Stefan Dösinger
2026-09-27 20:54   ` sashiko-bot
2026-09-27 20:54     ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 04/13] mfd: zx297520v3: Add a clock and reset MFD driver Stefan Dösinger
2026-09-27 20:13   ` Stefan Dösinger
2026-09-27 20:57   ` sashiko-bot
2026-09-27 20:57     ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 05/13] Maintainers: Add entry for drivers/mfd/zte-zx297520v3-crm.c Stefan Dösinger
2026-09-27 20:13   ` Stefan Dösinger
2026-09-27 20:13 ` [PATCH v13 06/13] clk: zte: Add Clock registration infrastructure Stefan Dösinger
2026-09-27 20:13   ` Stefan Dösinger
2026-09-27 20:59   ` sashiko-bot
2026-09-27 20:59     ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 07/13] clk: zte: Add regmap-based clocks Stefan Dösinger
2026-09-27 20:13   ` Stefan Dösinger
2026-09-27 20:59   ` sashiko-bot
2026-09-27 20:59     ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 08/13] clk: zte: Add zx PLL support infrastructure Stefan Dösinger
2026-09-27 20:13   ` Stefan Dösinger
2026-09-27 21:00   ` sashiko-bot [this message]
2026-09-27 21:00     ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 09/13] clk: zte: Introduce a driver for zx297520v3 top clocks Stefan Dösinger
2026-09-27 20:13   ` Stefan Dösinger
2026-09-27 21:00   ` sashiko-bot
2026-09-27 21:00     ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 10/13] clk: zte: Introduce a driver for zx297520v3 matrix clocks Stefan Dösinger
2026-09-27 20:13   ` Stefan Dösinger
2026-09-27 21:05   ` sashiko-bot
2026-09-27 21:05     ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 11/13] clk: zte: Introduce a driver for zx297520v3 LSP clocks Stefan Dösinger
2026-09-27 20:13   ` Stefan Dösinger
2026-09-27 20:58   ` sashiko-bot
2026-09-27 20:58     ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 12/13] reset: zte: Add a zx297520v3 reset driver Stefan Dösinger
2026-09-27 20:13   ` Stefan Dösinger
2026-09-27 20:59   ` sashiko-bot
2026-09-27 20:59     ` sashiko-bot
2026-09-27 20:13 ` [PATCH v13 13/13] ARM: dts: zte: Declare zx297520v3 CRM device nodes Stefan Dösinger
2026-09-27 20:13   ` Stefan Dösinger
2026-09-27 20:57   ` sashiko-bot
2026-09-27 20:57     ` sashiko-bot
2026-09-27 20:50 ` [PATCH v13 02/13] dt-bindings: clk: zte: Add zx297520v3 matrix clock and reset controller Stefan Dösinger
2026-09-27 20:50   ` Stefan Dösinger
2026-09-27 20:54   ` sashiko-bot
2026-09-27 20:54     ` sashiko-bot
2026-10-02 15:08 ` (subset) [PATCH v13 00/13] ZTE zx297520v3 clock bindings and driver Brian Masney
2026-10-02 15:08   ` Brian Masney

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=20260927210040.4F36A1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=mfd@lists.linux.dev \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=stefandoesinger@gmail.com \
    --cc=vkoul@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.