summaryrefslogtreecommitdiff
path: root/drivers/firmware/scmi/scmi_agent-uclass.c
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2023-10-11 19:06:55 +0900
committerTom Rini <trini@konsulko.com>2023-10-13 16:59:23 -0400
commit689204be9744db24fc8031229946f045fae02c07 (patch)
treebcab78f9856610c852191e3f5874a83fe957c1d6 /drivers/firmware/scmi/scmi_agent-uclass.c
parentc6230cd8427c906baa52dbff5b95027ef58e6048 (diff)
firmware: scmi: use a protocol's own channel if assigned
SCMI specification allows any protocol to have its own channel for the transport. While the current SCMI driver may assign its channel from a device tree, the core function, devm_scmi_process_msg(), doesn't use a protocol's channel, but always use an agent's channel. With this commit, devm_scmi_process_msg() tries to find and use a protocol's channel. If it doesn't exist, use an agent's. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/firmware/scmi/scmi_agent-uclass.c')
-rw-r--r--drivers/firmware/scmi/scmi_agent-uclass.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c
index ec58ccd2bc5..a28692f39f4 100644
--- a/drivers/firmware/scmi/scmi_agent-uclass.c
+++ b/drivers/firmware/scmi/scmi_agent-uclass.c
@@ -144,13 +144,14 @@ static const struct scmi_agent_ops *transport_dev_ops(struct udevice *dev)
* On return, @channel will be set.
* Return 0 on success and a negative errno on failure
*/
-static int scmi_of_get_channel(struct udevice *dev, struct scmi_channel **channel)
+static int scmi_of_get_channel(struct udevice *dev, struct udevice *protocol,
+ struct scmi_channel **channel)
{
const struct scmi_agent_ops *ops;
ops = transport_dev_ops(dev);
if (ops->of_get_channel)
- return ops->of_get_channel(dev, channel);
+ return ops->of_get_channel(dev, protocol, channel);
else
return -EPROTONOSUPPORT;
}
@@ -166,7 +167,7 @@ int devm_scmi_of_get_channel(struct udevice *dev)
return -ENODEV;
priv = dev_get_parent_priv(protocol);
- ret = scmi_of_get_channel(protocol->parent, &priv->channel);
+ ret = scmi_of_get_channel(protocol->parent, protocol, &priv->channel);
if (ret == -EPROTONOSUPPORT) {
/* Drivers without a get_channel operator don't need a channel ref */
priv->channel = NULL;