* [PATCH v1] clk: Only enable the parent clock if the clock was enabled before reparenting
@ 2025-08-29 8:25 bigunclemax
2025-09-01 12:10 ` Miquel Raynal
2025-12-04 19:31 ` Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: bigunclemax @ 2025-08-29 8:25 UTC (permalink / raw)
Cc: bigunclemax, Lukasz Majewski, Sean Anderson, Tom Rini,
Patrice Chotard, Patrick Delaunay, Miquel Raynal, Sam Protsenko,
Christian Marangi, Marek Vasut, Maxim Kochetkov, Jonas Karlman,
u-boot
From: Maksim Kiselev <bigunclemax@gmail.com>
The current implementation of clk_set_parent() unconditionally enables
the new parent clock, even if the target clock was not previously enabled.
To avoid this implicit behavior, this patch adds a check for whether
the target clock has been enabled before parent enabling..
Fixes: ac30d90f336 ("clk: Ensure the parent clocks are enabled while reparenting")
Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>
---
drivers/clk/clk-uclass.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 4f35b90382f..0f6bf3e02ed 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -631,10 +631,12 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
if (!ops->set_parent)
return -ENOSYS;
- ret = clk_enable(parent);
- if (ret && ret != -ENOSYS) {
- printf("Cannot enable parent %s\n", parent->dev->name);
- return ret;
+ if (clk->enable_count) {
+ ret = clk_enable(parent);
+ if (ret && ret != -ENOSYS) {
+ printf("Cannot enable parent %s\n", parent->dev->name);
+ return ret;
+ }
}
ret = ops->set_parent(clk, parent);
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] clk: Only enable the parent clock if the clock was enabled before reparenting
2025-08-29 8:25 [PATCH v1] clk: Only enable the parent clock if the clock was enabled before reparenting bigunclemax
@ 2025-09-01 12:10 ` Miquel Raynal
2025-12-04 19:31 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2025-09-01 12:10 UTC (permalink / raw)
To: bigunclemax
Cc: Lukasz Majewski, Sean Anderson, Tom Rini, Patrice Chotard,
Patrick Delaunay, Sam Protsenko, Christian Marangi, Marek Vasut,
Maxim Kochetkov, Jonas Karlman, u-boot
Hi,
On 29/08/2025 at 11:25:00 +03, bigunclemax@gmail.com wrote:
> From: Maksim Kiselev <bigunclemax@gmail.com>
>
> The current implementation of clk_set_parent() unconditionally enables
> the new parent clock, even if the target clock was not previously enabled.
>
> To avoid this implicit behavior, this patch adds a check for whether
> the target clock has been enabled before parent enabling..
>
> Fixes: ac30d90f336 ("clk: Ensure the parent clocks are enabled while reparenting")
> Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>
It took me a bit of time to understand your issue, but that sounds
legitimate indeed.
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] clk: Only enable the parent clock if the clock was enabled before reparenting
2025-08-29 8:25 [PATCH v1] clk: Only enable the parent clock if the clock was enabled before reparenting bigunclemax
2025-09-01 12:10 ` Miquel Raynal
@ 2025-12-04 19:31 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2025-12-04 19:31 UTC (permalink / raw)
To: bigunclemax
Cc: Lukasz Majewski, Sean Anderson, Patrice Chotard, Patrick Delaunay,
Miquel Raynal, Sam Protsenko, Christian Marangi, Marek Vasut,
Maxim Kochetkov, Jonas Karlman, u-boot
On Fri, 29 Aug 2025 11:25:00 +0300, bigunclemax@gmail.com wrote:
> The current implementation of clk_set_parent() unconditionally enables
> the new parent clock, even if the target clock was not previously enabled.
>
> To avoid this implicit behavior, this patch adds a check for whether
> the target clock has been enabled before parent enabling..
>
>
> [...]
Applied to u-boot/next, thanks!
[1/1] clk: Only enable the parent clock if the clock was enabled before reparenting
commit: b493db39ea7fb1205d3a2df269352cb79874c1c7
--
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-04 19:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 8:25 [PATCH v1] clk: Only enable the parent clock if the clock was enabled before reparenting bigunclemax
2025-09-01 12:10 ` Miquel Raynal
2025-12-04 19:31 ` Tom Rini
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.