]> www.infradead.org Git - users/jedix/linux-maple.git/commit
clk: spacemit: k1: Add TWSI8 bus and function clocks
authorHaylen Chu <heylenay@4d2.org>
Wed, 16 Apr 2025 13:54:04 +0000 (13:54 +0000)
committerYixun Lan <dlan@gentoo.org>
Wed, 16 Apr 2025 19:22:56 +0000 (03:22 +0800)
commit49625c6e4d90a9221127c49a11eb8c95732bb690
treed55ceb438055bbd99becb49d2e435898749eb02c
parent1b72c59db0add8e47fa116b21f78ed0b09a264f3
clk: spacemit: k1: Add TWSI8 bus and function clocks

The control register for TWSI8 clocks, APBC_TWSI8_CLK_RST, contains mux
selection bits, reset assertion bit and enable bits for function and bus
clocks. It has a quirk that reading always results in zero.

As a workaround, let's hardcode the mux value as zero to select
pll1_d78_31p5 as parent and treat twsi8_clk as a gate, whose enable mask
is combined from the real bus and function clocks to avoid the
write-only register being shared between two clk_hws, in which case
updates of one clk_hw zero the other's bits.

With a 1:1 factor serving as placeholder for the bus clock, the I2C-8
controller could be brought up, which is essential for boards attaching
power-management chips to it.

Signed-off-by: Haylen Chu <heylenay@4d2.org>
Reviewed-by: Alex Elder <elder@riscstar.com>
Reviewed-by: Yixun Lan <dlan@gentoo.org>
Link: https://lore.kernel.org/r/20250416135406.16284-5-heylenay@4d2.org
Signed-off-by: Yixun Lan <dlan@gentoo.org>
drivers/clk/spacemit/ccu-k1.c