From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 982CEC433EF for ; Sun, 27 Feb 2022 20:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ddd9Lr9XHYfthzTA2iNPoTGwUVGUqrJQua+tgQO/DCw=; b=iOsrozWys85O38 YPCRrJ+UR5SWxAUXeiS0LUNhuz4LnfqTcy2nDHTM64a3Pk55cBaCCsQ1DAJR4FTd13eUywhT/WlBv RLtU7ZJFrNpJIZ/goOOi5qYynu6G4PxB3tjVjdbhf0z+czisXUqdeIq1nRh5hE50VQ1ismj4gVhhB xzJu3b+Jyhx9yKY+zQKB3MSz1+AF5FauAK/hco3BjIHb59fiOwcPGYG+kAmZlBt+NQuIy6pew1OQD y5qrdMtgwBJxx60bRMTTXmqRGaHqhUc1ZshMs++Se0lqemhn0koKpqINVFZ6/TWiLjT3RqrJGTPC2 9Rj0/lHMaJtbMrNYab1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOQc1-00A7p6-VK; Sun, 27 Feb 2022 20:57:50 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOQak-00A7DI-TU for linux-arm-kernel@lists.infradead.org; Sun, 27 Feb 2022 20:56:32 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1AB611477; Sun, 27 Feb 2022 12:56:30 -0800 (PST) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B39573F66F; Sun, 27 Feb 2022 12:56:28 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, peter.hilber@opensynergy.com, cristian.marussi@arm.com Subject: [RFC PATCH 05/16] firmware: arm_scmi: Expose information on configured transport Date: Sun, 27 Feb 2022 20:55:57 +0000 Message-Id: <20220227205608.30812-6-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220227205608.30812-1-cristian.marussi@arm.com> References: <20220227205608.30812-1-cristian.marussi@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220227_125631_071731_3D08EAD9 X-CRM114-Status: GOOD ( 13.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a common descriptor to describe transport features and expose it via the SCMI instance handle. Signed-off-by: Cristian Marussi --- 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel