From: sashiko-bot@kernel.org
To: "Joseph Telaak" <joseph@telaak.dev>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 2/4] clk: siflower: Add SF19A2890 clock manager driver
Date: Mon, 23 Nov 2026 01:57:39 +0000 [thread overview]
Message-ID: <sashiko-outbox-228538@kernel.org> (raw)
In-Reply-To: <20261122-sf19a2890-sysm-v4-2-bbfe1c495e2e@telaak.dev>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] clk: siflower: missing provider update in
sf19a2890_clk_probe()
- [Low] clk: siflower: Kconfig depends on undefined MACH_SIFLOWER_MIPS
--
commit 9f005e02da5b51c2e50e528140d38bbfbcf12e37
Author: Chuanhong Guo <gch981213@gmail.com>
clk: siflower: Add SF19A2890 clock manager driver
This commit adds a clock manager driver for the Siflower SF19A2890 SoC,
registering the CPU clock and its PLLs early via CLK_OF_DECLARE_DRIVER
and the remaining muxdiv clocks from a platform driver.
> diff --git a/drivers/clk/siflower/Kconfig b/drivers/clk/siflower/Kconfig
> new file mode 100644
> index 0000000000000..ad1b04b4bb9b2
> --- /dev/null
> +++ b/drivers/clk/siflower/Kconfig
> @@ -0,0 +1,11 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +config CLK_SF19A2890
> + bool "Clock driver for Siflower SF19A2890"
> + depends on MACH_SIFLOWER_MIPS || COMPILE_TEST
> + default MACH_SIFLOWER_MIPS
[Severity: Low]
Is MACH_SIFLOWER_MIPS defined in the tree? Without it, CLK_SF19A2890
can only be enabled when COMPILE_TEST is set and defaults to n.
> diff --git a/drivers/clk/siflower/clk-sf19a2890.c b/drivers/clk/siflower/clk-sf19a2890.c
> new file mode 100644
> index 0000000000000..4dad8f65eb4b9
> --- /dev/null
> +++ b/drivers/clk/siflower/clk-sf19a2890.c
[ ... ]
> +static void __init sf19a2890_clk_early_init(struct device_node *node)
> +{
> + struct clk_hw_onecell_data *data;
> + void __iomem *base;
> + unsigned int i;
> + int ret;
> +
> + data = kzalloc_flex(*data, hws, CLK_SF19A2890_NR_CLKS);
> + if (!data)
> + return;
> +
> + data->num = CLK_SF19A2890_NR_CLKS;
> + /* The clocks registered at probe defer until then */
> + for (i = 0; i < data->num; i++)
> + data->hws[i] = ERR_PTR(-EPROBE_DEFER);
> +
> + base = of_iomap(node, 0);
> + if (!base) {
> + pr_err("failed to map the registers\n");
> + goto err_free;
> + }
> +
> + for (i = 0; i < ARRAY_SIZE(sf19a2890_early_clks); i++) {
> + unsigned int id = sf19a2890_early_clks[i];
> + struct clk_hw *hw = sf19a2890_hws[id];
> +
> + hw_to_sf_clk_common(hw)->base = base;
> + ret = of_clk_hw_register(node, hw);
> + if (ret) {
> + pr_err("failed to register clock %u: %d\n", id, ret);
> + goto err_unregister;
> + }
> + data->hws[id] = hw;
> + }
> +
> + ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, data);
> + if (ret) {
> + pr_err("failed to add the clock provider: %d\n", ret);
> + goto err_unregister;
> + }
> +
> + sf19a2890_clk_data = data;
> + sf19a2890_clk_base = base;
> + return;
> +
> +err_unregister:
> + while (i--)
> + clk_hw_unregister(data->hws[sf19a2890_early_clks[i]]);
> + iounmap(base);
> +err_free:
> + kfree(data);
> +}
> +
> +CLK_OF_DECLARE_DRIVER(sf19a2890_clk, "siflower,sf19a2890-clk", sf19a2890_clk_early_init);
> +
> +static int sf19a2890_clk_probe(struct platform_device *pdev)
> +{
> + struct clk_hw_onecell_data *data = sf19a2890_clk_data;
> + struct device *dev = &pdev->dev;
> + unsigned int i;
> + int ret;
> +
> + if (!data)
> + return -ENODEV;
> +
> + for (i = 0; i < data->num; i++) {
> + struct clk_hw *hw = sf19a2890_hws[i];
> +
> + /* Registered early */
> + if (!IS_ERR(data->hws[i]))
> + continue;
> +
> + hw_to_sf_clk_common(hw)->base = sf19a2890_clk_base;
> + ret = devm_clk_hw_register(dev, hw);
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to register clock %u\n", i);
> + }
> +
> + /* Hand out the clocks only once they are all registered */
> + for (i = 0; i < data->num; i++)
> + data->hws[i] = sf19a2890_hws[i];
> +
> + return 0;
> +}
[Severity: Medium]
Can updating data->hws[] after the devm_clk_hw_register() loop leave
downstream clocks orphaned?
During each devm_clk_hw_register() call, __clk_core_init() runs
clk_core_reparent_orphans_nolock(), which queries the OF provider via
of_clk_hw_onecell_get() while data->hws[i] is still
ERR_PTR(-EPROBE_DEFER). Because the second loop populates data->hws[i]
without re-running orphan reparenting or of_clk_set_defaults(), any
downstream clock registered earlier that references one of the late
muxdiv clocks by DT phandle stays orphaned with rate 0.
In addition, of_clk_add_hw_provider() in sf19a2890_clk_early_init() runs
of_clk_set_defaults(node, true) while the 17 late slots hold
ERR_PTR(-EPROBE_DEFER), so an assigned-clocks property on the clock
controller node referencing any late clock causes
of_clk_add_hw_provider() to fail with -EPROBE_DEFER and unregister the
early CPU and PLL clocks.
Populating data->hws[i] before each devm_clk_hw_register() (or calling
of_clk_del_provider() and of_clk_add_hw_provider() once all clocks are
populated) would allow orphan reparenting and default clock assignments
to complete.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261122-sf19a2890-sysm-v4-0-bbfe1c495e2e@telaak.dev?part=2
next prev parent reply other threads:[~2026-11-23 1:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 1:40 [PATCH v4 0/4] clk: Add the Siflower SF19A2890 clock manager and peripheral clock and reset managers Joseph Telaak via B4 Relay
2026-11-23 1:40 ` Joseph Telaak
2026-11-23 1:40 ` [PATCH v4 1/4] dt-bindings: clock: Add Siflower SF19A2890 clock manager Joseph Telaak via B4 Relay
2026-11-23 1:40 ` Joseph Telaak
2026-11-23 1:40 ` [PATCH v4 2/4] clk: siflower: Add SF19A2890 clock manager driver Joseph Telaak via B4 Relay
2026-11-23 1:40 ` Joseph Telaak
2026-11-23 1:57 ` sashiko-bot [this message]
2026-11-23 4:08 ` Joseph Telaak
2026-11-23 16:39 ` Brian Masney
2026-11-23 1:40 ` [PATCH v4 3/4] dt-bindings: clock: Add Siflower SF19A2890 peripheral clock/reset managers Joseph Telaak via B4 Relay
2026-11-23 1:40 ` Joseph Telaak
2026-11-23 1:40 ` [PATCH v4 4/4] clk: siflower: Add SF19A2890 peripheral clock and reset manager driver Joseph Telaak via B4 Relay
2026-11-23 1:40 ` Joseph Telaak
2026-11-23 16:39 ` 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=sashiko-outbox-228538@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=joseph@telaak.dev \
--cc=linux-clk@vger.kernel.org \
--cc=robh@kernel.org \
--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 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.