aboutsummaryrefslogtreecommitdiff
path: root/drivers/firmware/scmi/mailbox_agent.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/mailbox_agent.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/mailbox_agent.c')
-rw-r--r--drivers/firmware/scmi/mailbox_agent.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/firmware/scmi/mailbox_agent.c b/drivers/firmware/scmi/mailbox_agent.c
index 8277c18606..7ad3e8da9f 100644
--- a/drivers/firmware/scmi/mailbox_agent.c
+++ b/drivers/firmware/scmi/mailbox_agent.c
@@ -94,13 +94,14 @@ static int setup_channel(struct udevice *dev, struct scmi_mbox_channel *chan)
}
static int scmi_mbox_get_channel(struct udevice *dev,
+ struct udevice *protocol,
struct scmi_channel **channel)
{
struct scmi_mbox_channel *base_chan = dev_get_plat(dev);
struct scmi_mbox_channel *chan;
int ret;
- if (!dev_read_prop(dev, "shmem", NULL)) {
+ if (!dev_read_prop(protocol, "shmem", NULL)) {
/* Uses agent base channel */
*channel = container_of(base_chan, struct scmi_channel, ref);
@@ -112,7 +113,7 @@ static int scmi_mbox_get_channel(struct udevice *dev,
return -ENOMEM;
/* Setup a dedicated channel for the protocol */
- ret = setup_channel(dev, chan);
+ ret = setup_channel(protocol, chan);
if (ret) {
free(chan);
return ret;