Improvements to the recent clock rework by marex.
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 3 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | clk: clk_resolve_parent_clk(): resolve external clocks by iddrivers/ | +6 | 2 replies | |
| 2/2 | clk: exynos: do not reparent requested clockdrivers/ | +0 | 1 reply |
Reviews trailers per patch
None of the 2 patches has a Reviewed-by or Acked-by.
| Patch | Kaustabh Chakraborty |
|---|---|
| 1/2 | T-b |
| 2/2 | T-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/2] Improvements to the recent clock rework by marex.
Symptoms:
I ran into an issue with the generic ccf_clk_divider clock driver. ccf_clk_divider assumes that the pointer passed to clk_divider_recalc_rate() (https://github.com/u-boot/u-boot/blob/master/drivers/clk/clk-divider.c#L80) is the same that was kzalloc()'d during clock registration. This assumption was breaking when calling clk_get_rate() on a clock retrieved via clk_get_by_index(), since clk_get_by_index() returns a copy of struct clk rather than the original pointer. For example, in https://github.com/u-boot/u-boot/blob/master/drivers/serial/serial_s5p.c#L131 the serial driver retrieves a clock using clk_get_by_index(), and then indirectly passes a pointer to stack-allocated struct clk to clk_divider_recalc_rate(), which breaks the ccf_clk_divider driver.
Description:
The Clock API relies on the fact that you call it's functions with a pointer to the kzalloc()'d struct clk, and not a copy of it. To ensure this, existing clock drivers use ccf_clk_get_rate() and clk_get_by_id().
The clock rework path missed this fact, and instead was returning names and pointers for the root device.
Testing:
I tested this on Samsung S10 (exynos9820 SoC) with a custom clock driver and a device tree. Unfortunately, I don't own any other exynos devices supported by u-boot.
chiffathefox (2):
clk: clk_resolve_parent_clk(): resolve external clocks by id
clk: exynos: do not reparent requested clock
drivers/clk/clk-uclass.c | 7 ++++++- drivers/clk/exynos/clk.c | 1 - 2 files changed, 6 insertions(+), 2 deletions(-)
Signature · 4 lines
2.34.1 base-commit: d503633a36767d756c7de28305cf0de79440cbc0 branch: clk-rework-improvements