@@ -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
@@ -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,
Add a common descriptor to describe transport features and expose it via the SCMI instance handle. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> --- drivers/firmware/arm_scmi/driver.c | 12 ++++++++++++ include/linux/scmi_protocol.h | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+)