Return-Path: Received: from omzsmtpe01.verizonbusiness.com ([199.249.25.210]:41687 "EHLO omzsmtpe01.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751913AbdKVWYV (ORCPT ); Wed, 22 Nov 2017 17:24:21 -0500 From: alexander.levin@verizon.com Cc: Icenowy Zheng , Maxime Ripard , alexander.levin@verizon.com To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 08/56] clk: sunxi-ng: fix PLL_CPUX adjusting on A33 Date: Wed, 22 Nov 2017 22:23:27 +0000 Message-ID: <20171122222246.19618-15-alexander.levin@verizon.com> References: <20171122222246.19618-1-alexander.levin@verizon.com> In-Reply-To: <20171122222246.19618-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Icenowy Zheng [ Upstream commit 790d929b540661945d1c70652ffb602c5c06ad85 ] 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 Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin --- drivers/clk/sunxi-ng/ccu-sun8i-a33.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c b/drivers/clk/sunxi-ng/cc= u-sun8i-a33.c index 9bd1f78a0547..e1dc4e5b34e1 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c @@ -752,6 +752,13 @@ static const struct sunxi_ccu_desc sun8i_a33_ccu_desc = =3D { .num_resets =3D ARRAY_SIZE(sun8i_a33_ccu_resets), }; =20 +static struct ccu_mux_nb sun8i_a33_cpu_nb =3D { + .common =3D &cpux_clk.common, + .cm =3D &cpux_clk.mux, + .delay_us =3D 1, /* > 8 clock cycles at 24 MHz */ + .bypass_index =3D 1, /* index of 24 MHz oscillator */ +}; + static void __init sun8i_a33_ccu_setup(struct device_node *node) { void __iomem *reg; @@ -775,6 +782,9 @@ static void __init sun8i_a33_ccu_setup(struct device_no= de *node) writel(val, reg + SUN8I_A33_PLL_MIPI_REG); =20 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", sun8i_a33_ccu_setup); --=20 2.11.0