Message ID | 20240726120309.150180-1-fido_max@inbox.ru |
---|---|
State | Deferred |
Delegated to: | Sean Anderson |
Headers | show |
Series | [1/1] clk: fix clk_enable() parent enable | expand |
26.07.2024 15:03, Maxim Kochetkov wrote: > Move clkp->enable_count++ after clk_enable(clkp->dev->parent). > It allows the parent clock increment its enable counters for proper > disable sequence. > > Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru> > --- Please ignore this patch. Clock enable/disable sequence is the same as in linux.
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index c48a62ba09..d56001c0b7 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -618,10 +618,6 @@ int clk_enable(struct clk *clk) /* Take id 0 as a non-valid clk, such as dummy */ if (clk->id && !clk_get_by_id(clk->id, &clkp)) { ops = clk_dev_ops(clkp->dev); - if (clkp->enable_count) { - clkp->enable_count++; - return 0; - } if (clkp->dev->parent && device_get_uclass_id(clkp->dev->parent) == UCLASS_CLK) { ret = clk_enable(dev_get_clk_ptr(clkp->dev->parent)); @@ -631,6 +627,11 @@ int clk_enable(struct clk *clk) return ret; } } + + if (clkp->enable_count) { + clkp->enable_count++; + return 0; + } } if (ops->enable) {
Move clkp->enable_count++ after clk_enable(clkp->dev->parent). It allows the parent clock increment its enable counters for proper disable sequence. Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru> --- drivers/clk/clk-uclass.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)