Skip to content

clk: fix a bug in CCF which results in a clock being enabled twice.

Yang Xiwen b4-sent u-boot 1 version New

Get series with b4
b4 am [email protected] change-id 20230724-clk_fix-1b7265d663a8

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2clk: move clk_get_ops() to a common headerdrivers/clk/clk-uclass.c include/clk.h+17 -50 replies
2/2clk: ccf: invoke ops provided by clk directlydrivers/clk/clk.c+8 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] clk: fix a bug in CCF which results in a clock being enabled twice.

Currently, ccf_clk_endisable() calls clk_enable() / clk_disable() directly depending on the request. However, this function is also referenced in clk->ops, which is also called in clk_enable() / clk_disable().

This caused a recursion and made the clock enabled twice if clk_enable() is invoked. So we have to call clk_disable() twice to disable the clock. It can be easily reproduced with few extra lines of debug code.

Fix that by calling clk->ops->enable/disable directly in ccf_clk_endisable() rather than using the framework functions.

---
Yang Xiwen (2):
clk: move clk_get_ops() to a common header
clk: ccf: invoke ops provided by clk directly

 drivers/clk/clk-uclass.c |  5 -----
 drivers/clk/clk.c        | 10 ++++++++--
 include/clk.h            | 17 +++++++++++++++++
 3 files changed, 25 insertions(+), 7 deletions(-)

---
base-commit: 580eb31199be8a822e62f20965854a242f895d03
change-id: 20230724-clk_fix-1b7265d663a8

Best regards,

Signature · 1 line
Yang Xiwen <[email protected]>