* [PATCH] clk: rp1: allow the clock provider to be probed again
@ 2026-11-21 16:39 Joshua Covington
0 siblings, 0 replies; only message in thread
From: Joshua Covington @ 2026-11-21 16:39 UTC (permalink / raw)
To: Stephen Boyd
Cc: Brian Masney, Jerome Brunet, Andrea della Porta, linux-clk,
linux-rpi-kernel, linux-kernel, Joshua Covington
The clock descriptors are static and are registered directly. The
clock framework clears hw.init once a clock has been registered, so
when the RP1 device is unbound and bound again, the second probe
registers clocks without init data and oopses:
pc : __clk_register+0x5c/0x9dc
Call trace:
__clk_register+0x5c/0x9dc (P)
devm_clk_hw_register+0x5c/0xe0
rp1_register_pll+0x24/0x40
rp1_clk_probe+0xc0/0x168
Keep the init data of each descriptor and restore it before the clock
is registered.
Fixes: 6486341721a2 ("clk: rp1: Add support for clocks provided by RP1")
Signed-off-by: Joshua Covington <joshuacov@gmail.com>
---
Tested on a Raspberry Pi CM5 with 6.18.64 and the Raspberry Pi
downstream patches, where binding rp1_pci again after unbinding it hit
this. Applies unchanged to v7.4-rc3 and builds there without warnings.
drivers/clk/clk-rp1.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/clk-rp1.c b/drivers/clk/clk-rp1.c
index 1dd276dd2..5c3929e93 100644
--- a/drivers/clk/clk-rp1.c
+++ b/drivers/clk/clk-rp1.c
@@ -363,6 +363,7 @@ struct rp1_clk_desc {
struct rp1_clk_desc *desc);
const void *data;
struct clk_hw hw;
+ const struct clk_init_data *init;
struct rp1_clockman *clockman;
unsigned long cached_rate;
struct clk_divider div;
@@ -2418,8 +2419,15 @@ static int rp1_clk_probe(struct platform_device *pdev)
for (i = 0; i < asize; i++) {
desc = clk_desc_array[i];
- if (desc && desc->clk_register && desc->data)
- hws[i] = desc->clk_register(clockman, desc);
+ if (!desc || !desc->clk_register || !desc->data)
+ continue;
+
+ /* The clock core clears hw.init of these static descriptors */
+ if (!desc->init)
+ desc->init = desc->hw.init;
+ desc->hw.init = desc->init;
+
+ hws[i] = desc->clk_register(clockman, desc);
}
clk_audio_core = &pll_audio_core_desc;
--
2.56.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-21 16:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-21 16:39 [PATCH] clk: rp1: allow the clock provider to be probed again Joshua Covington
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®