Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 790d929b authored by Icenowy Zheng's avatar Icenowy Zheng Committed by Maxime Ripard
Browse files

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: default avatarIcenowy Zheng <icenowy@aosc.xyz>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
parent a43c9642
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -752,6 +752,13 @@ static const struct sunxi_ccu_desc sun8i_a33_ccu_desc = {
	.num_resets	= ARRAY_SIZE(sun8i_a33_ccu_resets),
	.num_resets	= ARRAY_SIZE(sun8i_a33_ccu_resets),
};
};


static struct ccu_mux_nb sun8i_a33_cpu_nb = {
	.common		= &cpux_clk.common,
	.cm		= &cpux_clk.mux,
	.delay_us	= 1, /* > 8 clock cycles at 24 MHz */
	.bypass_index	= 1, /* index of 24 MHz oscillator */
};

static void __init sun8i_a33_ccu_setup(struct device_node *node)
static void __init sun8i_a33_ccu_setup(struct device_node *node)
{
{
	void __iomem *reg;
	void __iomem *reg;
@@ -775,6 +782,9 @@ static void __init sun8i_a33_ccu_setup(struct device_node *node)
	writel(val, reg + SUN8I_A33_PLL_MIPI_REG);
	writel(val, reg + SUN8I_A33_PLL_MIPI_REG);


	sunxi_ccu_probe(node, reg, &sun8i_a33_ccu_desc);
	sunxi_ccu_probe(node, reg, &sun8i_a33_ccu_desc);

	ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk,
				  &sun8i_a33_cpu_nb);
}
}
CLK_OF_DECLARE(sun8i_a33_ccu, "allwinner,sun8i-a33-ccu",
CLK_OF_DECLARE(sun8i_a33_ccu, "allwinner,sun8i-a33-ccu",
	       sun8i_a33_ccu_setup);
	       sun8i_a33_ccu_setup);