[PATCH] clk: rockchip: rk3576: create proper platform device

From: Sebastian Reichel

Date: Wed Nov 11 2026 - 21:38:13 EST


When RK3576 clock controller support was upstreamed, it copied the
vendor kernel's logic. That code makes no sense as it contains a
bunch of unused code (clk_rk3576_probe is never called as the DT
node is already initialized; if it would be called, the clock tree
would be registered twice).

Let's switch the driver to use the same style as RK3588: Continue to
initialize the clock tree early via rk3576_clk_init executed by
CLK_OF_DECLARE_DRIVER before the device model is initialized, but
don't mark the DT node as processed.

Later the device driver is probed for the DT node and registers the
resets as well as the restart handler. It also officially becomes
responsible for the DT node, which fixes all device link messages for
power-domains with a clock phandle:

Failed to create device link (0x180) with supplier soc for <device node>

Note that the supplier is 'soc' here, because there is no device for
the clock-controller before this change.

Ideally at some point we move the clock tree registration to the
device driver and get rid of the early init completely, but the
upstream kernel is not yet ready for it on the Rockchip platform.
This gets us at least in the right direction.

Fixes: cc40f5baa91b ("clk: rockchip: Add clock controller for the RK3576")
Signed-off-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>
---
That's 16 scary looking error messages less printed during boot on that
platform while reducing lines of code and modernizing the driver :)
---
drivers/clk/rockchip/clk-rk3576.c | 39 ++++++++++++++++++---------------------
1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3576.c b/drivers/clk/rockchip/clk-rk3576.c
index 2cdd667f4004..577100659593 100644
--- a/drivers/clk/rockchip/clk-rk3576.c
+++ b/drivers/clk/rockchip/clk-rk3576.c
@@ -1733,6 +1733,8 @@ static struct rockchip_clk_branch rk3576_clk_branches[] __initdata = {
RK3576_CLKGATE_CON(59), 5, GFLAGS),
};

+static struct rockchip_clk_provider *rk3576_early_ctx;
+
static void __init rk3576_clk_init(struct device_node *np)
{
struct rockchip_clk_provider *ctx;
@@ -1802,12 +1804,10 @@ static void __init rk3576_clk_init(struct device_node *np)
rockchip_clk_register_branches(ctx, rk3576_clk_branches,
ARRAY_SIZE(rk3576_clk_branches));

- rk3576_rst_init(np, reg_base);
-
- rockchip_register_restart_notifier(ctx, RK3576_GLB_SRST_FST, NULL);
-
rockchip_clk_of_add_provider(np, ctx);

+ rk3576_early_ctx = ctx;
+
return;

err_free_pmu0:
@@ -1817,35 +1817,27 @@ static void __init rk3576_clk_init(struct device_node *np)
return;
}

-CLK_OF_DECLARE(rk3576_cru, "rockchip,rk3576-cru", rk3576_clk_init);
-
-struct clk_rk3576_inits {
- void (*inits)(struct device_node *np);
-};
-
-static const struct clk_rk3576_inits clk_rk3576_cru_init = {
- .inits = rk3576_clk_init,
-};
+CLK_OF_DECLARE_DRIVER(rk3576_cru, "rockchip,rk3576-cru", rk3576_clk_init);

static const struct of_device_id clk_rk3576_match_table[] = {
{
.compatible = "rockchip,rk3576-cru",
- .data = &clk_rk3576_cru_init,
},
{ }
};

static int clk_rk3576_probe(struct platform_device *pdev)
{
- const struct clk_rk3576_inits *init_data;
+ struct rockchip_clk_provider *ctx = rk3576_early_ctx;
struct device *dev = &pdev->dev;
+ struct device_node *np = dev->of_node;

- init_data = device_get_match_data(dev);
- if (!init_data)
- return -EINVAL;
+ if (!ctx)
+ return -ENODEV;

- if (init_data->inits)
- init_data->inits(dev->of_node);
+ rk3576_rst_init(np, ctx->reg_base);
+
+ rockchip_register_restart_notifier(ctx, RK3576_GLB_SRST_FST, NULL);

return 0;
}
@@ -1858,4 +1850,9 @@ static struct platform_driver clk_rk3576_driver = {
.suppress_bind_attrs = true,
},
};
-builtin_platform_driver_probe(clk_rk3576_driver, clk_rk3576_probe);
+
+static int __init rockchip_clk_rk3576_drv_register(void)
+{
+ return platform_driver_register(&clk_rk3576_driver);
+}
+core_initcall(rockchip_clk_rk3576_drv_register);

---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261112-rk3576-clk-platform-device-12af20579b2f

Best regards,
--
Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>