Skip to content

Commit a43c964

Browse files
Ondrej Jirmanmripard
authored andcommitted
clk: sunxi-ng: fix PLL_CPUX adjusting on H3
When adjusting PLL_CPUX on H3, the PLL is temporarily driven too high, and the system becomes unstable (oopses or hangs). Add a notifier to avoid this situation by temporarily switching to a known stable 24 MHz oscillator. Signed-off-by: Ondrej Jirman <megous@megous.com> Tested-by: Lutz Sammer <johns98@gmx.net> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
1 parent 7ce7d89 commit a43c964

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/clk/sunxi-ng/ccu-sun8i-h3.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,13 @@ static const struct sunxi_ccu_desc sun8i_h3_ccu_desc = {
803803
.num_resets = ARRAY_SIZE(sun8i_h3_ccu_resets),
804804
};
805805

806+
static struct ccu_mux_nb sun8i_h3_cpu_nb = {
807+
.common = &cpux_clk.common,
808+
.cm = &cpux_clk.mux,
809+
.delay_us = 1, /* > 8 clock cycles at 24 MHz */
810+
.bypass_index = 1, /* index of 24 MHz oscillator */
811+
};
812+
806813
static void __init sun8i_h3_ccu_setup(struct device_node *node)
807814
{
808815
void __iomem *reg;
@@ -821,6 +828,9 @@ static void __init sun8i_h3_ccu_setup(struct device_node *node)
821828
writel(val | (3 << 16), reg + SUN8I_H3_PLL_AUDIO_REG);
822829

823830
sunxi_ccu_probe(node, reg, &sun8i_h3_ccu_desc);
831+
832+
ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk,
833+
&sun8i_h3_cpu_nb);
824834
}
825835
CLK_OF_DECLARE(sun8i_h3_ccu, "allwinner,sun8i-h3-ccu",
826836
sun8i_h3_ccu_setup);

0 commit comments

Comments
 (0)