Skip to content

Commit 31ab516

Browse files
Andre-ARMjernejsk
authored andcommitted
clk: sunxi-ng: h616: Add PLL derived 32KHz clock
The RTC section of the H616 manual mentions in a half-sentence the existence of a clock "32K divided by PLL_PERI(2X)". This is used as one of the possible inputs for the mux that selects the clock for the 32 KHz fanout pad. On the H616 this is routed to pin PG10, and some boards use that clock output to compensate for a missing 32KHz crystal. On the OrangePi Zero2 this is for instance connected to the LPO pin of the WiFi/BT chip. The new RTC clock binding requires this clock to be named as one input clock, so we need to expose this to the DT. In contrast to the D1 SoC there does not seem to be a gate for this clock, so just use a fixed divider clock, using a newly assigned clock number. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://lore.kernel.org/r/20220428230933.15262-3-andre.przywara@arm.com
1 parent 38d321b commit 31ab516

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

drivers/clk/sunxi-ng/ccu-sun50i-h616.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,13 @@ static CLK_FIXED_FACTOR_HWS(pll_periph0_2x_clk, "pll-periph0-2x",
704704
pll_periph0_parents,
705705
1, 2, 0);
706706

707+
static const struct clk_hw *pll_periph0_2x_hws[] = {
708+
&pll_periph0_2x_clk.hw
709+
};
710+
711+
static CLK_FIXED_FACTOR_HWS(pll_system_32k_clk, "pll-system-32k",
712+
pll_periph0_2x_hws, 36621, 1, 0);
713+
707714
static const struct clk_hw *pll_periph1_parents[] = {
708715
&pll_periph1_clk.common.hw
709716
};
@@ -852,6 +859,7 @@ static struct clk_hw_onecell_data sun50i_h616_hw_clks = {
852859
[CLK_PLL_DDR1] = &pll_ddr1_clk.common.hw,
853860
[CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw,
854861
[CLK_PLL_PERIPH0_2X] = &pll_periph0_2x_clk.hw,
862+
[CLK_PLL_SYSTEM_32K] = &pll_system_32k_clk.hw,
855863
[CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw,
856864
[CLK_PLL_PERIPH1_2X] = &pll_periph1_2x_clk.hw,
857865
[CLK_PLL_GPU] = &pll_gpu_clk.common.hw,

drivers/clk/sunxi-ng/ccu-sun50i-h616.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@
5151

5252
#define CLK_BUS_DRAM 56
5353

54-
#define CLK_NUMBER (CLK_BUS_HDCP + 1)
54+
#define CLK_NUMBER (CLK_PLL_SYSTEM_32K + 1)
5555

5656
#endif /* _CCU_SUN50I_H616_H_ */

include/dt-bindings/clock/sun50i-h616-ccu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,6 @@
111111
#define CLK_BUS_TVE0 125
112112
#define CLK_HDCP 126
113113
#define CLK_BUS_HDCP 127
114+
#define CLK_PLL_SYSTEM_32K 128
114115

115116
#endif /* _DT_BINDINGS_CLK_SUN50I_H616_H_ */

0 commit comments

Comments
 (0)