From: Peter Hilber <peter.hilber@opensynergy.com>
To: <linux-arm-kernel@lists.infradead.org>, <devicetree@vger.kernel.org>
Cc: Peter Hilber <peter.hilber@opensynergy.com>,
Rob Herring <robh+dt@kernel.org>, <linux-kernel@vger.kernel.org>,
<sudeep.holla@arm.com>, <souvik.chakravarty@arm.com>,
<alex.bennee@linaro.org>, <jean-philippe@linaro.org>,
<igor.skalkin@opensynergy.com>, <mikhail.golubev@opensynergy.com>,
<anton.yakovlev@opensynergy.com>
Subject: [RFC PATCH v2 07/10] firmware: arm_scmi: Add per-device transport private info
Date: Thu, 5 Nov 2020 22:21:13 +0100 [thread overview]
Message-ID: <20201105212116.411422-8-peter.hilber@opensynergy.com> (raw)
In-Reply-To: <20201105212116.411422-1-peter.hilber@opensynergy.com>
The scmi-virtio transport will link a supplier device to the arm-scmi
device in the link_supplier() op. The transport should then save a
pointer to the linked device.
To enable this, add a transport private info to the scmi_info. (The
scmi_info is already reachable through the arm-scmi device driver_data.)
Signed-off-by: Peter Hilber <peter.hilber@opensynergy.com>
---
drivers/firmware/arm_scmi/common.h | 2 ++
drivers/firmware/arm_scmi/driver.c | 35 ++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h
index 2f55ac71555a..ec9fd7fce3c7 100644
--- a/drivers/firmware/arm_scmi/common.h
+++ b/drivers/firmware/arm_scmi/common.h
@@ -262,6 +262,8 @@ extern const struct scmi_desc scmi_mailbox_desc;
extern const struct scmi_desc scmi_smc_desc;
#endif
+int scmi_set_transport_info(struct device *dev, void *transport_info);
+void *scmi_get_transport_info(struct device *dev);
void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr);
void scmi_free_channel(struct scmi_chan_info *cinfo, struct idr *idr, int id);
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index dedc9b3f3e97..244141e45e88 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -84,6 +84,7 @@ struct scmi_xfers_info {
* @rx_idr: IDR object to map protocol id to Rx channel info pointer
* @protocols_imp: List of protocols implemented, currently maximum of
* MAX_PROTOCOLS_IMP elements allocated by the base protocol
+ * @transport_info: Transport private info
* @node: List head
* @users: Number of users of this instance
*/
@@ -97,6 +98,7 @@ struct scmi_info {
struct idr tx_idr;
struct idr rx_idr;
u8 *protocols_imp;
+ void *transport_info;
struct list_head node;
int users;
};
@@ -315,6 +317,39 @@ void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr)
}
}
+/**
+ * scmi_set_transport_info() - Set transport private info
+ *
+ * @dev: SCMI instance device
+ * @transport_info: transport private info
+ *
+ * Return: 0 on success, otherwise error.
+ */
+int scmi_set_transport_info(struct device *dev, void *transport_info)
+{
+ struct scmi_info *info = dev_get_drvdata(dev);
+
+ if (!info)
+ return -EBADR;
+
+ info->transport_info = transport_info;
+ return 0;
+}
+
+/**
+ * scmi_get_transport_info() - Get transport private info
+ *
+ * @dev: SCMI instance device
+ *
+ * Return: transport private info on success, otherwise NULL.
+ */
+void *scmi_get_transport_info(struct device *dev)
+{
+ struct scmi_info *info = dev_get_drvdata(dev);
+
+ return info ? info->transport_info : NULL;
+}
+
/**
* scmi_xfer_put() - Release a transmit message
*
--
2.25.1
next prev parent reply other threads:[~2020-11-05 21:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 21:21 [RFC PATCH v2 00/10] firmware: arm_scmi: Add virtio transport Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 01/10] firmware: arm_scmi, smccc, mailbox: Make shmem based transports optional Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 02/10] firmware: arm_scmi: Document that max_msg is a per channel type limit Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 03/10] firmware: arm_scmi: Add op to override max message # Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 04/10] firmware: arm_scmi: Add per message transport data Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 05/10] firmware: arm_scmi: Add xfer_init_buffers transport op Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 06/10] firmware: arm_scmi: Add optional link_supplier() " Peter Hilber
2020-11-05 21:21 ` Peter Hilber [this message]
2020-11-05 21:21 ` [RFC PATCH v2 08/10] firmware: arm_scmi: Add is_scmi_protocol_device() Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 09/10] dt-bindings: arm: Add virtio transport for SCMI Peter Hilber
2020-11-05 21:21 ` [RFC PATCH v2 10/10] firmware: arm_scmi: Add virtio transport Peter Hilber
2020-11-10 21:32 ` Cristian Marussi
2020-11-12 10:57 ` Peter Hilber
2020-11-17 21:20 ` Cristian Marussi
2021-04-08 3:45 ` Viresh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201105212116.411422-8-peter.hilber@opensynergy.com \
--to=peter.hilber@opensynergy.com \
--cc=alex.bennee@linaro.org \
--cc=anton.yakovlev@opensynergy.com \
--cc=devicetree@vger.kernel.org \
--cc=igor.skalkin@opensynergy.com \
--cc=jean-philippe@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mikhail.golubev@opensynergy.com \
--cc=robh+dt@kernel.org \
--cc=souvik.chakravarty@arm.com \
--cc=sudeep.holla@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox