From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20920C433EF for ; Thu, 17 Mar 2022 19:38:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230058AbiCQTjh (ORCPT ); Thu, 17 Mar 2022 15:39:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231955AbiCQTjf (ORCPT ); Thu, 17 Mar 2022 15:39:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4F21EAC8B; Thu, 17 Mar 2022 12:38:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E7870618B3; Thu, 17 Mar 2022 19:38:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47BC1C340E9; Thu, 17 Mar 2022 19:38:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647545895; bh=YDBqqtsD8hurDcBaCOcL4NXPfM8to2wSvDT1JakwR+U=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=QHOjltqeHi+HQG2Xky3LWk1zqqafGF3WxgeGSm8rT3vPU0OrIVtLl3wS6uocN6bUc Iz9caqzXOHhc9wy/pqpGQWLiUT7tEAYL04H3Off9vCiP7LW2TXslbbnrF9M9FlQCV8 attIKQFFR35qHc16JPmEtjl44Q5Ff7maf96V5okDuWAb49J7rdiDeNzTYTncKzvF6Z T1iQSTqsCDlTlep0XNjgklbMVXIHWtcGfmRnX1G3rClnGTe5a/M2H3sdA+adcK70ew XDm0JwOvUwJoPhdpLYxbPEH2ppUF0xVoM3GXRKcaZKCN77N1oT1TWg0Zam3UXU1/mi F6m00k3fi+c+Q== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20220228124112.3974242-2-peng.fan@oss.nxp.com> References: <20220228124112.3974242-1-peng.fan@oss.nxp.com> <20220228124112.3974242-2-peng.fan@oss.nxp.com> Subject: Re: [PATCH V2 2/2] clk: imx8m: check mcore_booted before register clk From: Stephen Boyd Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan To: Peng Fan (OSS) , abel.vesa@nxp.com, s.hauer@pengutronix.de, shawnguo@kernel.org Date: Thu, 17 Mar 2022 12:38:13 -0700 User-Agent: alot/0.10 Message-Id: <20220317193815.47BC1C340E9@smtp.kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Quoting Peng Fan (OSS) (2022-02-28 04:41:12) > From: Peng Fan >=20 > If mcore_booted is true, ignore the clk root gate registration and > this will simplify AMP clock management and avoid system hang unexpectly > especially Linux shutdown clk used by mcore. >=20 > Signed-off-by: Peng Fan > --- >=20 > V2: > None >=20 > drivers/clk/imx/clk-composite-8m.c | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) >=20 > diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-com= posite-8m.c > index 2dfd6149e528..b16c2c0ea9f6 100644 > --- a/drivers/clk/imx/clk-composite-8m.c > +++ b/drivers/clk/imx/clk-composite-8m.c > @@ -223,14 +223,19 @@ struct clk_hw *__imx8m_clk_hw_composite(const char = *name, > div->lock =3D &imx_ccm_lock; > div->flags =3D CLK_DIVIDER_ROUND_CLOSEST; > =20 > - gate =3D kzalloc(sizeof(*gate), GFP_KERNEL); > - if (!gate) > - goto fail; > - > - gate_hw =3D &gate->hw; > - gate->reg =3D reg; > - gate->bit_idx =3D PCG_CGC_SHIFT; > - gate->lock =3D &imx_ccm_lock; > + /* skip registering the gate ops if M4 is enabled */ > + if (mcore_booted) { > + gate_hw =3D NULL; It could even use the protected-clocks property and then parse it to figure out to not register this gate? > + } else { > + gate =3D kzalloc(sizeof(*gate), GFP_KERNEL); > + if (!gate) > + goto fail; > + > + gate_hw =3D &gate->hw; > + gate->reg =3D reg; > + gate->bit_idx =3D PCG_CGC_SHIFT; > + gate->lock =3D &imx_ccm_lock; > + }