]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
clk: samsung: Implement automatic clock gating mode for CMUs
authorPeter Griffin <peter.griffin@linaro.org>
Mon, 22 Dec 2025 10:22:14 +0000 (10:22 +0000)
committerKrzysztof Kozlowski <krzk@kernel.org>
Mon, 22 Dec 2025 11:42:54 +0000 (12:42 +0100)
commit298fac4f4b96448ce7ef8da525a74fd3dba0035d
tree73b8d202e5e4ae8792f5db77dc9cb892743d875a
parent2e8e9a2492edbbef54de6ab1c5bf1578ffef4c8c
clk: samsung: Implement automatic clock gating mode for CMUs

Update exynos_arm64_init_clocks() so that it enables the automatic clock
mode bits in the CMU option register if the auto_clock_gate flag and
option_offset fields are set for the CMU. To ensure compatibility with
older DTs (that specified an incorrect CMU reg size), detect this and
fallback to manual clock gate mode as the auto clock mode feature depends
on registers in this area.

The CMU option register bits are global and effect every clock component in
the CMU, as such clearing the GATE_ENABLE_HWACG bit and setting GATE_MANUAL
bit on every gate register is only required if auto_clock_gate is false.

Additionally if auto_clock_gate is enabled the dynamic root clock gating
and memclk registers will be configured in the corresponding CMUs sysreg
bank. These registers are exposed via syscon, so the register
samsung_clk_save/restore paths are updated to also take a regmap.

As many gates for various Samsung SoCs are already exposed in the Samsung
clock drivers a new samsung_auto_clk_gate_ops is implemented. This uses
some CMU debug registers to report whether clocks are enabled or disabled
when operating in automatic mode. This allows
/sys/kernel/debug/clk/clk_summary to still dump the entire clock tree and
correctly report the status of each clock in the system.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://patch.msgid.link/20251222-automatic-clocks-v7-3-fec86fa89874@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
drivers/clk/samsung/clk-exynos-arm64.c
drivers/clk/samsung/clk-exynos4.c
drivers/clk/samsung/clk-exynos4412-isp.c
drivers/clk/samsung/clk-exynos5250.c
drivers/clk/samsung/clk-exynos5420.c
drivers/clk/samsung/clk-s3c64xx.c
drivers/clk/samsung/clk-s5pv210.c
drivers/clk/samsung/clk.c
drivers/clk/samsung/clk.h