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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7167DC25B10 for ; Mon, 13 May 2024 06:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sZZEQDdfmiuI5cRxHlooczLV4/w4OfA5QpBwKy5iPdw=; b=IfRFDQje+hIv2M uJdPHpdSVKalE4Yfhc9YcZFqHeg20AELH9bXevqfhDGBeCsRLSRnz24mjCeSLK5Lu3Etiw/bynYjI Z9+CynT/BAk1MSrk3BhgcqTTxrXUISBiB4la9LUFdhGJ01EGoqSqiVOlrV2Yttm12lrY3B4EXr/8D 9/S13uTvXcglWzDg5qN4FavoGFNrhDD+TU74Vu0B28olM9GDzkdywoWlNfTsKprbDEiUoloK6Qx/J ydl52r0VeZH3Sx1/mpeoBUfW4Azo9i9aO64br23RnKAQhzyECF2uBqsA2yE0olvKJ3oyIgGnxFdRn x4GzIyS6fSKPDztPR2mg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6PLl-0000000BtVX-3j72; Mon, 13 May 2024 06:39:53 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6PLh-0000000BtUk-3uFt for linux-arm-kernel@lists.infradead.org; Mon, 13 May 2024 06:39:52 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s6PLT-0004Yo-2g; Mon, 13 May 2024 08:39:35 +0200 Received: from [2a0a:edc0:2:b01:1d::c5] (helo=pty.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s6PLS-0017Sf-4l; Mon, 13 May 2024 08:39:34 +0200 Received: from sha by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1s6PLS-009O2c-07; Mon, 13 May 2024 08:39:34 +0200 Date: Mon, 13 May 2024 08:39:34 +0200 From: Sascha Hauer To: "Peng Fan (OSS)" Cc: Abel Vesa , Michael Turquette , Stephen Boyd , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , Jacky Bai , Ye Li , Dong Aisheng , linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Abel Vesa , Peng Fan Subject: Re: [PATCH v2 01/17] clk: imx: composite-8m: Enable gate clk with mcore_booted Message-ID: References: <20240510-imx-clk-v2-0-c998f315d29c@nxp.com> <20240510-imx-clk-v2-1-c998f315d29c@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240510-imx-clk-v2-1-c998f315d29c@nxp.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240512_233949_995683_DBB6C7D2 X-CRM114-Status: GOOD ( 30.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 10, 2024 at 05:18:56PM +0800, Peng Fan (OSS) wrote: > From: Peng Fan > > Bootloader might disable some CCM ROOT Slices. So if mcore_booted set with > display CCM ROOT disabled by Bootloader, kernel display BLK CTRL driver > imx8m_blk_ctrl_driver_init may hang the system because the BUS clk is > disabled. > > Add back gate ops, but with disable doing nothing, then the CCM ROOT > will be enabled when used. > > Fixes: 489bbee0c983 ("clk: imx: composite-8m: Enable gate clk with mcore_booted") I can't find this commitish anywhere, also the subject looks like this patch fixes itself. > Reviewed-by: Ye Li > Reviewed-by: Jacky Bai > Signed-off-by: Peng Fan > --- > drivers/clk/imx/clk-composite-8m.c | 53 ++++++++++++++++++++++++++++++-------- > 1 file changed, 42 insertions(+), 11 deletions(-) > > diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c > index 8cc07d056a83..f187582ba491 100644 > --- a/drivers/clk/imx/clk-composite-8m.c > +++ b/drivers/clk/imx/clk-composite-8m.c > @@ -204,6 +204,34 @@ static const struct clk_ops imx8m_clk_composite_mux_ops = { > .determine_rate = imx8m_clk_composite_mux_determine_rate, > }; > > +static int imx8m_clk_composite_gate_enable(struct clk_hw *hw) > +{ > + struct clk_gate *gate = to_clk_gate(hw); > + unsigned long flags; > + u32 val; > + > + spin_lock_irqsave(gate->lock, flags); > + > + val = readl(gate->reg); > + val |= BIT(gate->bit_idx); > + writel(val, gate->reg); > + > + spin_unlock_irqrestore(gate->lock, flags); > + > + return 0; > +} > + > +static void imx8m_clk_composite_gate_disable(struct clk_hw *hw) > +{ > + /* composite clk requires the disable hook */ > +} > + > +static const struct clk_ops imx8m_clk_composite_gate_ops = { > + .enable = imx8m_clk_composite_gate_enable, > + .disable = imx8m_clk_composite_gate_disable, > + .is_enabled = clk_gate_is_enabled, > +}; > + > struct clk_hw *__imx8m_clk_hw_composite(const char *name, > const char * const *parent_names, > int num_parents, void __iomem *reg, > @@ -217,6 +245,7 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name, > struct clk_mux *mux; > const struct clk_ops *divider_ops; > const struct clk_ops *mux_ops; > + const struct clk_ops *gate_ops; > > mux = kzalloc(sizeof(*mux), GFP_KERNEL); > if (!mux) > @@ -257,20 +286,22 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name, > div->flags = CLK_DIVIDER_ROUND_CLOSEST; > > /* skip registering the gate ops if M4 is enabled */ This comment doesn't seems to become inaccurate with this patch. > - if (!mcore_booted) { > - gate = kzalloc(sizeof(*gate), GFP_KERNEL); > - if (!gate) > - goto free_div; > - > - gate_hw = &gate->hw; > - gate->reg = reg; > - gate->bit_idx = PCG_CGC_SHIFT; > - gate->lock = &imx_ccm_lock; > - } > + gate = kzalloc(sizeof(*gate), GFP_KERNEL); > + if (!gate) > + goto free_div; > + > + gate_hw = &gate->hw; > + gate->reg = reg; > + gate->bit_idx = PCG_CGC_SHIFT; > + gate->lock = &imx_ccm_lock; > + if (!mcore_booted) > + gate_ops = &clk_gate_ops; > + else > + gate_ops = &imx8m_clk_composite_gate_ops; Please use positive logic. It's easier to read. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel