summaryrefslogtreecommitdiffstats
path: root/drivers/clk/sunxi-ng
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2017-07-23 06:27:44 -0400
committerChen-Yu Tsai <wens@csie.org>2017-08-04 00:05:20 -0400
commit48d5eb619c15847aba6757deb5c2c8badca2aece (patch)
tree1ee0062ccdb17d96195707cd3fbe1761269068b8 /drivers/clk/sunxi-ng
parent1d42460a49347af4d1db345197e5d1277336b312 (diff)
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: Ondrej Jirman <megous@megous.com> Fixes: 0577e4853bfb ("clk: sunxi-ng: Add H3 clocks") Signed-off-by: Chen-Yu Tsai <wens@csie.org> Tested-by: Icenowy Zheng <icenowy@aosc.io> Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/sunxi-ng')
-rw-r--r--drivers/clk/sunxi-ng/ccu-sun8i-h3.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
index 62e4f0d2b2fc..406d0aac9fd6 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
@@ -1103,6 +1103,13 @@ static const struct sunxi_ccu_desc sun50i_h5_ccu_desc = {
1103 .num_resets = ARRAY_SIZE(sun50i_h5_ccu_resets), 1103 .num_resets = ARRAY_SIZE(sun50i_h5_ccu_resets),
1104}; 1104};
1105 1105
1106static struct ccu_pll_nb sun8i_h3_pll_cpu_nb = {
1107 .common = &pll_cpux_clk.common,
1108 /* copy from pll_cpux_clk */
1109 .enable = BIT(31),
1110 .lock = BIT(28),
1111};
1112
1106static struct ccu_mux_nb sun8i_h3_cpu_nb = { 1113static struct ccu_mux_nb sun8i_h3_cpu_nb = {
1107 .common = &cpux_clk.common, 1114 .common = &cpux_clk.common,
1108 .cm = &cpux_clk.mux, 1115 .cm = &cpux_clk.mux,
@@ -1130,6 +1137,10 @@ static void __init sunxi_h3_h5_ccu_init(struct device_node *node,
1130 1137
1131 sunxi_ccu_probe(node, reg, desc); 1138 sunxi_ccu_probe(node, reg, desc);
1132 1139
1140 /* Gate then ungate PLL CPU after any rate changes */
1141 ccu_pll_notifier_register(&sun8i_h3_pll_cpu_nb);
1142
1143 /* Reparent CPU during PLL CPU rate changes */
1133 ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk, 1144 ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk,
1134 &sun8i_h3_cpu_nb); 1145 &sun8i_h3_cpu_nb);
1135} 1146}