diff mbox series

[11/14] reset: scmi: support SCMI multi-channel

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

Commit Message

Etienne Carriere May 13, 2022, 6:26 a.m. UTC
Update SCMI reset controller driver to get its assigned SCMI channel
during initialization. This change allows SCMI reset domain protocol
to use a dedicated channel when defined in the DT. The reference is
saved in SCMI reset controller driver private data.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
---
 drivers/reset/reset-scmi.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c
index 30b26ec9d31..6101bd2a1e8 100644
--- a/drivers/reset/reset-scmi.c
+++ b/drivers/reset/reset-scmi.c
@@ -15,6 +15,7 @@ 
 
 static int scmi_reset_set_level(struct reset_ctl *rst, bool assert_not_deassert)
 {
+	struct scmi_channel **scmi_channel_ref = dev_get_priv(rst->dev);
 	struct scmi_rd_reset_in in = {
 		.domain_id = rst->id,
 		.flags = assert_not_deassert ? SCMI_RD_RESET_FLAG_ASSERT : 0,
@@ -26,7 +27,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, NULL, &msg);
+	ret = devm_scmi_process_msg(rst->dev, *scmi_channel_ref, &msg);
 	if (ret)
 		return ret;
 
@@ -45,6 +46,7 @@  static int scmi_reset_deassert(struct reset_ctl *rst)
 
 static int scmi_reset_request(struct reset_ctl *rst)
 {
+	struct scmi_channel **scmi_channel_ref = dev_get_priv(rst->dev);
 	struct scmi_rd_attr_in in = {
 		.domain_id = rst->id,
 	};
@@ -58,7 +60,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, NULL, &msg);
+	ret = devm_scmi_process_msg(rst->dev, *scmi_channel_ref, &msg);
 	if (ret)
 		return ret;
 
@@ -71,8 +73,17 @@  static const struct reset_ops scmi_reset_domain_ops = {
 	.rst_deassert	= scmi_reset_deassert,
 };
 
+static int scmi_reset_probe(struct udevice *dev)
+{
+	struct scmi_channel **scmi_channel_ref = dev_get_priv(dev);
+
+	return devm_scmi_of_get_channel(dev, scmi_channel_ref);
+}
+
 U_BOOT_DRIVER(scmi_reset_domain) = {
 	.name = "scmi_reset_domain",
 	.id = UCLASS_RESET,
 	.ops = &scmi_reset_domain_ops,
+	.probe = scmi_reset_probe,
+	.priv_auto = sizeof(struct scmi_channel *),
 };