Commit 48d5eb61 authored by Chen-Yu Tsai's avatar Chen-Yu Tsai

clk: sunxi-ng: h3: gate then ungate PLL CPU clk after rate change

This patch utilizes the new PLL clk notifier to gate then ungate the
PLL CPU clock after rate changes. This should prevent any system hangs
resulting from cpufreq changes to the clk.
Reported-by: default avatarOndrej Jirman <megous@megous.com>
Fixes: 0577e485 ("clk: sunxi-ng: Add H3 clocks")
Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
Tested-by: default avatarIcenowy Zheng <icenowy@aosc.io>
Acked-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 1d42460a
...@@ -1103,6 +1103,13 @@ static const struct sunxi_ccu_desc sun50i_h5_ccu_desc = { ...@@ -1103,6 +1103,13 @@ static const struct sunxi_ccu_desc sun50i_h5_ccu_desc = {
.num_resets = ARRAY_SIZE(sun50i_h5_ccu_resets), .num_resets = ARRAY_SIZE(sun50i_h5_ccu_resets),
}; };
static struct ccu_pll_nb sun8i_h3_pll_cpu_nb = {
.common = &pll_cpux_clk.common,
/* copy from pll_cpux_clk */
.enable = BIT(31),
.lock = BIT(28),
};
static struct ccu_mux_nb sun8i_h3_cpu_nb = { static struct ccu_mux_nb sun8i_h3_cpu_nb = {
.common = &cpux_clk.common, .common = &cpux_clk.common,
.cm = &cpux_clk.mux, .cm = &cpux_clk.mux,
...@@ -1130,6 +1137,10 @@ static void __init sunxi_h3_h5_ccu_init(struct device_node *node, ...@@ -1130,6 +1137,10 @@ static void __init sunxi_h3_h5_ccu_init(struct device_node *node,
sunxi_ccu_probe(node, reg, desc); sunxi_ccu_probe(node, reg, desc);
/* Gate then ungate PLL CPU after any rate changes */
ccu_pll_notifier_register(&sun8i_h3_pll_cpu_nb);
/* Reparent CPU during PLL CPU rate changes */
ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk, ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk,
&sun8i_h3_cpu_nb); &sun8i_h3_cpu_nb);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment