From patchwork Tue May 11 00:20:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 12250353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85175C433ED for ; Tue, 11 May 2021 09:55:23 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E29496186A for ; Tue, 11 May 2021 09:55:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E29496186A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=opensynergy.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=szK2lDEZGz0TZEOq5l15xpTcWjjbTfH11adtx01XLxY=; b=LdPatBriRY0nCV5MdG0d6a8a1 av8s5eMQQNxjIpoOGKg9KGy60zmDU6qw5rymmEfZCFFruPbUK+rznTc8Haj6U6MQEJZVYh9uIAnFb w5Z2KIA6RMqlQ+dpg/Sklt6x+5+HlD+PIXm2j5AaRW7Q7/P4pPwBBsrc1TWm3xDBK5fcHDS1SHLwu bM7ipamN8jSStoVndkG8EVHF7r6YoH4iZEJwfPUbUqacj+eqHtjPttnQsxJOM7ulo+gaFoJ4TLuXJ Pi/eeEXos6Ug5a6EsjpPr9ibfFFeeZ90e5cHvEAUis5Ygeb9P9jCJMT+eF8B+KLNOCWAZSRNi83vW EId9TrmkQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgP5h-00GmDL-91; Tue, 11 May 2021 09:54:13 +0000 Received: from [198.137.202.133] (helo=bombadil.infradead.org) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgGQC-00FzUN-2D for linux-arm-kernel@desiato.infradead.org; Tue, 11 May 2021 00:38:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Sender:Reply-To:Content-ID:Content-Description; bh=u2R/F8gzBLp/QsX1CQem5LuI8ZQQb+bW1B2JAci57oY=; b=hd3IDp8wYC+MVHdXZVtRfDT5WO klXGNopANhOzSWSc3P5IdSNizWG7N0zSnVCbcSyJJiBY71Qw1HF1gXEPAh4939tWP9JqtIgZa/UvF te4l32wuadL0bZBXN+NWHouUGnYIlxevzMu8Rr918PMsxWX2SoH2yJEwksFfHM94+l0Y6gUcErcNO JJd3U0NrBu0kJuWgtmg1SW2L3RXleeRI1AkRjARMUiNYTAfhzrekEAnm9//4Ij1PPXdDaiT2wpd9z cC6Z5zhbHYoVv9HWqFLvr3ckFJPSWn9wQ8CviLJeX/HCR4QJ4jajkPKe0igf0yxtZ4V+LY0cu0QNd p1dohOPw==; Received: from mx1.opensynergy.com ([217.66.60.4]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgGQ2-009Dn5-TV for linux-arm-kernel@lists.infradead.org; Tue, 11 May 2021 00:38:40 +0000 Received: from SR-MAILGATE-02.opensynergy.com (localhost.localdomain [127.0.0.1]) by mx1.opensynergy.com (Proxmox) with ESMTP id C6EF7A1A28; Tue, 11 May 2021 02:22:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=opensynergy.com; h=cc:cc:content-transfer-encoding:content-type:content-type :date:from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=srmailgate02; bh=u2R/F8gzBLp/ QsX1CQem5LuI8ZQQb+bW1B2JAci57oY=; b=nhH8Ojjk7BDWo/aNGYA5vxOI3ePd gKDHty8/N/wAP6zmG8gU7lFLot0XE6PvT+kDl+/3+fcPqjRzcxpvYutlafycI7Qm afj4d017ZmK6IZrIYEaPdn6QQlsfJBv+rfImvs6ZrgfRzKhSULAU0GNpU5rr1zSu LDULKHxiZh+G6txpVg2MQ2m72Noygpwg2jE4hTJMRy2o6zVMai7FJBXdaCtGOsli ttWSLGJI39K2EFzRGSDCrvD8CWaEt4V9RHxhIu/cSn0NhEPlQHp9JO+fEGry8gXh /CMGKcLRwX7xFUL8wpdPugZUN8+pcfqrpoJw0OdZndxCAdnW8hpDKxOJzQ== From: Peter Hilber To: , CC: Peter Hilber , Rob Herring , , , , , , , , , Vasyl Vavrychuk , Andriy Tryshnivskyy , Cristian Marussi Subject: [RFC PATCH v3 04/12] firmware: arm_scmi: Add optional link_supplier() transport op Date: Tue, 11 May 2021 02:20:32 +0200 Message-ID: <20210511002040.802226-5-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210511002040.802226-1-peter.hilber@opensynergy.com> References: <20210511002040.802226-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-ClientProxiedBy: SR-MAIL-01.open-synergy.com (10.26.10.21) To SR-MAIL-02.open-synergy.com (10.26.10.22) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_173839_136199_D7E4C154 X-CRM114-Status: GOOD ( 11.91 ) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_173839_136199_D7E4C154 X-CRM114-Status: UNSURE ( 9.73 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org For the scmi-virtio transport, it might not be possible to refer to the proper virtio device at device tree build time. Therefore, add an op which will allow scmi-virtio to dynamically link to the proper virtio device during probe. Signed-off-by: Peter Hilber --- drivers/firmware/arm_scmi/common.h | 2 ++ drivers/firmware/arm_scmi/driver.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h index 13be8dedcd6b..d60e3c26821d 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h @@ -283,6 +283,7 @@ struct scmi_chan_info { /** * struct scmi_transport_ops - Structure representing a SCMI transport ops * + * @link_supplier: Optional callback to add link to a supplier device * @chan_available: Callback to check if channel is available or not * @chan_setup: Callback to allocate and setup a channel * @chan_free: Callback to free a channel @@ -297,6 +298,7 @@ struct scmi_chan_info { * @poll_done: Callback to poll transfer status */ struct scmi_transport_ops { + int (*link_supplier)(struct device *dev); bool (*chan_available)(struct device *dev, int idx); int (*chan_setup)(struct scmi_chan_info *cinfo, struct device *dev, bool tx); diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index b7271f8fd1c7..df526ff37c6d 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -1434,6 +1434,12 @@ static int scmi_probe(struct platform_device *pdev) handle->devm_protocol_get = scmi_devm_protocol_get; handle->devm_protocol_put = scmi_devm_protocol_put; + if (desc->ops->link_supplier) { + ret = desc->ops->link_supplier(dev); + if (ret) + return ret; + } + ret = scmi_txrx_setup(info, dev, SCMI_PROTOCOL_BASE); if (ret) return ret;