clk: thead: th1520-ap: Describe mux clocks with clk_mux
authorYao Zi <ziyao@disroot.org>
Tue, 22 Jul 2025 08:05:36 +0000 (08:05 +0000)
committerDrew Fustini <fustini@kernel.org>
Tue, 22 Jul 2025 22:40:54 +0000 (15:40 -0700)
commit54edba916e2913b0893b0f6404b73155d48374ea
tree03b092ca04d15fda4dd0987bafad66a64a720699
parentd274c77ffa202b70ad01d579f33b73b4de123375
clk: thead: th1520-ap: Describe mux clocks with clk_mux

Mux clocks are now described with a customized ccu_mux structure
consisting of ccu_internal and ccu_common substructures, and registered
later with devm_clk_hw_register_mux_parent_data_table(). As this helper
always allocates a new clk_hw structure, it's extremely hard to use mux
clocks as parents statically by clk_hw pointers, since CCF has no
knowledge about the clk_hw structure embedded in ccu_mux.

This scheme already causes issues for clock c910, which takes a mux
clock, c910-i0, as a possible parent. With mainline U-Boot that
reparents c910 to c910-i0 at boottime, c910 is considered as an orphan
by CCF.

This patch refactors handling of mux clocks, embeds a clk_mux structure
in ccu_mux directly. Instead of calling devm_clk_hw_register_mux_*(),
we could register mux clocks on our own without allocating any new
clk_hw pointer, fixing c910 clock's issue.

Fixes: ae81b69fd2b1 ("clk: thead: Add support for T-Head TH1520 AP_SUBSYS clocks")
Signed-off-by: Yao Zi <ziyao@disroot.org>
Signed-off-by: Drew Fustini <fustini@kernel.org>
drivers/clk/thead/clk-th1520-ap.c