[RFC PATCH 05/16] firmware: arm_scmi: Expose information on configured transport
Cristian Marussi
cristian.marussi at arm.com
Sun Feb 27 12:55:57 PST 2022
Add a common descriptor to describe transport features and expose it via
the SCMI instance handle.
Signed-off-by: Cristian Marussi <cristian.marussi at arm.com>
---
drivers/firmware/arm_scmi/driver.c | 12 ++++++++++++
include/linux/scmi_protocol.h | 20 ++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 8d356d4da0bd..8c5429529946 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -1966,6 +1966,7 @@ static int scmi_probe(struct platform_device *pdev)
struct scmi_handle *handle;
const struct scmi_desc *desc;
struct scmi_info *info;
+ struct scmi_transport_info *trans;
struct device *dev = &pdev->dev;
struct device_node *child, *np = dev->of_node;
@@ -2023,6 +2024,17 @@ static int scmi_probe(struct platform_device *pdev)
dev_err(dev,
"Transport is not polling capable. Atomic mode not supported.\n");
+ trans = devm_kzalloc(dev, sizeof(*trans), GFP_KERNEL);
+ if (!trans)
+ return -ENOMEM;
+
+ of_property_read_string(dev->of_node, "compatible", &trans->compatible);
+ trans->is_atomic =
+ handle->is_transport_atomic(handle,
+ &trans->atomic_threshold_us);
+ trans->max_rx_timeout_ms = info->desc->max_rx_timeout_ms;
+ handle->transport = trans;
+
/*
* Trigger SCMI Base protocol initialization.
* It's mandatory and won't be ever released/deinit until the
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index c5881d15f7d9..0b024d23a9b3 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -40,6 +40,24 @@ struct scmi_revision_info {
char sub_vendor_id[SCMI_MAX_STR_SIZE];
};
+/**
+ * struct scmi_transport_info - transport related information
+ *
+ * @compatible: Transport name picked from compatible string
+ * @is_atomic: True if the underlying transport can support atomic transactions
+ * and atomic mode is enabled.
+ * @atomic_threshold_us: Optional system wide DT-configured threshold, expressed
+ * in microseconds, for atomic operations.
+ * @max_rx_timeout_ms: configured maximum timeout in milliseconds for command
+ * replies.
+ */
+struct scmi_transport_info {
+ const char *compatible;
+ bool is_atomic;
+ unsigned int atomic_threshold_us;
+ unsigned int max_rx_timeout_ms;
+};
+
struct scmi_clock_info {
char name[SCMI_MAX_STR_SIZE];
unsigned int enable_latency;
@@ -633,6 +651,7 @@ struct scmi_notify_ops {
*
* @dev: pointer to the SCMI device
* @version: pointer to the structure containing SCMI version information
+ * @transport: pointer to the structure containing SCMI transport information
* @devm_protocol_get: devres managed method to acquire a protocol and get specific
* operations and a dedicated protocol handler
* @devm_protocol_put: devres managed method to release a protocol
@@ -650,6 +669,7 @@ struct scmi_notify_ops {
struct scmi_handle {
struct device *dev;
struct scmi_revision_info *version;
+ struct scmi_transport_info *transport;
const void __must_check *
(*devm_protocol_get)(struct scmi_device *sdev, u8 proto,
--
2.17.1
More information about the linux-arm-kernel
mailing list