Skip to content

Implement CPU frequency scaling for TH1520

Yao Zi linux-clk linux-devicetree linux-riscv lkml 1 version Applied

Status from this message: Applied to thead-clk-for-next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 14 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/7dt-bindings: clock: thead,th1520-clk-ap: Add ID for C910 bus clockinclude/dt-bindings/clock/thead,th1520-clk-ap.h+1 -01 reply
2/7clk: thead: th1520-ap: Poll for PLL lock and wait for stabilitydrivers/clk/thead/clk-th1520-ap.c+32 -25 replies
3/7clk: thead: th1520-ap: Add C910 bus clockdrivers/clk/thead/clk-th1520-ap.c+16 -11 reply
4/7clk: thead: th1520-ap: Support setting PLL ratesdrivers/clk/thead/clk-th1520-ap.c+142 -01 reply
5/7clk: thead: th1520-ap: Add macro to define multiplexers with flagsdrivers/clk/thead/clk-th1520-ap.c+7 -23 replies
6/7clk: thead: th1520-ap: Support CPU frequency scalingdrivers/clk/thead/clk-th1520-ap.c+146 -21 reply
7/7riscv: dts: thead: Add CPU clock and OPP table for TH1520arch/riscv/boot/dts/thead/th1520.dtsi+35 -00 replies

Reviews trailers per patch

6 of 7 patches have a Reviewed-by or Acked-by.

PatchConor DooleyDrew Fustini
1/7A-b
2/7R-b
3/7R-b
4/7R-b
5/7R-b
6/7R-b
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/7] Implement CPU frequency scaling for TH1520

On TH1520 SoC, c910_clk feeds the CPU cluster. It could be glitchlessly reparented to one of the two PLLs: either to cpu_pll0 indirectly through c910_i0_clk, or to cpu_pll1 directly. This series fixes a bug in PLL enabling code, supports rate change for PLL, and finally implements frequency scaling support for c910_clk.

However, to achieve reliable frequency scaling, CPU voltage must be adjusted together with frequency, and AON-firmware-based PMIC support for TH1520 SoC is still missing in mainline. Thus PATCH 7 that fills OPP table for TH1520 CPU and enables CPUfreq is only for testing purpose, not intended for upstream (yet).

Testing is done on Lichee Pi 4A board, only operating points safe to be used with the the default PMIC configuration are enabled in devicetree. I've confirmed there's a performance gain when running coremark and some building work compared to the case without cpufreq.

This series is based on next-20251120, thanks for your time and review.

Yao Zi (7):
dt-bindings: clock: thead,th1520-clk-ap: Add ID for C910 bus clock
clk: thead: th1520-ap: Poll for PLL lock and wait for stability
clk: thead: th1520-ap: Add C910 bus clock
clk: thead: th1520-ap: Support setting PLL rates
clk: thead: th1520-ap: Add macro to define multiplexers with flags
clk: thead: th1520-ap: Support CPU frequency scaling
[Not For Upstream] riscv: dts: thead: Add CPU clock and OPP table for

    TH1520
 arch/riscv/boot/dts/thead/th1520.dtsi         |  35 ++
 drivers/clk/thead/clk-th1520-ap.c             | 350 +++++++++++++++++-
 .../dt-bindings/clock/thead,th1520-clk-ap.h   |   1 +
 3 files changed, 379 insertions(+), 7 deletions(-)
Signature · 1 line
2.51.2