From patchwork Wed Feb 15 04:12:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 57359 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3359231wrn; Tue, 14 Feb 2023 20:15:38 -0800 (PST) X-Google-Smtp-Source: AK7set+no6TV5aBoRlCSMpYZzJl0CogD1UK0tKLMXJqNbCAXag3WVcIDUXcK+wTGMnFTF63YX01c X-Received: by 2002:a17:906:af08:b0:8b1:3a1c:3174 with SMTP id lx8-20020a170906af0800b008b13a1c3174mr718220ejb.77.1676434538272; Tue, 14 Feb 2023 20:15:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676434538; cv=none; d=google.com; s=arc-20160816; b=PC20vGeYN1nCJHuqWBfOBJKW/ekOP4JG7NpkgCewl8XN+DA8QDIObidy5OPRXbrwSN SinqmD1zNz2gFiwcPlMjsqOhaEpmhfQyesXr3or95NIlrSLs9kvETY6YRX2oD3I42qUT UPhYjm7g2mQ/XllEwjLj2ns4XiVtvH0S1hEinGDSVW2feBt/H6MD/I+J11E1aiZK9zyl WYoALqzuwT1ZntSw93qsFaLfJtPwttBXhu9jJ8EaAWq0tAt26alw1JYX9cDEGHTeS9pU VTag6TyV/jeA21R3QqXg7UJqvJ7fokomPR3Yc0Q+JdY8JbXPsTSCC0Dynx44pfZgZczO Zwww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=X5BMOUCftBqUoS89OY1vJghk0U8zsFcVshTFWmsRm4E=; b=ZpAUDd2iJWWG40metuzCUKwTEa1/jCsrho36Urvm76AMwVbZcMcK+Ur/oIeQEBqxwU rgMAosYHcFrnqT0wlSXQcwG8ZP4XRpTITYP6FNA6t4zN7NDUtoD8csT2AlRq3xBt/6V8 oXBLFPFQhwSgKfIEi76Q+5a9dSCcU8tU4FRcze9AWQ5fIch2hcWGNCaiyzIljPuzRMFr w0PKpblLvSKaGXVKgs5XnwOwbuiDtCeIreCSz+YKowkDpDpWuKubI4rDs+ZAYtP2x6Dq GdGz7ljQsy/MdCzTS/HTRc/IFEwZkMnhsRWPK7pmbMDjv6XBrWfzdHOIORSRPwVgDXCk FxGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ejyq+YHS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 10-20020a17090600ca00b0088c5e867083si18230158eji.807.2023.02.14.20.14.50; Tue, 14 Feb 2023 20:15:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ejyq+YHS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232733AbjBOENX (ORCPT + 99 others); Tue, 14 Feb 2023 23:13:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230474AbjBOENJ (ORCPT ); Tue, 14 Feb 2023 23:13:09 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 916D5241C5; Tue, 14 Feb 2023 20:13:07 -0800 (PST) X-UUID: 087eaf78ace711ed945fc101203acc17-20230215 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=X5BMOUCftBqUoS89OY1vJghk0U8zsFcVshTFWmsRm4E=; b=ejyq+YHSI5KVfeI5h6KewDKUTNARh3EhbjVxUKBG7kYh1H9Qrz8ROj6qLA6y3fw2rvEKJBoCq8pZsmoJ6FLhkhRaQB4AUGHZxJjAtgniJyLVt72igHKslMrHtCxA9kYLQ/d8yp82hjTQur0Gi9vIUi8hWQ1g2hOYFyuznuPsmRI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:3910c56a-e317-4df8-801e-204e851437cd,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:ba739b25-564d-42d9-9875-7c868ee415ec,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-UUID: 087eaf78ace711ed945fc101203acc17-20230215 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 456755916; Wed, 15 Feb 2023 12:12:59 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 15 Feb 2023 12:12:58 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 15 Feb 2023 12:12:58 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v7 01/12] dt-bindings: remoteproc: mediatek: Improve the rpmsg subnode definition Date: Wed, 15 Feb 2023 12:12:46 +0800 Message-ID: <20230215041257.14548-2-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215041257.14548-1-tinghan.shen@mediatek.com> References: <20230215041257.14548-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757869022134669820?= X-GMAIL-MSGID: =?utf-8?q?1757869022134669820?= Improve the definition of the rpmsg subnode by assigning a distinct node name and adding the definition source of node properties. Signed-off-by: Tinghan Shen Acked-by: Rob Herring --- .../bindings/remoteproc/mtk,scp.yaml | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml index 895415772d1d..271081df0e46 100644 --- a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +++ b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml @@ -58,6 +58,18 @@ properties: memory-region: maxItems: 1 + cros-ec-rpmsg: + $ref: /schemas/mfd/google,cros-ec.yaml + description: + This subnode represents the rpmsg device. The properties + of this node are defined by the individual bindings for + the rpmsg devices. + + required: + - mediatek,rpmsg-name + + unevaluatedProperties: false + required: - compatible - reg @@ -89,21 +101,7 @@ allOf: reg-names: maxItems: 2 -additionalProperties: - type: object - description: - Subnodes of the SCP represent rpmsg devices. The names of the devices - are not important. The properties of these nodes are defined by the - individual bindings for the rpmsg devices. - properties: - mediatek,rpmsg-name: - $ref: /schemas/types.yaml#/definitions/string-array - description: - Contains the name for the rpmsg device. Used to match - the subnode to rpmsg device announced by SCP. - - required: - - mediatek,rpmsg-name +additionalProperties: false examples: - | @@ -118,7 +116,8 @@ examples: clocks = <&infracfg CLK_INFRA_SCPSYS>; clock-names = "main"; - cros_ec { + cros-ec-rpmsg { + compatible = "google,cros-ec-rpmsg"; mediatek,rpmsg-name = "cros-ec-rpmsg"; }; }; From patchwork Wed Feb 15 04:12:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 57364 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3359517wrn; Tue, 14 Feb 2023 20:16:29 -0800 (PST) X-Google-Smtp-Source: AK7set8siLXmQUyJ9v+Ppn7jwczAwBsR3Jq4l0rZWF8avfWxwTSMYLWphKjhC+/oJKpYSMpppgNZ X-Received: by 2002:a17:906:f759:b0:885:fee4:69ee with SMTP id jp25-20020a170906f75900b00885fee469eemr812459ejb.59.1676434589387; Tue, 14 Feb 2023 20:16:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676434589; cv=none; d=google.com; s=arc-20160816; b=quajlNwu7hFSsEUFannKmFF6pbhj0E32VmpOiSeaMLeERdIfCNP8Sj9ahumkALd0v+ 3vaXgeVfNboyareNbKPlxCvxw5noQypyeH3U5+axT/iM+dBCN0ekbEzmm9DzH2l4Eb1W 4pZkpnnRFqeo40ga1o2GzOC1exyirfqIGRJLcwaJ2bXhqaws7st0b/JLpeVhuOqd/363 9gvf2w6dHte20kRgOcKCQPVjquNEKhJ4lkbQI0NF3/z3bhN9WPf9VzfPe4Hg6gAIrmF4 gpzT5zHwNaMlcKn9kF/rY71gj1MUel/WpWQfGxiPYQp0/waKgFesP179WjxzMch387jv uxvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=pUSE1wzbu3r1aEcwMoKUD5CVWfuQSPXwRVeJZfMrP8w=; b=NlnlVmmNYJCc9mv0XyVgEIHODUeb5kqNVPVeWROAeOnfj6AYOZKS+YsNpWbP9pqyqT MQKxVYXmFumGulW3hee9lQq0iNF7JIF7nPIvvgzUGzQVvGQPvOAHDHHvHpbt6EQaROZN /MkjM1PNYTz9VsmaOSzRDYyEEFw7DjLxsk3ZnqGF62Js+AxTBnnC9dzhzx5VzCcMKoyh xnWu7sA3bt0AEUc4xtILUOjIlUB18NrHNm+Wrf8kYmg5OahQijVEe50bsVEa0jX3cKOy U/fDvOJe7vg3kt73AI49cS4JraciQoWTTLM8dEakmDwsAb2F+A23CQW3CzhGkW6kM8B9 au8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=YPEz8+6d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v18-20020a17090651d200b0088d52f894c1si19408529ejk.861.2023.02.14.20.16.04; Tue, 14 Feb 2023 20:16:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=YPEz8+6d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232248AbjBOENs (ORCPT + 99 others); Tue, 14 Feb 2023 23:13:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231976AbjBOENP (ORCPT ); Tue, 14 Feb 2023 23:13:15 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AA7B32CFD; Tue, 14 Feb 2023 20:13:08 -0800 (PST) X-UUID: 088f2970ace711eda06fc9ecc4dadd91-20230215 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=pUSE1wzbu3r1aEcwMoKUD5CVWfuQSPXwRVeJZfMrP8w=; b=YPEz8+6dA4Eybwf23hZUL3RfvJ9ICBvVbTeFri1NJdXVn6Lf6/aoFj4fl/nZAPWG/Nh6zuOMCiLn7rduBtqLCuw4BuhdVrEk1NpumPevZCO5lRGJDgKwi2yAZW3MXoOiV/cVdyaFcCzoxbHTy7oNU1fEEI64utQ1TQtycbbkpMA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:11429357-20d5-4566-a3f1-f53fe999e9d0,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:f4197cb0-beed-4dfc-bd9c-e1b22fa6ccc4,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 088f2970ace711eda06fc9ecc4dadd91-20230215 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1907363742; Wed, 15 Feb 2023 12:12:59 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 15 Feb 2023 12:12:58 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 15 Feb 2023 12:12:58 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v7 02/12] arm64: dts: mediatek: mt8183-kukui: Update the node name of SCP rpmsg subnode Date: Wed, 15 Feb 2023 12:12:47 +0800 Message-ID: <20230215041257.14548-3-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215041257.14548-1-tinghan.shen@mediatek.com> References: <20230215041257.14548-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757869075958830138?= X-GMAIL-MSGID: =?utf-8?q?1757869075958830138?= Align the node name with the definition in SCP bindings. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi index fbe14b13051a..a259eb043de5 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi @@ -810,7 +810,7 @@ pinctrl-names = "default"; pinctrl-0 = <&scp_pins>; - cros_ec { + cros-ec-rpmsg { compatible = "google,cros-ec-rpmsg"; mediatek,rpmsg-name = "cros-ec-rpmsg"; }; From patchwork Wed Feb 15 04:12:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 57361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3359279wrn; Tue, 14 Feb 2023 20:15:48 -0800 (PST) X-Google-Smtp-Source: AK7set+XDld2EdFPL4IlTdC5j8SwZirD+5Om67mZwE5YfAyJvvscqvqFyEru29YstNMOdTEiog8y X-Received: by 2002:a17:907:a0c6:b0:88c:617f:bcf8 with SMTP id hw6-20020a170907a0c600b0088c617fbcf8mr791604ejc.61.1676434548795; Tue, 14 Feb 2023 20:15:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676434548; cv=none; d=google.com; s=arc-20160816; b=zmOqU3HAP62a9IijQQBCJWOTNGA+51U6CpxthnorMjQbi7IQ5Tikqym2jvl1fB5p7E p0lWuiQ7L71bOzkua5NNhcAEOJHs3ItYVVyi18rkZhp7rwn7moAiOa9xloafsJUgjLcJ obBXJiR2hPZ+8zJXabzVlm7Cq2KJk5lsUP8miTykNgLP00eGV1B4ydN1gE4iR9N/zygP f9eWh1w3OQv44bDfpTjKGmbXkyQc01C+a87azKrC8+UP3gfzDLcC42De3t2M491rM+RU oSkN9tgRS43qZ1/L1UCr/jtoDAF41N3e5t4QItq29bPgl5TmeWmhsibz5X1bKb7njiga cumQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=mHZvfrM0o5UaIt01vL+X0Xi78aCQjddfdApBpcmPqT8=; b=UN8GEmjZlHkWO5aip1NhdwdbPCAX3BSVY4UfeKWOZesLF2fHYpvlhA/xvxUfcdlhvr NsvPiHkvB2G2ARiRWC4lih+sshKK3NSAZNN/cZDqcz25zMscmVEdiqqQOVvFGwRPkJlZ efSK6XG86xa0pWJMOvt545/lkeLsm4El5tvyEe3kGelyWs8+MkVus2H6x7HT2pTvph8H x47eI6KL8XaoFqVgQkQZXWF9TzlKjI78gEHS8cwu8gX4kYV9d8MC2k+7eYZ91hRIVCe2 xDofgYmNA4ruSogTO2A/fKmNFNVUR7xlSaDA/YVghdUJZgJzp7glLKryKw7RgSBqIADv h2Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Z9LncKUI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id uk32-20020a170907ca2000b008966b5ebe4asi17458723ejc.883.2023.02.14.20.15.25; Tue, 14 Feb 2023 20:15:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Z9LncKUI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232953AbjBOENz (ORCPT + 99 others); Tue, 14 Feb 2023 23:13:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbjBOENS (ORCPT ); Tue, 14 Feb 2023 23:13:18 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 200AC32E51; Tue, 14 Feb 2023 20:13:09 -0800 (PST) X-UUID: 08a4023cace711eda06fc9ecc4dadd91-20230215 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=mHZvfrM0o5UaIt01vL+X0Xi78aCQjddfdApBpcmPqT8=; b=Z9LncKUIRYhJ9WAMGvEEdYNropP7PpQT0zl/VIRFHWNdfAgl4xe53+lXZ0hVIkqzefhGbG7TjGj5tnSLT5PkGKTcKiEwh5c1F/Ida6rPY+KeWi0A7caC9PHc4CRrQRsqi2Xyr51it1qlQEuW/mG5o/fM1Ib5YjIBQDQephJJNCo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:6db1eefd-dc94-403d-9ff8-ee1ea7a5f769,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.19,REQID:6db1eefd-dc94-403d-9ff8-ee1ea7a5f769,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:885ddb2,CLOUDID:377709f3-ddba-41c3-91d9-10eeade8eac7,B ulkID:2302151213023LJW723J,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 08a4023cace711eda06fc9ecc4dadd91-20230215 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1737384476; Wed, 15 Feb 2023 12:13:00 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Wed, 15 Feb 2023 12:12:58 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 15 Feb 2023 12:12:58 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v7 03/12] dt-bindings: remoteproc: mediatek: Support MT8195 dual-core SCP Date: Wed, 15 Feb 2023 12:12:48 +0800 Message-ID: <20230215041257.14548-4-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215041257.14548-1-tinghan.shen@mediatek.com> References: <20230215041257.14548-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757869033575638492?= X-GMAIL-MSGID: =?utf-8?q?1757869033575638492?= Extend the SCP binding to describe the MT8195 dual-core SCP. Under different applications, the MT8195 SCP can be used as single-core or dual-core. This change keeps the single-core definitions and adds new definitions for the dual-core use case. Signed-off-by: Tinghan Shen Reviewed-by: Rob Herring Reviewed-by: AngeloGioacchino Del Regno --- .../bindings/remoteproc/mtk,scp.yaml | 145 +++++++++++++++++- 1 file changed, 141 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml index 271081df0e46..09102dda4942 100644 --- a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +++ b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml @@ -21,6 +21,7 @@ properties: - mediatek,mt8188-scp - mediatek,mt8192-scp - mediatek,mt8195-scp + - mediatek,mt8195-scp-dual reg: description: @@ -31,10 +32,7 @@ properties: reg-names: minItems: 2 - items: - - const: sram - - const: cfg - - const: l1tcm + maxItems: 3 clocks: description: @@ -70,6 +68,81 @@ properties: unevaluatedProperties: false + '#address-cells': + const: 1 + + '#size-cells': + const: 1 + + ranges: + description: + Standard ranges definition providing address translations for + local SCP SRAM address spaces to bus addresses. + +patternProperties: + "^scp@[a-f0-9]+$": + type: object + description: + The MediaTek SCP integrated to SoC might be a multi-core version. + The other cores are represented as child nodes of the boot core. + There are some integration differences for the IP like the usage of + address translator for translating SoC bus addresses into address space + for the processor. + + Each SCP core has own cache memory. The SRAM and L1TCM are shared by + cores. The power of cache, SRAM and L1TCM power should be enabled + before booting SCP cores. The size of cache, SRAM, and L1TCM are varied + on differnt SoCs. + + The SCP cores do not use an MMU, but has a set of registers to + control the translations between 32-bit CPU addresses into system bus + addresses. Cache and memory access settings are provided through a + Memory Protection Unit (MPU), programmable only from the SCP. + + properties: + compatible: + enum: + - mediatek,scp-core + + reg: + description: The base address and size of SRAM. + maxItems: 1 + + reg-names: + const: sram + + interrupts: + maxItems: 1 + + firmware-name: + $ref: /schemas/types.yaml#/definitions/string + description: + If present, name (or relative path) of the file within the + firmware search path containing the firmware image used when + initializing sub cores of multi-core SCP. + + memory-region: + maxItems: 1 + + cros-ec-rpmsg: + $ref: /schemas/mfd/google,cros-ec.yaml + description: + This subnode represents the rpmsg device. The properties + of this node are defined by the individual bindings for + the rpmsg devices. + + required: + - mediatek,rpmsg-name + + unevaluatedProperties: false + + required: + - compatible + - reg + - reg-names + + additionalProperties: false + required: - compatible - reg @@ -99,7 +172,37 @@ allOf: reg: maxItems: 2 reg-names: + items: + - const: sram + - const: cfg + - if: + properties: + compatible: + enum: + - mediatek,mt8192-scp + - mediatek,mt8195-scp + then: + properties: + reg: + maxItems: 3 + reg-names: + items: + - const: sram + - const: cfg + - const: l1tcm + - if: + properties: + compatible: + enum: + - mediatek,mt8195-scp-dual + then: + properties: + reg: maxItems: 2 + reg-names: + items: + - const: cfg + - const: l1tcm additionalProperties: false @@ -121,3 +224,37 @@ examples: mediatek,rpmsg-name = "cros-ec-rpmsg"; }; }; + + - | + scp@10500000 { + compatible = "mediatek,mt8195-scp-dual"; + reg = <0x10720000 0xe0000>, + <0x10700000 0x8000>; + reg-names = "cfg", "l1tcm"; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x10500000 0x100000>; + + scp@0 { + compatible = "mediatek,scp-core"; + reg = <0x0 0xa0000>; + reg-names = "sram"; + + cros-ec-rpmsg { + compatible = "google,cros-ec-rpmsg"; + mediatek,rpmsg-name = "cros-ec-rpmsg"; + }; + }; + + scp@a0000 { + compatible = "mediatek,scp-core"; + reg = <0xa0000 0x20000>; + reg-names = "sram"; + + cros-ec-rpmsg { + compatible = "google,cros-ec-rpmsg"; + mediatek,rpmsg-name = "cros-ec-rpmsg"; + }; + }; + }; From patchwork Wed Feb 15 04:12:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 57357 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3359213wrn; Tue, 14 Feb 2023 20:15:35 -0800 (PST) X-Google-Smtp-Source: AK7set9ETEn5b0dh56f3IxcOY2Bumqn27BstSsfKYW1jPFLOnCgV4TMzeu63a9UofXLCGGkrXjzT X-Received: by 2002:a50:fa8a:0:b0:4aa:a4ea:cdc9 with SMTP id w10-20020a50fa8a000000b004aaa4eacdc9mr595183edr.16.1676434534991; Tue, 14 Feb 2023 20:15:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676434534; cv=none; d=google.com; s=arc-20160816; b=JVWE8LRUjq8lJWvWTJIVkMPyL/gZixovknUAaJBAxthSwT0hmVabpmJrZuoeEIxwPb 9i/QpcTTEM94AVT3oTwXYU8VM4S/oD/NnJBSNNf0IYh66DYG3D65A30EsXMnToIiqM8T x16jEkemix2itSC9f7gCKf0fu6nhcJLOKHR0RUTjBzPI2+fShWwKvWK2DMbmkSvRPAzx APxFuX69xzC3XXu0TeezoiP8YiNoO1TJqjfjq41EMTol1gSLQbbZZ17UOQo+Skj7Dl2/ SBpsbCGrtT/HQ0kIT/KFfZjvVklHIUKjJMBePXVZFSqJNvixeqgWZNZzQoSzH4mI/20/ UiKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6HhKK4J2H3bm5JiXJDgPozBzQTQbRGkWm2dygfVNSZ0=; b=cGeMaO+25rzTXpxK5QrOtRAVRHJQd1I+ZpIAGUGBP4FbDIeu/HuqWuI9J9EB1SbzuT fjnyiJR2heFW1BBcDBLveb0IwtBpleDUCAcyzwnBY4/1PSpxT78D6Vse+wf6WCXgamK3 dg/+3kB/qXUapoWZWCnRVzBY/aMnnaT75zFML2nENh5fkxlSYtK6mjUD1c3GpZUwEZyL BTbqoStFwHEeq6bm3dtEGIk8NgvtvDVvjejqQpCbPkpCtu/GQEJu7rA2JpIVzseg+wE9 dFE1+i61U3eEMdn+3hEsZe2pnv1fUOMQFfuXuj5/Q3f4Sbbdw51+Q/oes17JVRRmkd9P 9pyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=DtaBOIVm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a056402151100b004acb37caea9si13228793edw.344.2023.02.14.20.14.45; Tue, 14 Feb 2023 20:15:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=DtaBOIVm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232163AbjBOENa (ORCPT + 99 others); Tue, 14 Feb 2023 23:13:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231174AbjBOENL (ORCPT ); Tue, 14 Feb 2023 23:13:11 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A46F824C8E; Tue, 14 Feb 2023 20:13:07 -0800 (PST) X-UUID: 0881b100ace711ed945fc101203acc17-20230215 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=6HhKK4J2H3bm5JiXJDgPozBzQTQbRGkWm2dygfVNSZ0=; b=DtaBOIVmKMNeM3Y4vauIQSSS4kBUuyGbmZtkGF1sUS+ma9BY0xFURoPlVgwEthIBjjm5PIvqeKKxXq7DJvOoR3LJ+3wHCHAM0tCVJJ4R1GF6KY+Ll+XmDheYfG+ISpfccM40irHR4jyYJf7KTuyOuBhCXFKQiVyjdTr9Cbbv7Y0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:af47e1e1-deb5-4ffa-999b-9b7ffa39fa2b,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:885ddb2,CLOUDID:f57609f3-ddba-41c3-91d9-10eeade8eac7,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 0881b100ace711ed945fc101203acc17-20230215 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 257835529; Wed, 15 Feb 2023 12:12:59 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 15 Feb 2023 12:12:58 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 15 Feb 2023 12:12:58 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v7 04/12] remoteproc: mediatek: Add SCP core 1 register definitions Date: Wed, 15 Feb 2023 12:12:49 +0800 Message-ID: <20230215041257.14548-5-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215041257.14548-1-tinghan.shen@mediatek.com> References: <20230215041257.14548-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757869019148636127?= X-GMAIL-MSGID: =?utf-8?q?1757869019148636127?= Add MT8195 SCP core 1 related register definitions. Signed-off-by: Tinghan Shen Reviewed-by: Mathieu Poirier Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_common.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index ea6fa1100a00..3778894c96f3 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -47,6 +47,7 @@ #define MT8192_SCP2SPM_IPC_CLR 0x4094 #define MT8192_GIPC_IN_SET 0x4098 #define MT8192_HOST_IPC_INT_BIT BIT(0) +#define MT8195_CORE1_HOST_IPC_INT_BIT BIT(4) #define MT8192_CORE0_SW_RSTN_CLR 0x10000 #define MT8192_CORE0_SW_RSTN_SET 0x10004 @@ -56,6 +57,26 @@ #define MT8195_L1TCM_SRAM_PDN_RESERVED_RSI_BITS GENMASK(7, 4) +#define MT8195_CPU1_SRAM_PD 0x1084 +#define MT8195_SSHUB2APMCU_IPC_SET 0x4088 +#define MT8195_SSHUB2APMCU_IPC_CLR 0x408C +#define MT8195_CORE1_SW_RSTN_CLR 0x20000 +#define MT8195_CORE1_SW_RSTN_SET 0x20004 +#define MT8195_CORE1_MEM_ATT_PREDEF 0x20008 +#define MT8195_CORE1_WDT_IRQ 0x20030 +#define MT8195_CORE1_WDT_CFG 0x20034 + +#define MT8195_SEC_CTRL 0x85000 +#define MT8195_CORE_OFFSET_ENABLE_D BIT(13) +#define MT8195_CORE_OFFSET_ENABLE_I BIT(12) +#define MT8195_L2TCM_OFFSET_RANGE_0_LOW 0x850b0 +#define MT8195_L2TCM_OFFSET_RANGE_0_HIGH 0x850b4 +#define MT8195_L2TCM_OFFSET 0x850d0 +#define SCP_SRAM_REMAP_LOW 0 +#define SCP_SRAM_REMAP_HIGH 1 +#define SCP_SRAM_REMAP_OFFSET 2 +#define SCP_SRAM_REMAP_SIZE 3 + #define SCP_FW_VER_LEN 32 #define SCP_SHARE_BUFFER_SIZE 288 From patchwork Wed Feb 15 04:12:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 57362 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3359317wrn; Tue, 14 Feb 2023 20:15:58 -0800 (PST) X-Google-Smtp-Source: AK7set/0QR0nslY5Qi0gI6I4O0iZ8jnvBrc0dM8BWd3/PXc2rMVhH3kPc/CxXVerO4w8+JXTgK6K X-Received: by 2002:a17:906:52d3:b0:878:4497:380e with SMTP id w19-20020a17090652d300b008784497380emr895660ejn.4.1676434557925; Tue, 14 Feb 2023 20:15:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676434557; cv=none; d=google.com; s=arc-20160816; b=uw29UU3+E1IWTjhj2TmDgJTvr+0+VJVNok509IgG1oNcfsBmdBwXf/Mi3PbYoHLPz1 K+hWVbfMIhjrdiC1Otz/lCFxt2vLvjtR/XTLR9LO51BLXsg8gXgKpshumgwK2fIk2bFb tn4EEAWcLKCe3lPu8gUb71E6sH/yRadTDh5EPb5QUeNQ6yMcirhUsgKXnzoQa9fhuGf2 7XK3QfuVbL+C3MIIkMisXuJJ1ct8LmyYmdhKsEA0B2gc/J+8aZh3Pk8GBX+JMmTmq7sY 1siyCIDYroN2KXzV9s3OLeraLW3ItGS7MfAIfknc+dW8Pqmc90F8sbtPzo7XxVbxdTZE qUGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ZPukmFblSDOhKGdJveDJRXItvWMeroQVQlFmp2r15NQ=; b=xBzFfohDsNR6WBWQfIpmfp3HBjT5JxJbbBV0EFNQQeK5PccYPSbcXBrhfyqagCPLUe Oi+h6nMkfL5nhPFY4XHihezWAb5LIz7flsuxMX/r3sI1zdMhj9uaPerjVp0F4vbsS5eO 9B06/xNvdp+ibSBjkc8UX0HHDugBBZNZo+nRWdHbTK9zGz5Zp0xpCrBCA0z0LVSScWuY V1DsifUDnw/J3AGLEPIzhJeEro/kO9qiUzhp/Iox+S0ASrHAqoUunNnjH1Q5x11L/UiS skAi2mkLwZqE6uFzjQP/L7a6GJFEM65UrSx3M9by+Qz/7WphpP94VVPrF2XK4D6+7E8t UHog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="ZSRC1N/o"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a1709063f0c00b00893526bc776si22133461ejj.231.2023.02.14.20.15.34; Tue, 14 Feb 2023 20:15:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="ZSRC1N/o"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233172AbjBOEOA (ORCPT + 99 others); Tue, 14 Feb 2023 23:14:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232370AbjBOENS (ORCPT ); Tue, 14 Feb 2023 23:13:18 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3251132E53; Tue, 14 Feb 2023 20:13:10 -0800 (PST) X-UUID: 08912ea0ace711eda06fc9ecc4dadd91-20230215 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=ZPukmFblSDOhKGdJveDJRXItvWMeroQVQlFmp2r15NQ=; b=ZSRC1N/o7pg1/fQSk7QAVvkB+UKthBrxEfR6pSQsAeVeeTWZGfY+5uCD6PFYR5JjD3ajTGjYmsBi5FrF9z/7Sa03qv6yr2CqxNcUXq+ooTB0hJMqgM9q5lSZObDAGioQL4c85ils2zs/8r+Q6dVNoCg9V6S0x+YkGNYESBGPZow=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:c1b5cdf7-b795-445c-a115-934664e0e729,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:347709f3-ddba-41c3-91d9-10eeade8eac7,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 08912ea0ace711eda06fc9ecc4dadd91-20230215 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1285914044; Wed, 15 Feb 2023 12:12:59 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 15 Feb 2023 12:12:59 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 15 Feb 2023 12:12:59 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v7 05/12] remoteproc: mediatek: Add MT8195 SCP core 1 operations Date: Wed, 15 Feb 2023 12:12:50 +0800 Message-ID: <20230215041257.14548-6-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215041257.14548-1-tinghan.shen@mediatek.com> References: <20230215041257.14548-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757869042631694808?= X-GMAIL-MSGID: =?utf-8?q?1757869042631694808?= The SCP rproc driver has a set of chip dependent callbacks for boot sequence and IRQ handling. Implement these callbacks for MT8195 SCP core 1. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_scp.c | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index d421a2ccaa1e..b92274067522 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -176,6 +176,16 @@ static void mt8192_scp_reset_deassert(struct mtk_scp *scp) writel(1, scp->reg_base + MT8192_CORE0_SW_RSTN_CLR); } +static void mt8195_scp_c1_reset_assert(struct mtk_scp *scp) +{ + writel(1, scp->reg_base + MT8195_CORE1_SW_RSTN_SET); +} + +static void mt8195_scp_c1_reset_deassert(struct mtk_scp *scp) +{ + writel(1, scp->reg_base + MT8195_CORE1_SW_RSTN_CLR); +} + static void mt8183_scp_irq_handler(struct mtk_scp *scp) { u32 scp_to_host; @@ -212,6 +222,18 @@ static void mt8192_scp_irq_handler(struct mtk_scp *scp) } } +static void mt8195_scp_c1_irq_handler(struct mtk_scp *scp) +{ + u32 scp_to_host; + + scp_to_host = readl(scp->reg_base + MT8195_SSHUB2APMCU_IPC_SET); + + if (scp_to_host & MT8192_SCP_IPC_INT_BIT) + scp_ipi_handler(scp); + + writel(scp_to_host, scp->reg_base + MT8195_SSHUB2APMCU_IPC_CLR); +} + static irqreturn_t scp_irq_handler(int irq, void *priv) { struct mtk_scp *scp = priv; @@ -453,6 +475,19 @@ static int mt8195_scp_before_load(struct mtk_scp *scp) return 0; } +static int mt8195_scp_c1_before_load(struct mtk_scp *scp) +{ + scp_sram_power_on(scp->reg_base + MT8195_CPU1_SRAM_PD, 0); + + /* hold SCP in reset while loading FW. */ + scp->data->scp_reset_assert(scp); + + /* enable MPU for all memory regions */ + writel(0xff, scp->reg_base + MT8195_CORE1_MEM_ATT_PREDEF); + + return 0; +} + static int scp_load(struct rproc *rproc, const struct firmware *fw) { struct mtk_scp *scp = rproc->priv; @@ -625,6 +660,15 @@ static void mt8195_scp_stop(struct mtk_scp *scp) writel(0, scp->reg_base + MT8192_CORE0_WDT_CFG); } +static void mt8195_scp_c1_stop(struct mtk_scp *scp) +{ + /* Power off CPU SRAM */ + scp_sram_power_off(scp->reg_base + MT8195_CPU1_SRAM_PD, 0); + + /* Disable SCP watchdog */ + writel(0, scp->reg_base + MT8195_CORE1_WDT_CFG); +} + static int scp_stop(struct rproc *rproc) { struct mtk_scp *scp = (struct mtk_scp *)rproc->priv; @@ -990,6 +1034,18 @@ static const struct mtk_scp_of_data mt8195_of_data = { .host_to_scp_int_bit = MT8192_HOST_IPC_INT_BIT, }; +static const struct mtk_scp_of_data mt8195_of_data_c1 = { + .scp_clk_get = mt8195_scp_clk_get, + .scp_before_load = mt8195_scp_c1_before_load, + .scp_irq_handler = mt8195_scp_c1_irq_handler, + .scp_reset_assert = mt8195_scp_c1_reset_assert, + .scp_reset_deassert = mt8195_scp_c1_reset_deassert, + .scp_stop = mt8195_scp_c1_stop, + .scp_da_to_va = mt8192_scp_da_to_va, + .host_to_scp_reg = MT8192_GIPC_IN_SET, + .host_to_scp_int_bit = MT8195_CORE1_HOST_IPC_INT_BIT, +}; + static const struct of_device_id mtk_scp_of_match[] = { { .compatible = "mediatek,mt8183-scp", .data = &mt8183_of_data }, { .compatible = "mediatek,mt8186-scp", .data = &mt8186_of_data }, From patchwork Wed Feb 15 04:12:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 57356 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3359083wrn; Tue, 14 Feb 2023 20:15:11 -0800 (PST) X-Google-Smtp-Source: AK7set/Z5+cNKAc5U/iJybSC6NubvD8G8Ug/V1kL/HsH68841sBKdww9cnkTdWBSsp/o1zLO2yW3 X-Received: by 2002:a17:907:98e6:b0:88b:109e:fbd3 with SMTP id ke6-20020a17090798e600b0088b109efbd3mr813330ejc.24.1676434511423; Tue, 14 Feb 2023 20:15:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676434511; cv=none; d=google.com; s=arc-20160816; b=wlF9DuOTz8MbI4dmHX4v2Ax6JNLTSLHrP66yDON2VUDwiav+6/vHGZVYsTmuzZAb8o WwhUV+fW7C+nBW0NcCvTAvtfdaU3PCM9wVDpDt7Kw3xc9pQ0zacGqdzI5v5q55qJ0ttX Va5P5Oz5ITWOcxMXDui4YuHvhfrXYDCoVhNTOnnnevE3cczIDJl6A1mPPuWWrSuDdxOH Pa3yn4aEQ6lID0ycRtd2OoVN6+ROCQ7j0onCWKSfsedsIk+2QW/U2LLGMsxRgexKkCBn QaKb45Qu3ETk3fVU1OXI7Jyilmz9v7pD5I8e5/+kXaVVE4USn2qAOz5j/w6a1UkBQuK/ gWgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=mzCsW2cWM5Qj34kAnxo7LScswdN78aRPfGLwPzdj4eA=; b=EtiQ8UjRNk02WyE4IkyfuHadSH+fVRa8tXCSyad9r51e2vnoMPi9VtEqnDZKz0ZGpS TvFXTiuO4dgyNJVG2bggrIIdj1ZbHbX6G1sIGzA+2S0bOAEe/aToLLx7NStEeJ3uyjoU HKR9XYZXazsMXz3EUW7+gKnR5b8DSMd8bsAeyIe9jQYCUvkTZ4vpvNC+cAUW5j2/qFrV +HkC7eGw7/Az0qUKHVibtqrRNOOAPQuUGNMmPsmfwUeburv9HgOqPnaGCJCuhUOFhWBI TsjJHkBN3XxKq5EgOWf1NlqR14Jmk4noy3chRJFdfguXcHAVBmcC+MUCKWwj+dFRu3U7 o9gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=YlI5pRLN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d5-20020a50ea85000000b004aaa505ac5fsi22248581edo.76.2023.02.14.20.14.47; Tue, 14 Feb 2023 20:15:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=YlI5pRLN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232979AbjBOEN0 (ORCPT + 99 others); Tue, 14 Feb 2023 23:13:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230489AbjBOENK (ORCPT ); Tue, 14 Feb 2023 23:13:10 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3662A1024E; Tue, 14 Feb 2023 20:13:06 -0800 (PST) X-UUID: 0900e646ace711eda06fc9ecc4dadd91-20230215 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=mzCsW2cWM5Qj34kAnxo7LScswdN78aRPfGLwPzdj4eA=; b=YlI5pRLNnwbhP/rinSRGF/IjaAcoKudPLNlfeCbNcT+07ikFUJkIuaBk1xLsqZzxDZK0kcOo6foAxntSGkSoq80hZ8SjlddCIUkHclOjvKMBXAIRanwW78Sj58FYjfnhaUaa64LHT5s5vFnlBSoJB5vRxdv8c3WPplQaADOTjpM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:4d63087a-0e3e-4b5c-8455-d99a93f5e115,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:885ddb2,CLOUDID:3b7709f3-ddba-41c3-91d9-10eeade8eac7,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 0900e646ace711eda06fc9ecc4dadd91-20230215 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1079482391; Wed, 15 Feb 2023 12:13:00 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 15 Feb 2023 12:12:59 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 15 Feb 2023 12:12:59 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v7 06/12] remoteproc: mediatek: Extract remoteproc initialization flow Date: Wed, 15 Feb 2023 12:12:51 +0800 Message-ID: <20230215041257.14548-7-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215041257.14548-1-tinghan.shen@mediatek.com> References: <20230215041257.14548-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757868994195064109?= X-GMAIL-MSGID: =?utf-8?q?1757868994195064109?= This is the preparation for probing multi-core SCP. The remoteproc initialization flow is similar on cores and is reuesd to avoid redundant code. The registers of config and l1tcm are shared for multi-core SCP. Reuse the mapped addresses for all cores. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_scp.c | 62 ++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index b92274067522..6270c388727a 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -23,6 +23,13 @@ #define MAX_CODE_SIZE 0x500000 #define SECTION_NAME_IPI_BUFFER ".ipi_buffer" +struct mtk_scp_of_regs { + void __iomem *reg_base; + void __iomem *l1tcm_base; + size_t l1tcm_size; + phys_addr_t l1tcm_phys; +}; + /** * scp_get() - get a reference to SCP. * @@ -854,7 +861,8 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) } } -static int scp_probe(struct platform_device *pdev) +static int scp_rproc_init(struct platform_device *pdev, + struct mtk_scp_of_regs *of_regs) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; @@ -878,6 +886,11 @@ static int scp_probe(struct platform_device *pdev) scp->data = of_device_get_match_data(dev); platform_set_drvdata(pdev, scp); + scp->reg_base = of_regs->reg_base; + scp->l1tcm_base = of_regs->l1tcm_base; + scp->l1tcm_size = of_regs->l1tcm_size; + scp->l1tcm_phys = of_regs->l1tcm_phys; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram"); scp->sram_base = devm_ioremap_resource(dev, res); if (IS_ERR(scp->sram_base)) @@ -887,24 +900,6 @@ static int scp_probe(struct platform_device *pdev) scp->sram_size = resource_size(res); scp->sram_phys = res->start; - /* l1tcm is an optional memory region */ - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm"); - scp->l1tcm_base = devm_ioremap_resource(dev, res); - if (IS_ERR(scp->l1tcm_base)) { - ret = PTR_ERR(scp->l1tcm_base); - if (ret != -EINVAL) { - return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n"); - } - } else { - scp->l1tcm_size = resource_size(res); - scp->l1tcm_phys = res->start; - } - - scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg"); - if (IS_ERR(scp->reg_base)) - return dev_err_probe(dev, PTR_ERR(scp->reg_base), - "Failed to parse and map cfg memory\n"); - ret = scp->data->scp_clk_get(scp); if (ret) return ret; @@ -932,7 +927,6 @@ static int scp_probe(struct platform_device *pdev) ret = devm_request_threaded_irq(dev, platform_get_irq(pdev, 0), NULL, scp_irq_handler, IRQF_ONESHOT, pdev->name, scp); - if (ret) { dev_err(dev, "failed to request irq\n"); goto remove_subdev; @@ -956,6 +950,34 @@ static int scp_probe(struct platform_device *pdev) return ret; } +static int scp_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct resource *res; + struct mtk_scp_of_regs scp_regs; + int ret; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg"); + scp_regs.reg_base = devm_ioremap_resource(dev, res); + if (IS_ERR(scp_regs.reg_base)) + return dev_err_probe(dev, PTR_ERR(scp_regs.reg_base), + "Failed to parse and map cfg memory\n"); + + /* l1tcm is an optional memory region */ + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm"); + scp_regs.l1tcm_base = devm_ioremap_resource(dev, res); + if (IS_ERR(scp_regs.l1tcm_base)) { + ret = PTR_ERR(scp_regs.l1tcm_base); + if (ret != -EINVAL) + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n"); + } else { + scp_regs.l1tcm_size = resource_size(res); + scp_regs.l1tcm_phys = res->start; + } + + return scp_rproc_init(pdev, &scp_regs); +} + static int scp_remove(struct platform_device *pdev) { struct mtk_scp *scp = platform_get_drvdata(pdev); From patchwork Wed Feb 15 04:12:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 57366 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3359920wrn; Tue, 14 Feb 2023 20:17:37 -0800 (PST) X-Google-Smtp-Source: AK7set8ibX/1PX3OFKBq2OB0msiHmuIl1CkpNQ5PWM6koptw6erj+eaINWIX95HBWJ9jseWSQug1 X-Received: by 2002:a17:906:7152:b0:878:683c:f0d1 with SMTP id z18-20020a170906715200b00878683cf0d1mr835743ejj.38.1676434657351; Tue, 14 Feb 2023 20:17:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676434657; cv=none; d=google.com; s=arc-20160816; b=WCcIxYp+bkaqofhnC1PweiHnmcxQU6aXNuwH5ady1VIZAW3qTv8elRkoEvV5S/b6wz 5VF+Tslpe99DWY1fV+0t3dvFrMsL5BB5rhJ/Bq5rFkGcKxgVkwQ/wrnPO3SNeRO+GN/G YnhKqjR6560lPOVUhuaQPR7wL4hVCNrIDSZ8xTgo1WM3q7I6TO/2mIa04vmbBYdAZEwI L1byQ2mm7D0jtYVkGpDbuIJcUiUz7cjKz5zWybUBcTxxIo2Xq4ZN2WzOUa4DgpIv0H+5 IOLtCebD+3BL2oynlxYmMfgge0X56RvZDoFs9p41uWsZlC36GjOFFWx87OvPYBu7ZHSY oNdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wLykTSuS4LOn7yeT2/ovRf1YfA33Qvph81779tT4mJ8=; b=JelQhWp/jK2G3OK0jyNKJKpBDiJeeJNZMtf8eLuO9c+88s059L7gqyBsCIXYvIsu41 wi+mY34VDhxj/HWEb91ErfQsfu+LaOjSWehb/VxQAEVeMlcyr/XrBSBsfM2oInTaA12A 5SAC3kWMQnAGL83Qls1vbZFq0EnadRjtpclLav92yeXL2bm7S/O+xNyIdMUu5GO6KNzB 9J7OGeMxwwHiGsDzNOteIgoFVbr6/sTgFIkv9VKnOjaMWBKbyWDLCfSjP2y1OiL7k6Q7 ORkwes2oBZtO2p7nKFcqEjt4IQD2tcYN4DwPm8rJ9WyhIjKyMcjHOtCo1lU0IE18IPcn woOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=GRg+eakD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fq22-20020a1709069d9600b008b13a18640fsi1695165ejc.404.2023.02.14.20.17.14; Tue, 14 Feb 2023 20:17:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=GRg+eakD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233108AbjBOEOS (ORCPT + 99 others); Tue, 14 Feb 2023 23:14:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232948AbjBOEN0 (ORCPT ); Tue, 14 Feb 2023 23:13:26 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1179C32E56; Tue, 14 Feb 2023 20:13:11 -0800 (PST) X-UUID: 08781a3cace711eda06fc9ecc4dadd91-20230215 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=wLykTSuS4LOn7yeT2/ovRf1YfA33Qvph81779tT4mJ8=; b=GRg+eakD0zL8HHat4tklzxv20CIxm+Qg92EFkyrVlAaTdqxt+vbiqW1gHg/XbjTGMWoL1BVL/PTd54GFPTWSXBWziFDe4WfZ7n/kNSU5czWZTidBhyMUkI62b+9v604+Vt/C6/kk0zVYhzpc3eZzIKPF+cXrS6JgHhAttDR9RaE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:8ab1ad58-db48-462d-81c9-73e32d0e4726,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:885ddb2,CLOUDID:397709f3-ddba-41c3-91d9-10eeade8eac7,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 08781a3cace711eda06fc9ecc4dadd91-20230215 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 146572363; Wed, 15 Feb 2023 12:12:59 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 15 Feb 2023 12:12:59 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 15 Feb 2023 12:12:59 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v7 07/12] remoteproc: mediatek: Probe multi-core SCP Date: Wed, 15 Feb 2023 12:12:52 +0800 Message-ID: <20230215041257.14548-8-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215041257.14548-1-tinghan.shen@mediatek.com> References: <20230215041257.14548-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757869147727661987?= X-GMAIL-MSGID: =?utf-8?q?1757869147727661987?= The difference of single-core SCP and multi-core SCP device tree is the presence of child device nodes described SCP cores. The SCP driver populates the platform device and checks the child nodes to identify whether it's a single-core SCP or a multi-core SCP. The resource structure of the multi-core SCP is a list of remoteproc instances which is different to the single-core SCP. The corresponding resource releasing action is based on the type of SCP. Signed-off-by: Tinghan Shen --- drivers/remoteproc/mtk_common.h | 4 + drivers/remoteproc/mtk_scp.c | 179 +++++++++++++++++++++++++++++--- 2 files changed, 168 insertions(+), 15 deletions(-) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index 3778894c96f3..7821cb15d6fd 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -140,6 +140,10 @@ struct mtk_scp { size_t dram_size; struct rproc_subdev *rpmsg_subdev; + + struct list_head elem; + struct list_head cluster_cores; + struct list_head *cluster; }; /** diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 6270c388727a..6588e5acb159 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -862,7 +862,9 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) } static int scp_rproc_init(struct platform_device *pdev, - struct mtk_scp_of_regs *of_regs) + struct mtk_scp_of_regs *of_regs, + const struct mtk_scp_of_data *of_data, + bool is_multi_core) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; @@ -883,7 +885,7 @@ static int scp_rproc_init(struct platform_device *pdev, scp = (struct mtk_scp *)rproc->priv; scp->rproc = rproc; scp->dev = dev; - scp->data = of_device_get_match_data(dev); + scp->data = of_data; platform_set_drvdata(pdev, scp); scp->reg_base = of_regs->reg_base; @@ -932,9 +934,11 @@ static int scp_rproc_init(struct platform_device *pdev, goto remove_subdev; } - ret = rproc_add(rproc); - if (ret) - goto remove_subdev; + if (!is_multi_core) { + ret = rproc_add(rproc); + if (ret) + goto remove_subdev; + } return 0; @@ -950,9 +954,125 @@ static int scp_rproc_init(struct platform_device *pdev, return ret; } +static void scp_rproc_free(struct mtk_scp *scp) +{ + int i; + + scp_remove_rpmsg_subdev(scp); + scp_ipi_unregister(scp, SCP_IPI_INIT); + scp_unmap_memory_region(scp); + for (i = 0; i < SCP_IPI_MAX; i++) + mutex_destroy(&scp->ipi_desc[i].lock); + mutex_destroy(&scp->send_lock); +} + +static void scp_rproc_exit(struct platform_device *pdev) +{ + struct mtk_scp *scp = platform_get_drvdata(pdev); + + rproc_del(scp->rproc); + scp_rproc_free(scp); +} + +static int scp_cluster_init(struct platform_device *pdev, + struct mtk_scp_of_regs *of_regs) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev_of_node(dev); + struct platform_device *cpdev; + struct device_node *child; + const struct mtk_scp_of_data **cluster_of_data; + struct list_head *cluster; + struct mtk_scp *scp, *temp; + int core_id, num_cores; + int ret; + + cluster_of_data = (const struct mtk_scp_of_data **)of_device_get_match_data(dev); + + for (num_cores = 0; cluster_of_data[num_cores]; num_cores++) + ; + + cluster = NULL; + core_id = 0; + for_each_available_child_of_node(np, child) { + if (core_id >= num_cores) { + ret = -EINVAL; + dev_err(dev, "Not support core %d\n", core_id); + of_node_put(child); + goto init_fail; + } + + cpdev = of_find_device_by_node(child); + if (!cpdev) { + ret = -ENODEV; + dev_err(dev, "Not found platform device for core %d\n", core_id); + of_node_put(child); + goto init_fail; + } + + ret = scp_rproc_init(cpdev, of_regs, cluster_of_data[core_id], true); + if (ret) { + dev_err(dev, "Failed to initialize core %d rproc\n", core_id); + put_device(&cpdev->dev); + of_node_put(child); + goto init_fail; + } + + scp = platform_get_drvdata(cpdev); + put_device(&cpdev->dev); + if (core_id == 0) { + INIT_LIST_HEAD(&scp->cluster_cores); + cluster = &scp->cluster_cores; + platform_set_drvdata(pdev, cluster); + } + + list_add_tail(&scp->elem, cluster); + scp->cluster = cluster; + + of_node_put(child); + core_id++; + } + + list_for_each_entry_safe_reverse(scp, temp, cluster, elem) { + ret = rproc_add(scp->rproc); + if (ret) + goto add_fail; + } + + return 0; + +add_fail: + list_for_each_entry_continue(scp, cluster, elem) { + rproc_del(scp->rproc); + } +init_fail: + if (cluster) { + list_for_each_entry_safe_reverse(scp, temp, cluster, elem) { + list_del(&scp->elem); + scp_rproc_free(scp); + } + } + return ret; +} + +static void scp_cluster_exit(struct platform_device *pdev) +{ + struct list_head *cluster = platform_get_drvdata(pdev); + struct platform_device *cpdev; + struct mtk_scp *scp, *temp; + + list_for_each_entry_safe_reverse(scp, temp, cluster, elem) { + list_del(&scp->elem); + cpdev = to_platform_device(scp->dev); + scp_rproc_exit(cpdev); + } +} + static int scp_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct device_node *core_node; struct resource *res; struct mtk_scp_of_regs scp_regs; int ret; @@ -975,21 +1095,43 @@ static int scp_probe(struct platform_device *pdev) scp_regs.l1tcm_phys = res->start; } - return scp_rproc_init(pdev, &scp_regs); + ret = devm_of_platform_populate(dev); + if (ret) + return dev_err_probe(dev, ret, "Failed to populate platform devices\n"); + + core_node = of_get_child_by_name(np, "scp"); + of_node_put(core_node); + + if (!core_node) { + dev_info(dev, "single-core scp\n"); + + ret = scp_rproc_init(pdev, &scp_regs, of_device_get_match_data(dev), false); + if (ret) + return dev_err_probe(dev, ret, "Failed to initialize single-core scp\n"); + } else { + dev_info(dev, "multi-core scp\n"); + + ret = scp_cluster_init(pdev, &scp_regs); + if (ret) + return dev_err_probe(dev, ret, "Failed to initialize scp cluster\n"); + } + + return 0; } static int scp_remove(struct platform_device *pdev) { - struct mtk_scp *scp = platform_get_drvdata(pdev); - int i; + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct device_node *core_node; - rproc_del(scp->rproc); - scp_remove_rpmsg_subdev(scp); - scp_ipi_unregister(scp, SCP_IPI_INIT); - scp_unmap_memory_region(scp); - for (i = 0; i < SCP_IPI_MAX; i++) - mutex_destroy(&scp->ipi_desc[i].lock); - mutex_destroy(&scp->send_lock); + core_node = of_get_child_by_name(np, "scp"); + of_node_put(core_node); + + if (!core_node) + scp_rproc_exit(pdev); + else + scp_cluster_exit(pdev); return 0; } @@ -1068,12 +1210,19 @@ static const struct mtk_scp_of_data mt8195_of_data_c1 = { .host_to_scp_int_bit = MT8195_CORE1_HOST_IPC_INT_BIT, }; +static const struct mtk_scp_of_data *mt8195_of_data_cores[] = { + &mt8195_of_data, + &mt8195_of_data_c1, + NULL +}; + static const struct of_device_id mtk_scp_of_match[] = { { .compatible = "mediatek,mt8183-scp", .data = &mt8183_of_data }, { .compatible = "mediatek,mt8186-scp", .data = &mt8186_of_data }, { .compatible = "mediatek,mt8188-scp", .data = &mt8188_of_data }, { .compatible = "mediatek,mt8192-scp", .data = &mt8192_of_data }, { .compatible = "mediatek,mt8195-scp", .data = &mt8195_of_data }, + { .compatible = "mediatek,mt8195-scp-dual", .data = &mt8195_of_data_cores }, {}, }; MODULE_DEVICE_TABLE(of, mtk_scp_of_match); From patchwork Wed Feb 15 04:12:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 57363 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3359462wrn; Tue, 14 Feb 2023 20:16:21 -0800 (PST) X-Google-Smtp-Source: AK7set/uiBljk7L0U1IoNCfRL/z9HQp0fkUDAFt+bovtCPYTrnuF9s5cFRS+D+ZxA6wDLVR7FC8A X-Received: by 2002:aa7:c50b:0:b0:4ac:bab1:feee with SMTP id o11-20020aa7c50b000000b004acbab1feeemr578527edq.24.1676434581253; Tue, 14 Feb 2023 20:16:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676434581; cv=none; d=google.com; s=arc-20160816; b=TW7LGHCr8yOHWk4/eWvHeuRPHtcUzazLND2oPmgqAG+cSLzyPw6j5kAN8xQQgmr1hd yr1e0waFFBxQ2PhKSD81kuDIkQKOaIr0SEGCcDRc3sla1V0nxjWa3tmbudBPn4ZGOg73 qOLWEBYG43pMU0nV1RW7RZFJHBGWJYP/2hwJYjE1jPQyDch5DO1sbCG8MWh+5bIhydkc 6YM6jS1XkG9NoMmAA66GbldnstD9sx4Gl37QFueOBoPnGta4YT3p7O1Tc6adNphRWRzD /Ut199pin6ueaa1+53oK8lJdfZtvVqfox6h1bYzxCYmTJW2i9YBS+XI65Lgx5XZTAlbr +9mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=eu8elOHJoMSpyfIFgkpVLbq2Zh/DAsT6JWZxs5+FvSM=; b=cSiy3DhWJ1DtflntFW6w0DD4FHUeQRTlqrpGVSjj7rtj5SyKy2H0NkaREqL6l9bTee Odfkw1Ml8To0xM7LhhixXdaUS8sbEhTQXQTvCvKWUA7MzXY2aZZ8iSJNkK+bI6NyP2e3 5RjOk/xhVpNfPh9BgZAqIOv4XFC/9oiaWwzFslvk0hlPfCDvTX6Fd1Romc9P+ScBHQzU TbUTisBMA4BFz6o7dKdTOHuhwNaag6Pn+1UsCe/6LuXbHWYDkHlLL6zo0HnzlVn7Sv99 m27P3qNcXLno9NU7OKXiXJi8y2M8lFodXOnF6ievQL7LoIbEz9FK5ROXNvoYyLMIlIDy wT+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=T32EgXHX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o2-20020aa7c502000000b004acd30eabb3si6139516edq.69.2023.02.14.20.15.57; Tue, 14 Feb 2023 20:16:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=T32EgXHX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233099AbjBOEOM (ORCPT + 99 others); Tue, 14 Feb 2023 23:14:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231656AbjBOENZ (ORCPT ); Tue, 14 Feb 2023 23:13:25 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FDB732E6C; Tue, 14 Feb 2023 20:13:10 -0800 (PST) X-UUID: 08a614f0ace711eda06fc9ecc4dadd91-20230215 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=eu8elOHJoMSpyfIFgkpVLbq2Zh/DAsT6JWZxs5+FvSM=; b=T32EgXHX46kneK0R4tzpCofM23CIwsCOPb9ktfed/N1YW4icBJuyvuQyZaPbM5VQDqGtoU97DD03/uk0h+Y/DEtNLi+bf3KjYvZl5qG9PRrzaPkKjkvsO1XFuABiG69R8Nv20MDlwIsQqccfT3QR/MtgiAIqynoomELssmo3q9w=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:77485caf-aa31-4af0-bde0-ac134a2955f9,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.19,REQID:77485caf-aa31-4af0-bde0-ac134a2955f9,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:885ddb2,CLOUDID:f9739b25-564d-42d9-9875-7c868ee415ec,B ulkID:2302151213033GRQQA73,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 08a614f0ace711eda06fc9ecc4dadd91-20230215 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 297123950; Wed, 15 Feb 2023 12:13:00 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Wed, 15 Feb 2023 12:12:59 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 15 Feb 2023 12:12:59 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v7 08/12] remoteproc: mediatek: Control SCP core 1 by rproc subdevice Date: Wed, 15 Feb 2023 12:12:53 +0800 Message-ID: <20230215041257.14548-9-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215041257.14548-1-tinghan.shen@mediatek.com> References: <20230215041257.14548-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757869067435561625?= X-GMAIL-MSGID: =?utf-8?q?1757869067435561625?= Register SCP core 1 as a subdevice of core 0 for the boot sequence and watchdog timeout handling. The core 1 has to boot after core 0 because the SCP clock and SRAM power is controlled by SCP core 0. As for watchdog timeout handling, the remoteproc framework helps to stop/start subdevices automatically when SCP driver receives watchdog timeout event. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_common.h | 9 +++++ drivers/remoteproc/mtk_scp.c | 66 +++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index 7821cb15d6fd..d333cefc29da 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -112,6 +112,13 @@ struct mtk_scp_of_data { size_t ipi_buf_offset; }; +struct mtk_scp_core_subdev { + struct rproc_subdev subdev; + struct mtk_scp *scp; +}; + +#define to_core_subdev(d) container_of(d, struct mtk_scp_core_subdev, subdev) + struct mtk_scp { struct device *dev; struct rproc *rproc; @@ -144,6 +151,8 @@ struct mtk_scp { struct list_head elem; struct list_head cluster_cores; struct list_head *cluster; + + struct mtk_scp_core_subdev *core_subdev; }; /** diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 6588e5acb159..be995c88d333 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -861,6 +861,60 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) } } +static int scp_core_subdev_start(struct rproc_subdev *subdev) +{ + struct mtk_scp_core_subdev *core_subdev = to_core_subdev(subdev); + struct mtk_scp *scp = core_subdev->scp; + + rproc_boot(scp->rproc); + + return 0; +} + +static void scp_core_subdev_stop(struct rproc_subdev *subdev, bool crashed) +{ + struct mtk_scp_core_subdev *core_subdev = to_core_subdev(subdev); + struct mtk_scp *scp = core_subdev->scp; + + rproc_shutdown(scp->rproc); +} + +static int scp_core_subdev_register(struct mtk_scp *scp) +{ + struct device *dev = scp->dev; + struct mtk_scp_core_subdev *core_subdev; + struct mtk_scp *scp_c0; + + scp_c0 = list_first_entry(scp->cluster, struct mtk_scp, elem); + if (!scp_c0) + return -ENODATA; + + core_subdev = devm_kzalloc(dev, sizeof(*core_subdev), GFP_KERNEL); + if (!core_subdev) + return -ENOMEM; + + core_subdev->scp = scp; + core_subdev->subdev.start = scp_core_subdev_start; + core_subdev->subdev.stop = scp_core_subdev_stop; + + scp->core_subdev = core_subdev; + rproc_add_subdev(scp_c0->rproc, &scp->core_subdev->subdev); + + return 0; +} + +static void scp_core_subdev_unregister(struct mtk_scp *scp) +{ + struct mtk_scp *scp_c0; + + if (scp->core_subdev) { + scp_c0 = list_first_entry(scp->cluster, struct mtk_scp, elem); + rproc_remove_subdev(scp_c0->rproc, &scp->core_subdev->subdev); + devm_kfree(scp->dev, scp->core_subdev); + scp->core_subdev = NULL; + } +} + static int scp_rproc_init(struct platform_device *pdev, struct mtk_scp_of_regs *of_regs, const struct mtk_scp_of_data *of_data, @@ -958,6 +1012,7 @@ static void scp_rproc_free(struct mtk_scp *scp) { int i; + scp_core_subdev_unregister(scp); scp_remove_rpmsg_subdev(scp); scp_ipi_unregister(scp, SCP_IPI_INIT); scp_unmap_memory_region(scp); @@ -1034,6 +1089,17 @@ static int scp_cluster_init(struct platform_device *pdev, } list_for_each_entry_safe_reverse(scp, temp, cluster, elem) { + if (!list_is_first(&scp->elem, cluster)) { + ret = scp_core_subdev_register(scp); + if (ret) { + dev_err_probe(scp->dev, ret, "Failed to register as subdev\n"); + goto add_fail; + } + + /* sub cores are booted as subdevices of core 0 */ + scp->rproc->auto_boot = false; + } + ret = rproc_add(scp->rproc); if (ret) goto add_fail; From patchwork Wed Feb 15 04:12:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 57358 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3359227wrn; Tue, 14 Feb 2023 20:15:38 -0800 (PST) X-Google-Smtp-Source: AK7set+UV7Ut+QHtHOqqUreuc29X1F1wDL/dw9fndoi7JuGNB64a/aJF92W0cRl+oy89MvjZmmkl X-Received: by 2002:a05:6402:1346:b0:4a2:331e:85f2 with SMTP id y6-20020a056402134600b004a2331e85f2mr676598edw.26.1676434537731; Tue, 14 Feb 2023 20:15:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676434537; cv=none; d=google.com; s=arc-20160816; b=bMW+QlHne7qQraiQJt4SurKCSSDnPGyITVjEt4rswv1U8V4zIp9HzN+aaRwr01CTgV LPGtdWuBL/qDOJZgJB8uEsnc9R0PCUdHfi1RS8PcO10agsZlBOOUmHMDdlu7F4F4XGPC OydNDVOh/M/IASbHZgaMohqrh4sUwa/iqrOZnG2FP4qLqSj/2pyNZYPp7RBfJYU2JtHs KBqCuus20tGioPPYfEmHgxVvfQePwaxVqydvG3DrOaRA/jm1LTffjJLSgLNthnnyJSyB ds9V3w4ZmU1OuR+em0ePgVcsCr63cl6jd0ZcJgP/Xo6W2ytVS2e36stJEKaQsiCap/nX 6cMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Zf8N5vKf+OQiD4FPD+6mWffc+P30ueDh84oUuMSgE2g=; b=T6PHU4t3IA92g1r/Dz3ZaVZte/37VPD0vPg6ZSZ/IjkN74yeCOcatpN1eCAu+HTCuS ab7vnBcB39D7ZrlatQzmCZ/DltSVvQIsaVBzPsw4Xf0YSltp30e+nehZTeIIgtnIteNk DPtQHmmPlH3XGy6QD9URKPhN6GiI3zg5opohCugejYmICJ+mgSapGGI3RTNMF3BcaNjm LvHR4EV18qXuNIyMmEiaRmgISacKF/7ciKTvi76LYM5Vir9y9lY41SvljPRUEim+828w fRoaZDR1eCOI/Bi/60cusP6ov7L6I6e7LRmj8TAvCWHcii6Z3R0mQzTDnvibDbHW7Ulv E5og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Fpk5n6YD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n14-20020aa7d04e000000b004acbf660622si10879371edo.244.2023.02.14.20.15.13; Tue, 14 Feb 2023 20:15:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Fpk5n6YD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233068AbjBOENg (ORCPT + 99 others); Tue, 14 Feb 2023 23:13:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231515AbjBOENL (ORCPT ); Tue, 14 Feb 2023 23:13:11 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 159AF25E0A; Tue, 14 Feb 2023 20:13:07 -0800 (PST) X-UUID: 0942318cace711eda06fc9ecc4dadd91-20230215 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Zf8N5vKf+OQiD4FPD+6mWffc+P30ueDh84oUuMSgE2g=; b=Fpk5n6YDjkY8HNU8nwRzyXa44y7iyFysL7zCFdH9dIhsajNvGukyIf2R5yAd5cadNS7ydFLa+n/N1Pfje220XaYkbUp8zsvff8Bezk9P5RCftf9h61a4JiI7qdgc791GnuUPek53u5QXgawUH7mMqyp9hwpccrwnjmq88SgjLik=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:d92c087b-0d29-4891-b234-4f716079f72b,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:fa197cb0-beed-4dfc-bd9c-e1b22fa6ccc4,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 0942318cace711eda06fc9ecc4dadd91-20230215 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 161664218; Wed, 15 Feb 2023 12:13:01 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 15 Feb 2023 12:12:59 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 15 Feb 2023 12:12:59 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v7 09/12] remoteproc: mediatek: Setup MT8195 SCP core 1 SRAM offset Date: Wed, 15 Feb 2023 12:12:54 +0800 Message-ID: <20230215041257.14548-10-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215041257.14548-1-tinghan.shen@mediatek.com> References: <20230215041257.14548-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757869021945197088?= X-GMAIL-MSGID: =?utf-8?q?1757869021945197088?= Because MT8195 SCP core 0 and core 1 both boot from head of SRAM and have the same viewpoint of SRAM, SCP has a "core 1 SRAM offset" configuration to control the access destination of SCP core 1 to boot core 1 from different SRAM location. The "core 1 SRAM offset" configuration is composed by a range and an offset. It works like a simple memory mapped mechanism. When SCP core 1 accesses a SRAM address located in the range, the SCP bus adds the configured offset to the address to shift the physical destination address on SCP SRAM. This shifting is transparent to the software running on SCP core 1. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_scp.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index be995c88d333..6d88b53fc07e 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -484,6 +484,9 @@ static int mt8195_scp_before_load(struct mtk_scp *scp) static int mt8195_scp_c1_before_load(struct mtk_scp *scp) { + u32 sec_ctrl; + struct mtk_scp *scp_c0; + scp_sram_power_on(scp->reg_base + MT8195_CPU1_SRAM_PD, 0); /* hold SCP in reset while loading FW. */ @@ -492,6 +495,30 @@ static int mt8195_scp_c1_before_load(struct mtk_scp *scp) /* enable MPU for all memory regions */ writel(0xff, scp->reg_base + MT8195_CORE1_MEM_ATT_PREDEF); + /* + * The L2TCM_OFFSET_RANGE and L2TCM_OFFSET shift the destination address + * on SRAM when SCP core 1 accesses SRAM. + * + * This configuration solves booting the SCP core 0 and core 1 from + * different SRAM address because core 0 and core 1 both boot from + * the head of SRAM by default. this must be configured before boot SCP core 1. + * + * The value of L2TCM_OFFSET_RANGE is from the viewpoint of SCP core 1. + * When SCP core 1 issues address within the range (L2TCM_OFFSET_RANGE), + * the address will be added with a fixed offset (L2TCM_OFFSET) on the bus. + * The shift action is tranparent to software. + */ + writel(0, scp->reg_base + MT8195_L2TCM_OFFSET_RANGE_0_LOW); + writel(scp->sram_size, scp->reg_base + MT8195_L2TCM_OFFSET_RANGE_0_HIGH); + + scp_c0 = list_first_entry(scp->cluster, struct mtk_scp, elem); + writel(scp->sram_phys - scp_c0->sram_phys, scp->reg_base + MT8195_L2TCM_OFFSET); + + /* enable SRAM offset when fetching instruction and data */ + sec_ctrl = readl(scp->reg_base + MT8195_SEC_CTRL); + sec_ctrl |= MT8195_CORE_OFFSET_ENABLE_I | MT8195_CORE_OFFSET_ENABLE_D; + writel(sec_ctrl, scp->reg_base + MT8195_SEC_CTRL); + return 0; } From patchwork Wed Feb 15 04:12:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 57354 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3358937wrn; Tue, 14 Feb 2023 20:14:40 -0800 (PST) X-Google-Smtp-Source: AK7set/nQW0o559cizvgmpUSqzcHHloxXcP7NpbT4FjetQddFtMy/a82jfCzVOQjI+A1QmRXl/tY X-Received: by 2002:a17:906:1313:b0:8aa:bf4e:7b2c with SMTP id w19-20020a170906131300b008aabf4e7b2cmr767705ejb.21.1676434479870; Tue, 14 Feb 2023 20:14:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676434479; cv=none; d=google.com; s=arc-20160816; b=OECWUJYtcfdvT+KBw+iWjnfSN8/yRQZLuzT5izH2Mc/MKxORgO8uxy0T5lO264T3t2 yd3ZSwnVe7P54FtCp0uIMl/3Gh9emz94Bsm0sW/ncTq2ex8txvXq6sqql/ksbiCkKkZL sj4AbxHo6bB1tHH2QV5fDVaElksVo2FXXVb26qt5i9wQbZyv1WAMxQ72WUfhFZdJm3jN XPCtgrdrm908ilQfGgvFdelyqGU57r15q28mEATdiviwRREw/WSqbqns5qzBTgxS+/Xl W2EVodF9uVS1EijMfH2lQXSghfW0EGtIV5VbyotISZVysVlyU3v2266GqIVfn/e6fxUG NB3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wpTmCMoQur13XijdZv+ZOHierCMxHcTePcdnFYmRZNg=; b=Ac3CKR8vO6dbwK+vIQETT6k74EuoLcY28G7CQiKI9pPIC9RJjdLgv0SU5+HczfZYje NPNO1np0IVHLzLt4t4Prllk+YJbnIsDAzssnZShJJtz16cijZKOdg8KyfYOT7eDU78JK 77ZWJI2pQkfwgfaL43lkRzddgucHljGc0eVIMEwIGAZ7/CsjOXNew16OCgEkpbaJ7loH 8BlxCvWzYBZA/DX6JXBQPpgazh1aKM2Z/JHHNF505/B42AuFO4iQPfeaDlxVMTA4ClBx DOJFgZQNsEGg0UfQhrrYwFMej9v3NsBTmGnftur5MKcS/OH1vVRJR3ngS4c/dCsACvKW Bv9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=PNwh1SyO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mt19-20020a170907619300b007c1753251a4si17559737ejc.928.2023.02.14.20.14.14; Tue, 14 Feb 2023 20:14:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=PNwh1SyO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233057AbjBOENd (ORCPT + 99 others); Tue, 14 Feb 2023 23:13:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231476AbjBOENL (ORCPT ); Tue, 14 Feb 2023 23:13:11 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C6DC241E7; Tue, 14 Feb 2023 20:13:07 -0800 (PST) X-UUID: 09468534ace711ed945fc101203acc17-20230215 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=wpTmCMoQur13XijdZv+ZOHierCMxHcTePcdnFYmRZNg=; b=PNwh1SyO9mnq790pu+rstcSl7+vRUFcgJWv7RGImy1gFYDinhTpVSfaLXR0AHwqdw2z+f1GX06vcj7rHqUj1sx82rZ3hE11YgGxOFPQ9dx0Gn6VFjsWDyTMK+Ey+qs3V3R3IbvzY7f7pBp0W5yLlcRvavrfZoITmvn9ZbiqR5ts=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:441ce167-0f72-4889-88c7-9630e21843ae,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:f77609f3-ddba-41c3-91d9-10eeade8eac7,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 09468534ace711ed945fc101203acc17-20230215 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1800515941; Wed, 15 Feb 2023 12:13:01 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 15 Feb 2023 12:12:59 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 15 Feb 2023 12:12:59 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v7 10/12] remoteproc: mediatek: Handle MT8195 SCP core 1 watchdog timeout Date: Wed, 15 Feb 2023 12:12:55 +0800 Message-ID: <20230215041257.14548-11-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215041257.14548-1-tinghan.shen@mediatek.com> References: <20230215041257.14548-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757868960915519470?= X-GMAIL-MSGID: =?utf-8?q?1757868960915519470?= The MT8195 SCP core 1 watchdog timeout needs to be handled in the SCP core 0 IRQ handler because the MT8195 SCP core 1 watchdog timeout IRQ is wired on the same IRQ entry for core 0 watchdog timeout. MT8195 SCP has a watchdog status register to identify the watchdog timeout source when IRQ triggered. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_common.h | 4 ++++ drivers/remoteproc/mtk_scp.c | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index d333cefc29da..1641d41dab5f 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -55,6 +55,10 @@ #define MT8192_CORE0_WDT_IRQ 0x10030 #define MT8192_CORE0_WDT_CFG 0x10034 +#define MT8195_SYS_STATUS 0x4004 +#define MT8195_CORE0_WDT BIT(16) +#define MT8195_CORE1_WDT BIT(17) + #define MT8195_L1TCM_SRAM_PDN_RESERVED_RSI_BITS GENMASK(7, 4) #define MT8195_CPU1_SRAM_PD 0x1084 diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 6d88b53fc07e..6bc5f7f138d5 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -229,6 +229,29 @@ static void mt8192_scp_irq_handler(struct mtk_scp *scp) } } +static void mt8195_scp_irq_handler(struct mtk_scp *scp) +{ + u32 scp_to_host; + + scp_to_host = readl(scp->reg_base + MT8192_SCP2APMCU_IPC_SET); + + if (scp_to_host & MT8192_SCP_IPC_INT_BIT) { + scp_ipi_handler(scp); + } else { + u32 reason = readl(scp->reg_base + MT8195_SYS_STATUS); + + if (reason & MT8195_CORE0_WDT) + writel(1, scp->reg_base + MT8192_CORE0_WDT_IRQ); + + if (reason & MT8195_CORE1_WDT) + writel(1, scp->reg_base + MT8195_CORE1_WDT_IRQ); + + scp_wdt_handler(scp, reason); + } + + writel(scp_to_host, scp->reg_base + MT8192_SCP2APMCU_IPC_CLR); +} + static void mt8195_scp_c1_irq_handler(struct mtk_scp *scp) { u32 scp_to_host; @@ -1282,7 +1305,7 @@ static const struct mtk_scp_of_data mt8192_of_data = { static const struct mtk_scp_of_data mt8195_of_data = { .scp_clk_get = mt8195_scp_clk_get, .scp_before_load = mt8195_scp_before_load, - .scp_irq_handler = mt8192_scp_irq_handler, + .scp_irq_handler = mt8195_scp_irq_handler, .scp_reset_assert = mt8192_scp_reset_assert, .scp_reset_deassert = mt8192_scp_reset_deassert, .scp_stop = mt8195_scp_stop, From patchwork Wed Feb 15 04:12:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 57360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3359252wrn; Tue, 14 Feb 2023 20:15:43 -0800 (PST) X-Google-Smtp-Source: AK7set+ADMbs9a6t1r0/0MhUKR06UfnT4z0zGmrThNiMbwOn6bSCrJ53ZBhR8YQ6DxW9wX7zf9pg X-Received: by 2002:a17:907:76d1:b0:8a0:7158:15dc with SMTP id kf17-20020a17090776d100b008a0715815dcmr766291ejc.74.1676434543039; Tue, 14 Feb 2023 20:15:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676434543; cv=none; d=google.com; s=arc-20160816; b=G4G+E5ZbIbzbPrAHDzL0OUROHEIOhGtAq/Fg9poSWhPuxzDiURYl1UEnDA05r49inw IUKqHu2xBtFaw7heN/CcqozO4Q1kWlNU5g4lDeRIe4Ea9HBlQYBybp73aepAjaeJDOBe EoCjUd62XJsIhYqGh8YpjW98MqRq8bUOoZ5k6Omlhoo4Obf8NdVA/Nz7yjMpVzNg7MSJ KrQ1qJ5VoYSRXVuce/ViAU1K7A+KbqpKprPomeYimEVJMQ2OEEV2CiUKqZD9dRWJcX2r lqERyDtHRNgfsEhI0CJr5O0ZPkv+9FHjxUgQ4cJe61jE1kbc6VfRCV4ZGckxyu1z/Dsn 7xSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=C1fFjgCUHa9OHSyRoUS8th94bKH2HepGCjPkyLCX+QA=; b=WIqnudeQk0aNYD3GKOWwTqb2Xo6BequErCuuu9V6Ow/txgBvRhGdjgXA9hMvKPtxao 4ERCkusHVNsMFK3whZrwQxrlEODlruHIE+ZIYHaBl2MJx3Sx3cylPvMpHj4IwG4NIMrf OA2jbM3SBUELpNjNQtvV/A+xwbMpOm+JQaQM04JEkvsugPlk5qUQdhMNztFMcW/U/jmP Feo0suln4Z8XmImd/TttgS7hluNBsZz2qFBP3KTyXDLSGj3DzytRcDljinAMR0O8xi2m LWVFRBx3/d2lEzYjfdvtwG8SzFKCoJyVfXuaKh5ciaD2WxfppQjfgrCcrnJVdaPHCXsR qccA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Rd0Ngr9p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id um28-20020a170907cb1c00b00888bda06814si17995393ejc.300.2023.02.14.20.15.18; Tue, 14 Feb 2023 20:15:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Rd0Ngr9p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232704AbjBOENv (ORCPT + 99 others); Tue, 14 Feb 2023 23:13:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbjBOENR (ORCPT ); Tue, 14 Feb 2023 23:13:17 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3098826877; Tue, 14 Feb 2023 20:13:08 -0800 (PST) X-UUID: 095f94e8ace711ed945fc101203acc17-20230215 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=C1fFjgCUHa9OHSyRoUS8th94bKH2HepGCjPkyLCX+QA=; b=Rd0Ngr9poes7+RdfaOWGNd2GAQAs7cJD91Xh9ewRXHGoX4dMlbtwpQRRg4rmjddIspAolKPTyILhBjNvnlmHC5rCj5r4Ad3IhcRBqrIZXzsKKHBAKur5+ZU4kYRnJWeVK0ikb8WxPDH6ecKwEVHaLbLNv3ZDmeQyfEFWuHPlr/U=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:ae72b7e6-4268-42cb-9a96-2f93d38ce3ac,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:22749b25-564d-42d9-9875-7c868ee415ec,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 095f94e8ace711ed945fc101203acc17-20230215 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1978570795; Wed, 15 Feb 2023 12:13:01 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 15 Feb 2023 12:12:59 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 15 Feb 2023 12:12:59 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v7 11/12] remoteproc: mediatek: Refine ipi handler error message Date: Wed, 15 Feb 2023 12:12:56 +0800 Message-ID: <20230215041257.14548-12-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215041257.14548-1-tinghan.shen@mediatek.com> References: <20230215041257.14548-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757869026995575764?= X-GMAIL-MSGID: =?utf-8?q?1757869026995575764?= The error message doesn't accurately reflect the cause of the error. The error is due to a handler not being found, not an invalid IPI ID. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_scp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 6bc5f7f138d5..006493f4bb4c 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -113,7 +113,7 @@ static void scp_ipi_handler(struct mtk_scp *scp) scp_ipi_lock(scp, id); handler = ipi_desc[id].handler; if (!handler) { - dev_err(scp->dev, "No such ipi id = %d\n", id); + dev_err(scp->dev, "No handler for ipi id = %d\n", id); scp_ipi_unlock(scp, id); return; } From patchwork Wed Feb 15 04:12:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 57365 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3359687wrn; Tue, 14 Feb 2023 20:16:56 -0800 (PST) X-Google-Smtp-Source: AK7set+xGjizupjRpY8hwRsxGf8j6yqriHrPyNtT6qgNBo0EOzH9FljDinSNKDlDp2K/Sd6ZL1bb X-Received: by 2002:a17:906:a843:b0:889:f989:d8ee with SMTP id dx3-20020a170906a84300b00889f989d8eemr885629ejb.22.1676434616049; Tue, 14 Feb 2023 20:16:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676434616; cv=none; d=google.com; s=arc-20160816; b=hN0zGYukh3foFcIf7B3mDNj/IIWIK4RL7H2qzENpuPUDAkuDhZAk8O4kebyThu6EL2 8j706kg146RVAaJIj7CqobJ+tqs0HFMGdfxq706/RwLCXefXwuQBSQyLimLE0FD7UKEa oESibalc0/OajLQdku9YsIYjs4OQZtc4uc7uS8+zbg3f+EuK6oATzlZ+5wmEsgYLcDUg SoKSTuNIhaftTmbjwTCU7dwgwYUJDAQXWuoq5i+o6Ep8MWIwIfmZVzid5ssvIe70u3BE 5/P1ES46zmik/ayYvDECVRZXj1oNNVpmu4/ovWShW3W1rhSksmj7BGK2FTvCpxfWPbwn sUDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=e6eQQOvqn+zPWnCwihlkrd8bxgyCpuOOMe/nTlCqPLo=; b=VpCB7twv206VRVkN1KyABT2i+T3HsaBVnf5KkkDjGuUQzEt9y0PxWb/QXDleiUpk0X FTNStFcdIPlPAVWnmyDRuPj7fgKCdi/k93lNswty7rWDjWs0neW/O15/BtfD3OJ0vWcE xWqOYrgbHgV7sKAl5C+cHqH44rDPhkaahoYvtuH0ZPPABaavJTcrnoUu+r4prKWeLtRp HjaZ//2CrDY1qxSvvJT2txfOqg8T2/PsOLuX/u2MjqwUgUcxrrNZoxpFoOy7cSR3eghl 4TI5iTOsWEEjVu9vqfsRFKsjPu0+L+v6sN5et07w7kuWfemKkC6j63rP/H2CRxJ0xglO tTiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mCXmcwc7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id we6-20020a170907234600b008817e670a18si17588091ejb.900.2023.02.14.20.16.33; Tue, 14 Feb 2023 20:16:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mCXmcwc7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231236AbjBOEOE (ORCPT + 99 others); Tue, 14 Feb 2023 23:14:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232374AbjBOENS (ORCPT ); Tue, 14 Feb 2023 23:13:18 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4076932E5C; Tue, 14 Feb 2023 20:13:10 -0800 (PST) X-UUID: 096f27faace711ed945fc101203acc17-20230215 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=e6eQQOvqn+zPWnCwihlkrd8bxgyCpuOOMe/nTlCqPLo=; b=mCXmcwc7Kg1qn0j4tzae2VKQsVh7DjieCUl7LCOjhplL9p2n7BBKYQ0A48QIDoR6sJGr5NIknANZwYdYlX2/v1lDV/LXmwoY/yyhgvj9lI7+YU6GtUai/ZnarV1PglzjqjLHfzZqE4aY8L9Hxf18L69IUdhWo7JtzR+CZgb1LNI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:56c6486d-ec48-4ee1-bd9c-4a64267c9a3f,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:23749b25-564d-42d9-9875-7c868ee415ec,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 096f27faace711ed945fc101203acc17-20230215 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1189419126; Wed, 15 Feb 2023 12:13:01 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Wed, 15 Feb 2023 12:13:00 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 15 Feb 2023 12:13:00 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v7 12/12] arm64: dts: mediatek: mt8195: Add SCP 2nd core Date: Wed, 15 Feb 2023 12:12:57 +0800 Message-ID: <20230215041257.14548-13-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230215041257.14548-1-tinghan.shen@mediatek.com> References: <20230215041257.14548-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757869104014259157?= X-GMAIL-MSGID: =?utf-8?q?1757869104014259157?= Rewrite the MT8195 SCP device node as a cluster and add the SCP 2nd core in it. Since the SCP device node is changed to multi-core structure, enable SCP cluster to enable probing SCP core 0. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- .../boot/dts/mediatek/mt8195-cherry.dtsi | 6 +++- arch/arm64/boot/dts/mediatek/mt8195.dtsi | 32 ++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi index 56749cfe7c33..31415d71b6a4 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi @@ -933,7 +933,11 @@ interrupts-extended = <&pio 222 IRQ_TYPE_LEVEL_HIGH>; }; -&scp { +&scp_cluster { + status = "okay"; +}; + +&scp_c0 { status = "okay"; firmware-name = "mediatek/mt8195/scp.img"; diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi index 8f1264d5290b..31209ef7e55d 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi @@ -826,14 +826,30 @@ clocks = <&infracfg_ao CLK_INFRA_AO_GCE2>; }; - scp: scp@10500000 { - compatible = "mediatek,mt8195-scp"; - reg = <0 0x10500000 0 0x100000>, - <0 0x10720000 0 0xe0000>, - <0 0x10700000 0 0x8000>; - reg-names = "sram", "cfg", "l1tcm"; - interrupts = ; + scp_cluster: scp@10500000 { + compatible = "mediatek,mt8195-scp-dual"; + reg = <0 0x10720000 0 0xe0000>, <0 0x10700000 0 0x8000>; + reg-names = "cfg", "l1tcm"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0 0x10500000 0x100000>; status = "disabled"; + + scp_c0: scp@0 { + compatible = "mediatek,scp-core"; + reg = <0x0 0xa0000>; + reg-names = "sram"; + interrupts = ; + status = "disabled"; + }; + + scp_c1: scp@a0000 { + compatible = "mediatek,scp-core"; + reg = <0xa0000 0x20000>; + reg-names = "sram"; + interrupts = ; + status = "disabled"; + }; }; scp_adsp: clock-controller@10720000 { @@ -2291,7 +2307,7 @@ <&iommu_vdo M4U_PORT_L19_VENC_REF_LUMA>, <&iommu_vdo M4U_PORT_L19_VENC_REF_CHROMA>; interrupts = ; - mediatek,scp = <&scp>; + mediatek,scp = <&scp_c0>; clocks = <&vencsys CLK_VENC_VENC>; clock-names = "venc_sel"; assigned-clocks = <&topckgen CLK_TOP_VENC>;