mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: sudeep.holla@arm.com, cristian.marussi@arm.com,
	mturquette@baylibre.com, sboyd@kernel.org
Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org, ranjani.vaidyanathan@nxp.com,
	glen.wienecke@nxp.com, nitin.garg_3@nxp.com,
	chuck.cannon@nxp.com, Peng Fan <peng.fan@nxp.com>
Subject: [PATCH V2 2/2] clk: scmi: support state_ctrl_forbidden
Date: Thu,  7 Dec 2023 17:33:45 +0800	[thread overview]
Message-ID: <20231207093345.581048-2-peng.fan@oss.nxp.com> (raw)
In-Reply-To: <20231207093345.581048-1-peng.fan@oss.nxp.com>

From: Peng Fan <peng.fan@nxp.com>

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.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

V2:
 New. Take Cristian's suggestion

 drivers/clk/clk-scmi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c
index 8cbe24789c24..1d809813eabd 100644
--- a/drivers/clk/clk-scmi.c
+++ b/drivers/clk/clk-scmi.c
@@ -119,8 +119,14 @@ static int scmi_clk_determine_rate(struct clk_hw *hw, struct clk_rate_request *r
 static int scmi_clk_enable(struct clk_hw *hw)
 {
 	struct scmi_clk *clk = to_scmi_clk(hw);
+	int ret;
+
+	ret = scmi_proto_clk_ops->enable(clk->ph, clk->id, NOT_ATOMIC);
 
-	return scmi_proto_clk_ops->enable(clk->ph, clk->id, NOT_ATOMIC);
+	if (ret == -EACCES && clk->info->state_ctrl_forbidden)
+		return 0;
+
+	return ret;
 }
 
 static void scmi_clk_disable(struct clk_hw *hw)
-- 
2.37.1


  reply	other threads:[~2023-12-07  9:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07  9:33 [PATCH V2 1/2] firmware: arm_scmi: clock: implement get permissions Peng Fan (OSS)
2023-12-07  9:33 ` Peng Fan (OSS) [this message]
2024-01-10 15:40   ` [PATCH V2 2/2] clk: scmi: support state_ctrl_forbidden Cristian Marussi
2024-01-11  0:07     ` Peng Fan
2024-01-09  1:06 ` [PATCH V2 1/2] firmware: arm_scmi: clock: implement get permissions Peng Fan
2024-01-09  8:43   ` Cristian Marussi
2024-01-10 15:19 ` Cristian Marussi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231207093345.581048-2-peng.fan@oss.nxp.com \
    --to=peng.fan@oss.nxp.com \
    --cc=chuck.cannon@nxp.com \
    --cc=cristian.marussi@arm.com \
    --cc=glen.wienecke@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=nitin.garg_3@nxp.com \
    --cc=peng.fan@nxp.com \
    --cc=ranjani.vaidyanathan@nxp.com \
    --cc=sboyd@kernel.org \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®