]> Gentwo Git Trees - linux/.git/commit
clk: loongson2: Support scale clocks with an alternative mode
authorYao Zi <ziyao@disroot.org>
Fri, 19 Sep 2025 14:26:44 +0000 (14:26 +0000)
committerStephen Boyd <sboyd@kernel.org>
Sun, 21 Sep 2025 19:48:46 +0000 (12:48 -0700)
commit897117e35e180bc3f7346424c8b885ddb57fddc6
treeb629401dac2ebb7180f8329ff28dcaf28370d917
parent499f81848ef3bdca53122e0c3758381f7cd40934
clk: loongson2: Support scale clocks with an alternative mode

LS2K0300 and LS2K1500 ship scale clocks with an alternative mode.
There's one mode bit in clock configuration register indicating the
operation mode.

When mode bit is unset, the scale clock acts the same as previous
generation of scale clocks. When it's set, a different equation for
calculating result frequency, Fout = Fin / (scale + 1), is used.

This patch adds frequency calculation support for the scale clock
variant. A helper macro, CLK_SCALE_MODE, is added to simplify
definitions.

Signed-off-by: Yao Zi <ziyao@disroot.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/clk-loongson2.c