Skip to content

Commit 790d929

Browse files
Icenowymripard
authored andcommitted
clk: sunxi-ng: fix PLL_CPUX adjusting on A33
When adjusting PLL_CPUX on A33, the PLL is temporarily driven too high, and the system hangs. Add a notifier to avoid this situation by temporarily switching to a known stable 24 MHz oscillator. Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
1 parent a43c964 commit 790d929

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,13 @@ static const struct sunxi_ccu_desc sun8i_a33_ccu_desc = {
752752
.num_resets = ARRAY_SIZE(sun8i_a33_ccu_resets),
753753
};
754754

755+
static struct ccu_mux_nb sun8i_a33_cpu_nb = {
756+
.common = &cpux_clk.common,
757+
.cm = &cpux_clk.mux,
758+
.delay_us = 1, /* > 8 clock cycles at 24 MHz */
759+
.bypass_index = 1, /* index of 24 MHz oscillator */
760+
};
761+
755762
static void __init sun8i_a33_ccu_setup(struct device_node *node)
756763
{
757764
void __iomem *reg;
@@ -775,6 +782,9 @@ static void __init sun8i_a33_ccu_setup(struct device_node *node)
775782
writel(val, reg + SUN8I_A33_PLL_MIPI_REG);
776783

777784
sunxi_ccu_probe(node, reg, &sun8i_a33_ccu_desc);
785+
786+
ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk,
787+
&sun8i_a33_cpu_nb);
778788
}
779789
CLK_OF_DECLARE(sun8i_a33_ccu, "allwinner,sun8i-a33-ccu",
780790
sun8i_a33_ccu_setup);

0 commit comments

Comments
 (0)