Linux clock framework development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rosen Penev" <rosenp@gmail.com>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 5/6] clk: add a driver for the Atheros/Qualcomm ath79 PLL controller
Date: Tue, 10 Nov 2026 01:59:26 +0000	[thread overview]
Message-ID: <sashiko-outbox-206010@kernel.org> (raw)
In-Reply-To: <20261110013646.1582970-6-rosenp@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] clk: ath79: fw_devlink blocks ath79_clk_probe() when ref
  lacks clock-frequency
- [Medium] clk: ath79: missing UPDATING wait in
  ath79_pcie_pll_unprepare()
--

commit dd79c08de0fc1914f23e0beb52d8e93809a55692
Author: Rosen Penev <rosenp@gmail.com>

clk: add a driver for the Atheros/Qualcomm ath79 PLL controller

This commit adds a common clock driver for the Atheros/Qualcomm ath79 PLL
controller, registering the reference and CPU clocks early via
CLK_OF_DECLARE_DRIVER() and the remaining clocks from a platform driver.

> diff --git a/drivers/clk/clk-ath79.c b/drivers/clk/clk-ath79.c
> new file mode 100644
> index 0000000000000..3ddbd020afb12
> --- /dev/null
> +++ b/drivers/clk/clk-ath79.c
> @@ -0,0 +1,778 @@

[ ... ]

> +static int ath79_pcie_pll_prepare(struct clk_hw *hw)
> +{
> +	struct ath79_pcie_pll *pll = to_ath79_pcie_pll(hw);
> +	u32 t;
> +	int ret;
> +
> +	/*
> +	 * Every write freezes the high speed clocks for about 60 us, so
> +	 * leave a PLL that the bootloader already started alone.
> +	 */
> +	if (ath79_pcie_pll_is_prepared(hw))
> +		return 0;
> +
> +	t = readl(pll->reg) & ~pll->pwd;
> +	writel(t, pll->reg);
> +	ret = ath79_pcie_pll_wait(pll);
> +	if (ret)
> +		return ret;
> +
> +	writel(t & ~pll->bypass, pll->reg);
> +	return ath79_pcie_pll_wait(pll);
> +}
> +
> +static void ath79_pcie_pll_unprepare(struct clk_hw *hw)
> +{
> +	struct ath79_pcie_pll *pll = to_ath79_pcie_pll(hw);
> +	u32 t;
> +
> +	t = readl(pll->reg) | pll->bypass;
> +	writel(t, pll->reg);
> +	writel(t | pll->pwd, pll->reg);
> +}

[Severity: Medium]
Should ath79_pcie_pll_unprepare() call ath79_pcie_pll_wait(pll) after each
write to pll->reg, like ath79_pcie_pll_prepare() does?  Without waiting
for pll->updating to clear, the second write is issued while the ~60 us
update from setting pll->bypass is still in progress, and the function
returns before the PLL finishes powering down.

[ ... ]

> +static void __init ath79_clk_early_init(struct device_node *np)
> +{
> +	const struct ath79_clk_soc_data *soc;
> +	unsigned long rates[ATH79_OUT_NUM];
> +	struct ath79_clk_regs regs = {};
> +	struct clk_hw *ref, *cpu;
> +	struct clk *ref_clk;
> +	int ret, i;
> +
> +	soc = of_match_node(ath79_clk_of_match, np)->data;
> +
> +	/*
> +	 * The board's crystal. Old device trees leave its rate out, and the
> +	 * arch code then registers it from the bootstrap pins as "ref".
> +	 */
> +	ref_clk = of_clk_get_by_name(np, "ref");
> +	if (IS_ERR(ref_clk))
> +		ref_clk = clk_get_sys(NULL, "ref");

[ ... ]

> +static int ath79_clk_probe(struct platform_device *pdev)
> +{

[Severity: Medium]
Does fw_devlink permanently block ath79_clk_probe() with -EPROBE_DEFER on
device trees where the "ref" fixed-clock node omits clock-frequency?

When the "ref" node has no clock-frequency property, _of_fixed_clk_setup()
fails with -EIO before of_clk_add_hw_provider() can mark its fwnode
initialized, while of_clk_init() still sets OF_POPULATED on the node so no
platform device is created for it.  Because the PLL node has clocks =
<&ref>, fw_devlink creates a fwnode_link to the uninitialized "ref" node,
and device_links_check_suppliers() rejects probing ath79_clk_driver with
-EPROBE_DEFER, leaving the DDR, AHB, MDIO, UART1 and PCIe clocks
permanently at ERR_PTR(-EPROBE_DEFER).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110013646.1582970-1-rosenp@gmail.com?part=5

  reply	other threads:[~2026-11-10  1:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  1:36 [PATCH v2 0/6] clk: add a driver for the ath79 PLL controller Rosen Penev
2026-11-10  1:36 ` [PATCH v2 1/6] MIPS: ath79: apply the QCA956x timer workaround in setup Rosen Penev
2026-11-10  1:36 ` [PATCH v2 2/6] MIPS: ath79: move the bootstrap reference clock to setup Rosen Penev
2026-11-10  1:54   ` sashiko-bot
2026-11-10  1:36 ` [PATCH v2 3/6] dt-bindings: clock: ath79: add the UART1 clock Rosen Penev
2026-11-10 13:25   ` Krzysztof Kozlowski
2026-11-10 23:37     ` Rosen Penev
2026-11-10  1:36 ` [PATCH v2 4/6] dt-bindings: clock: ath79: add the PCIe PLL clock Rosen Penev
2026-11-10 13:26   ` Krzysztof Kozlowski
2026-11-10  1:36 ` [PATCH v2 5/6] clk: add a driver for the Atheros/Qualcomm ath79 PLL controller Rosen Penev
2026-11-10  1:59   ` sashiko-bot [this message]
2026-11-10  1:36 ` [PATCH v2 6/6] MIPS: ath79: remove the old clock code Rosen Penev
2026-11-10  2:25 ` [PATCH v2 0/6] clk: add a driver for the ath79 PLL controller Brian Masney
2026-11-10  2:35   ` Rosen Penev
2026-11-10  2:54     ` Brian Masney
2026-11-10 20:47       ` Rosen Penev

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=sashiko-outbox-206010@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=rosenp@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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