diff mbox series

[03/14] firmware: scmi: prepare scmi uclass API to multi-channel

Message ID 20220513062622.155433-4-etienne.carriere@linaro.org
State Superseded
Headers show
Series SCMI multi-channel and optee shm | expand

Commit Message

Etienne Carriere May 13, 2022, 6:26 a.m. UTC
Changes SCMI driver API function devm_scmi_process_msg() to add
an SCMI channel reference argument for when SCMI agent supports
SCMI protocol specific channels. First argument of devm_scmi_process_msg()
is also change to point to the caller SCMI protocol device rather
than its parent device (the SCMI agent device).

The argument is a pointer to opaque struct scmi_channel known from
the SCMI transport drivers. It is currently unused and caller a pass
NULL value. A later change will enable such support once SCMI protocol
drivers have means to get the channel reference during initialization.

Cc: Lukasz Majewski <lukma@denx.de>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
---
 drivers/clk/clk_scmi.c                    | 10 +++++-----
 drivers/firmware/scmi/scmi_agent-uclass.c |  3 ++-
 drivers/power/regulator/scmi_regulator.c  | 10 +++++-----
 drivers/reset/reset-scmi.c                |  4 ++--
 include/scmi_agent-uclass.h               |  2 +-
 include/scmi_agent.h                      |  5 ++++-
 6 files changed, 19 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c
index 5aaabcf0b44..0d0bb72eaf7 100644
--- a/drivers/clk/clk_scmi.c
+++ b/drivers/clk/clk_scmi.c
@@ -24,7 +24,7 @@  static int scmi_clk_get_num_clock(struct udevice *dev, size_t *num_clocks)
 	};
 	int ret;
 
-	ret = devm_scmi_process_msg(dev, &msg);
+	ret = devm_scmi_process_msg(dev, NULL, &msg);
 	if (ret)
 		return ret;
 
@@ -49,7 +49,7 @@  static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name)
 	};
 	int ret;
 
-	ret = devm_scmi_process_msg(dev, &msg);
+	ret = devm_scmi_process_msg(dev, NULL, &msg);
 	if (ret)
 		return ret;
 
@@ -70,7 +70,7 @@  static int scmi_clk_gate(struct clk *clk, int enable)
 					  in, out);
 	int ret;
 
-	ret = devm_scmi_process_msg(clk->dev, &msg);
+	ret = devm_scmi_process_msg(clk->dev, NULL, &msg);
 	if (ret)
 		return ret;
 
@@ -98,7 +98,7 @@  static ulong scmi_clk_get_rate(struct clk *clk)
 					  in, out);
 	int ret;
 
-	ret = devm_scmi_process_msg(clk->dev, &msg);
+	ret = devm_scmi_process_msg(clk->dev, NULL, &msg);
 	if (ret < 0)
 		return ret;
 
@@ -123,7 +123,7 @@  static ulong scmi_clk_set_rate(struct clk *clk, ulong rate)
 					  in, out);
 	int ret;
 
-	ret = devm_scmi_process_msg(clk->dev, &msg);
+	ret = devm_scmi_process_msg(clk->dev, NULL, &msg);
 	if (ret < 0)
 		return ret;
 
diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c
index 3819f2fa993..93cfc9c395b 100644
--- a/drivers/firmware/scmi/scmi_agent-uclass.c
+++ b/drivers/firmware/scmi/scmi_agent-uclass.c
@@ -114,7 +114,8 @@  static const struct scmi_agent_ops *transport_dev_ops(struct udevice *dev)
 	return (const struct scmi_agent_ops *)dev->driver->ops;
 }
 
-int devm_scmi_process_msg(struct udevice *dev, struct scmi_msg *msg)
+int devm_scmi_process_msg(struct udevice *dev, struct scmi_channel *channel,
+			  struct scmi_msg *msg)
 {
 	const struct scmi_agent_ops *ops;
 	struct udevice *parent = dev;
diff --git a/drivers/power/regulator/scmi_regulator.c b/drivers/power/regulator/scmi_regulator.c
index 2966bdcf830..3325ddaf23b 100644
--- a/drivers/power/regulator/scmi_regulator.c
+++ b/drivers/power/regulator/scmi_regulator.c
@@ -38,7 +38,7 @@  static int scmi_voltd_set_enable(struct udevice *dev, bool enable)
 					  in, out);
 	int ret;
 
-	ret = devm_scmi_process_msg(dev, &msg);
+	ret = devm_scmi_process_msg(dev, NULL, &msg);
 	if (ret)
 		return ret;
 
@@ -61,7 +61,7 @@  static int scmi_voltd_get_enable(struct udevice *dev)
 					  in, out);
 	int ret;
 
-	ret = devm_scmi_process_msg(dev, &msg);
+	ret = devm_scmi_process_msg(dev, NULL, &msg);
 	if (ret < 0)
 		return ret;
 
@@ -85,7 +85,7 @@  static int scmi_voltd_set_voltage_level(struct udevice *dev, int uV)
 					  in, out);
 	int ret;
 
-	ret = devm_scmi_process_msg(dev, &msg);
+	ret = devm_scmi_process_msg(dev, NULL, &msg);
 	if (ret < 0)
 		return ret;
 
@@ -104,7 +104,7 @@  static int scmi_voltd_get_voltage_level(struct udevice *dev)
 					  in, out);
 	int ret;
 
-	ret = devm_scmi_process_msg(dev, &msg);
+	ret = devm_scmi_process_msg(dev, NULL, &msg);
 	if (ret < 0)
 		return ret;
 
@@ -147,7 +147,7 @@  static int scmi_regulator_probe(struct udevice *dev)
 	/* Check voltage domain is known from SCMI server */
 	in.domain_id = pdata->domain_id;
 
-	ret = devm_scmi_process_msg(dev, &scmi_msg);
+	ret = devm_scmi_process_msg(dev, NULL, &scmi_msg);
 	if (ret) {
 		dev_err(dev, "Failed to query voltage domain %u: %d\n",
 			pdata->domain_id, ret);
diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c
index 81d195a06a9..30b26ec9d31 100644
--- a/drivers/reset/reset-scmi.c
+++ b/drivers/reset/reset-scmi.c
@@ -26,7 +26,7 @@  static int scmi_reset_set_level(struct reset_ctl *rst, bool assert_not_deassert)
 					  in, out);
 	int ret;
 
-	ret = devm_scmi_process_msg(rst->dev, &msg);
+	ret = devm_scmi_process_msg(rst->dev, NULL, &msg);
 	if (ret)
 		return ret;
 
@@ -58,7 +58,7 @@  static int scmi_reset_request(struct reset_ctl *rst)
 	 * We don't really care about the attribute, just check
 	 * the reset domain exists.
 	 */
-	ret = devm_scmi_process_msg(rst->dev, &msg);
+	ret = devm_scmi_process_msg(rst->dev, NULL, &msg);
 	if (ret)
 		return ret;
 
diff --git a/include/scmi_agent-uclass.h b/include/scmi_agent-uclass.h
index a501d1b4825..861ac6d1100 100644
--- a/include/scmi_agent-uclass.h
+++ b/include/scmi_agent-uclass.h
@@ -15,7 +15,7 @@  struct scmi_agent_ops {
 	/*
 	 * process_msg - Request transport to get the SCMI message processed
 	 *
-	 * @agent:		Agent using the transport
+	 * @dev:		SCMI protocol device using the transport
 	 * @msg:		SCMI message to be transmitted
 	 */
 	int (*process_msg)(struct udevice *dev, struct scmi_msg *msg);
diff --git a/include/scmi_agent.h b/include/scmi_agent.h
index 18bcd48a9d4..f4d85cae773 100644
--- a/include/scmi_agent.h
+++ b/include/scmi_agent.h
@@ -13,6 +13,7 @@ 
 #include <asm/types.h>
 
 struct udevice;
+struct scmi_channel;
 
 /*
  * struct scmi_msg - Context of a SCMI message sent and the response received
@@ -52,10 +53,12 @@  struct scmi_msg {
  * On return, scmi_msg::out_msg_sz stores the response payload size.
  *
  * @dev:	SCMI device
+ * @channel:	Communication channel for the device
  * @msg:	Message structure reference
  * Return: 0 on success and a negative errno on failure
  */
-int devm_scmi_process_msg(struct udevice *dev, struct scmi_msg *msg);
+int devm_scmi_process_msg(struct udevice *dev, struct scmi_channel *channel,
+			  struct scmi_msg *msg);
 
 /**
  * scmi_to_linux_errno() - Convert an SCMI error code into a Linux errno code