1 From f0d7ff1f10ab846bf32bae3b7d32bf95653954fa Mon Sep 17 00:00:00 2001
2 From: Peter Hilber <peter.hilber@opensynergy.com>
3 Date: Thu, 5 Nov 2020 22:21:12 +0100
4 Subject: [PATCH] firmware: arm_scmi: Add optional link_supplier() transport op
6 For the scmi-virtio transport, it might not be possible to refer to the
7 proper virtio device at device tree build time. Therefore, add an op
8 which will allow scmi-virtio to dynamically link to the proper virtio
11 Signed-off-by: Peter Hilber <peter.hilber@opensynergy.com>
12 Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
14 drivers/firmware/arm_scmi/common.h | 2 ++
15 drivers/firmware/arm_scmi/driver.c | 6 ++++++
16 2 files changed, 8 insertions(+)
18 diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h
19 index ae5db602e45d..2f55ac71555a 100644
20 --- a/drivers/firmware/arm_scmi/common.h
21 +++ b/drivers/firmware/arm_scmi/common.h
22 @@ -202,6 +202,7 @@ struct scmi_chan_info {
24 * struct scmi_transport_ops - Structure representing a SCMI transport ops
26 + * @link_supplier: Optional callback to add link to a supplier device
27 * @chan_available: Callback to check if channel is available or not
28 * @chan_setup: Callback to allocate and setup a channel
29 * @chan_free: Callback to free a channel
30 @@ -217,6 +218,7 @@ struct scmi_chan_info {
31 * @poll_done: Callback to poll transfer status
33 struct scmi_transport_ops {
34 + int (*link_supplier)(struct device *dev);
35 bool (*chan_available)(struct device *dev, int idx);
36 int (*chan_setup)(struct scmi_chan_info *cinfo, struct device *dev,
38 diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
39 index 27dd43dcff5b..0b70f9ef9477 100644
40 --- a/drivers/firmware/arm_scmi/driver.c
41 +++ b/drivers/firmware/arm_scmi/driver.c
42 @@ -826,6 +826,12 @@ static int scmi_probe(struct platform_device *pdev)
43 handle->dev = info->dev;
44 handle->version = &info->version;
46 + if (desc->ops->link_supplier) {
47 + ret = desc->ops->link_supplier(dev);
52 ret = scmi_txrx_setup(info, dev, SCMI_PROTOCOL_BASE);