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 C5D19C48BF8 for ; Thu, 22 Feb 2024 09:43:41 +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=h0WTBiq9xh3YyHUiRB1GLOTX9oEaA2wvdHuy1sYJMyc=; b=vTcYYh4kw6WtqC i3EEWN1lmM4J0scvdnBne32aPZ3XgDLjrl9j6Ijn982zt5wPA3/cE83xPq9vSuUGxkhGfj4NtKVzp Wkmm9rJvhuEkKa1TkNnxvRhi963yquctkbeqIPYz5FE7/YljAPeRIdOj7GkrBsaVvyRaUAitUKqM0 FYIbQzkMMOL0aDZZxUf+u7m3+VHSBh2JKa2WQ2XHu8kQPv7mmGHHlfjqz9009PALukHw7dFu6mcuK 2sq+OGegmySAFaLa4EkI7YitCKwWOUV5BkKeu7HcGDMOeLfCl87sK7cyLuaBfg6u+0XhXtayLtGIg yuX9JezFPn9eqOaulETg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rd5c0-00000004KDK-2I8Q; Thu, 22 Feb 2024 09:43:28 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rd5ah-00000004J1U-2Piu for linux-arm-kernel@lists.infradead.org; Thu, 22 Feb 2024 09:42:10 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 251A61477; Thu, 22 Feb 2024 01:42:41 -0800 (PST) Received: from bogus (unknown [10.57.93.2]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8C7223F766; Thu, 22 Feb 2024 01:41:59 -0800 (PST) Date: Thu, 22 Feb 2024 09:41:53 +0000 From: Sudeep Holla To: "Peng Fan (OSS)" Cc: cristian.marussi@arm.com, mturquette@baylibre.com, sboyd@kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Peng Fan Subject: Re: [PATCH V4 2/2] clk: scmi: support state_ctrl_forbidden Message-ID: <20240222094153.2nxvefa44y5ikutm@bogus> References: <20240121110901.1414856-1-peng.fan@oss.nxp.com> <20240121110901.1414856-2-peng.fan@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240121110901.1414856-2-peng.fan@oss.nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240222_014207_870808_2045E5D0 X-CRM114-Status: GOOD ( 21.13 ) 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 Sun, Jan 21, 2024 at 07:09:01PM +0800, Peng Fan (OSS) wrote: > From: Peng Fan > > Some clocks may exported to linux, while those clocks are not allowed > to configure by Linux. For example: > > SYS_CLK1----- > \ > --MUX--->MMC1_CLK > / > SYS_CLK2----- > > MMC1 needs set parent, so SYS_CLK1 and SYS_CLK2 are exported to Linux, > then the clk propagation will touch SYS_CLK1 or SYS_CLK2. > So we need bypass the failure for SYS_CLK1 or SYS_CLK2 when enable > the clock of MMC1, adding scmi_no_state_ctrl_clk_ops to use software > enable counter, while not calling scmi api. > > Co-developed-by: Cristian Marussi > Signed-off-by: Cristian Marussi > Signed-off-by: Peng Fan > --- > > V4: > Add scmi_no_state_ctrl_clk_ops per Cristian > Add Cristian's tag > > V3: > Add check in atomic enable > > V2: > New. Take Cristian's suggestion > > drivers/clk/clk-scmi.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c > index 8cbe24789c24..5747b6d651f0 100644 > --- a/drivers/clk/clk-scmi.c > +++ b/drivers/clk/clk-scmi.c > @@ -194,6 +194,15 @@ static const struct clk_ops scmi_atomic_clk_ops = { > .determine_rate = scmi_clk_determine_rate, > }; > > +static const struct clk_ops scmi_no_state_ctrl_clk_ops = { > + .recalc_rate = scmi_clk_recalc_rate, > + .round_rate = scmi_clk_round_rate, > + .set_rate = scmi_clk_set_rate, > + .set_parent = scmi_clk_set_parent, > + .get_parent = scmi_clk_get_parent, > + .determine_rate = scmi_clk_determine_rate, > +}; > + > static int scmi_clk_ops_init(struct device *dev, struct scmi_clk *sclk, > const struct clk_ops *scmi_ops) > { > @@ -290,8 +299,10 @@ static int scmi_clocks_probe(struct scmi_device *sdev) > * specify (or support) an enable_latency associated with a > * clock, we default to use atomic operations mode. > */ > - if (is_atomic && > - sclk->info->enable_latency <= atomic_threshold) > + if (sclk->info->state_ctrl_forbidden) > + scmi_ops = &scmi_no_state_ctrl_clk_ops; With this, even if is_atomic and latency matches, we won't allow atomic operations ? One reason why it gets tricky and as Cristian mentioned elsewhere we need dynamic assignment of these ops IMO. Let me know if I am getting things wrong here ? -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel