linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC] firmware: arm_scmi: clock: add fixed clock attribute support
@ 2023-10-10  2:29 Peng Fan (OSS)
  2023-10-10  7:49 ` Cristian Marussi
  2023-10-10  9:12 ` Sudeep Holla
  0 siblings, 2 replies; 11+ messages in thread
From: Peng Fan (OSS) @ 2023-10-10  2:29 UTC (permalink / raw)
  To: sudeep.holla, cristian.marussi
  Cc: linux-arm-kernel, linux-clk, linux-kernel, ranjani.vaidyanathan,
	glen.wienecke, Peng Fan

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

There are clocks:
 system critical, not allow linux to disable, change rate
 allow linux to get rate, because some periphals will use the frequency
 to configure periphals.

 So introduce an attribute to indicated FIXED clock

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/clk/clk-scmi.c            | 6 ++++++
 drivers/firmware/arm_scmi/clock.c | 5 ++++-
 include/linux/scmi_protocol.h     | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c
index 8cbe24789c24..a539a35bd45a 100644
--- a/drivers/clk/clk-scmi.c
+++ b/drivers/clk/clk-scmi.c
@@ -182,6 +182,10 @@ static const struct clk_ops scmi_clk_ops = {
 	.determine_rate = scmi_clk_determine_rate,
 };
 
+static const struct clk_ops scmi_fixed_rate_clk_ops = {
+	.recalc_rate = scmi_clk_recalc_rate,
+};
+
 static const struct clk_ops scmi_atomic_clk_ops = {
 	.recalc_rate = scmi_clk_recalc_rate,
 	.round_rate = scmi_clk_round_rate,
@@ -293,6 +297,8 @@ static int scmi_clocks_probe(struct scmi_device *sdev)
 		if (is_atomic &&
 		    sclk->info->enable_latency <= atomic_threshold)
 			scmi_ops = &scmi_atomic_clk_ops;
+		else if (sclk->info->rate_fixed)
+			scmi_ops = &scmi_fixed_rate_clk_ops;
 		else
 			scmi_ops = &scmi_clk_ops;
 
diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c
index ddaef34cd88b..8c52db539e54 100644
--- a/drivers/firmware/arm_scmi/clock.c
+++ b/drivers/firmware/arm_scmi/clock.c
@@ -46,6 +46,7 @@ struct scmi_msg_resp_clock_attributes {
 #define SUPPORTS_RATE_CHANGE_REQUESTED_NOTIF(x)	((x) & BIT(30))
 #define SUPPORTS_EXTENDED_NAMES(x)		((x) & BIT(29))
 #define SUPPORTS_PARENT_CLOCK(x)		((x) & BIT(28))
+#define SUPPORTS_FIXED_RATE_CLOCK(x)		((x) & BIT(27))
 	u8 name[SCMI_SHORT_NAME_MAX_SIZE];
 	__le32 clock_enable_latency;
 };
@@ -326,7 +327,9 @@ static int scmi_clock_attributes_get(const struct scmi_protocol_handle *ph,
 			clk->rate_changed_notifications = true;
 		if (SUPPORTS_RATE_CHANGE_REQUESTED_NOTIF(attributes))
 			clk->rate_change_requested_notifications = true;
-		if (SUPPORTS_PARENT_CLOCK(attributes))
+		if (SUPPORTS_FIXED_RATE_CLOCK(attributes))
+			clk->rate_fixed = true;
+		else if (SUPPORTS_PARENT_CLOCK(attributes))
 			scmi_clock_possible_parents(ph, clk_id, clk);
 	}
 
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index f2f05fb42d28..e068004c151a 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -47,6 +47,7 @@ struct scmi_clock_info {
 	bool rate_discrete;
 	bool rate_changed_notifications;
 	bool rate_change_requested_notifications;
+	bool rate_fixed;
 	union {
 		struct {
 			int num_rates;
-- 
2.37.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-10-11 13:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10  2:29 [RFC] firmware: arm_scmi: clock: add fixed clock attribute support Peng Fan (OSS)
2023-10-10  7:49 ` Cristian Marussi
2023-10-10  8:08   ` Peng Fan
2023-10-10  8:29     ` Cristian Marussi
2023-10-10  8:38       ` Peng Fan
2023-10-10  9:32     ` Sudeep Holla
2023-10-10  9:12 ` Sudeep Holla
2023-10-10  9:22   ` Cristian Marussi
2023-10-10  9:35     ` Sudeep Holla
2023-10-11  3:54       ` [EXT] " Ranjani Vaidyanathan
2023-10-11 13:40         ` Sudeep Holla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).