From patchwork Wed May 17 04:34:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 95045 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp873013vqo; Tue, 16 May 2023 21:36:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65rd1kmRjhQ+XEo7PJpsm00l8OyjgJnJsKG7I0OVlzhZTWr6dptrRL4fsP00bzunQ/BcDA X-Received: by 2002:a05:6a20:4320:b0:104:a053:12fb with SMTP id h32-20020a056a20432000b00104a05312fbmr21171200pzk.60.1684298217500; Tue, 16 May 2023 21:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684298217; cv=none; d=google.com; s=arc-20160816; b=DieoRNpjXtc6SRkAX8xC+b47G2X+irEI6JSw57jKvBY6eX5C29bMpaLI/WTRSN1+TV 2De9of3ISfLJpEaPW5JQgGEiHNKHLSqBtoagW6AM5XQ0zGECTqWIID3ztY17vTL1Pvc3 AezIFlUrlFTIzrWfdaYI5Hg6qIRpQYnUI0XzGf/vQHhUxcH2m0LmKBaN9KbLXpeIPvSu q4W/fIyvZpIl4XkClLnaK8EQhSoW8x9XWosOYUdtjlsFGzYmHRlMomQ4VMBnnO8V5yB+ OGvzd5+GB+9k8hVWJPPkimIf5vB5l1BLyCzGKUluUI38CS80KJ7HV67ZaFuqGIMcPnJX zSgA== 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=Iggzs8Kvx7OMXaS9OzItSAz8isRmyrYO9mDqyomw2yxKfkcKFfvj3CLTRNT27NR444 VsWPgP12rG5zL8MyPoq9p8C/rjiRC5OSdL3jnU9LPLvfJiWo9GvSRDiug7s92ga30upO X7ygGpZKVa8kOCpZTcFhK6MIzyHDDGZOIMJlLYSvZ5+6Eo4IrIXArzQKemjAT2e1IHF0 WqcioNv1skGlzmgBIR2CfI+TMp26jiB1PosdwHlojNIo0cw244zVsfBgYF1wYzYomrrt 8w5XEqr5BnL7Gyk26UPKQU/FEI/j1xOeADj89GYNKMudIscrQjx89afahYLugbvzhF2s Yknw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=BSFWdQvm; 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 k15-20020aa7972f000000b006361df3aa86si21017119pfg.88.2023.05.16.21.36.45; Tue, 16 May 2023 21:36:57 -0700 (PDT) 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=BSFWdQvm; 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 S232241AbjEQEfy (ORCPT + 99 others); Wed, 17 May 2023 00:35:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231772AbjEQEfp (ORCPT ); Wed, 17 May 2023 00:35:45 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 257EB2D52; Tue, 16 May 2023 21:35:40 -0700 (PDT) X-UUID: 438ea2e0f46c11ed9cb5633481061a41-20230517 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=BSFWdQvmmT7sfA+YO23CmBhondyVUMzpOOUyHQxaNCvnzDBTQJUAEMc1htDzJmH/Jp8ynjWwt0HrDIbCD/5Ozks26YfHHpsb1ct1ZyNWhsiE7dT8H/R1bLJohevUQxjNpqKv5rvnxxRfcLHpQx5QyI+TN7ihhpIf/TWDPD86bHQ=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:36fa717f-0ab9-4494-b235-412ed9df4e36,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:d5b0ae3,CLOUDID:9c5a6c3b-de1e-4348-bc35-c96f92f1dcbb,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-CID-BAS: 0,NGT,0,_ X-UUID: 438ea2e0f46c11ed9cb5633481061a41-20230517 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1627549741; Wed, 17 May 2023 12:35:34 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) 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.1118.26; Wed, 17 May 2023 12:35:33 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 17 May 2023 12:35:33 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v12 01/11] dt-bindings: remoteproc: mediatek: Improve the rpmsg subnode definition Date: Wed, 17 May 2023 12:34:39 +0800 Message-ID: <20230517043449.26352-2-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230517043449.26352-1-tinghan.shen@mediatek.com> References: <20230517043449.26352-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, T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR,UNPARSEABLE_RELAY,URIBL_BLOCKED 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?1766114687850088473?= X-GMAIL-MSGID: =?utf-8?q?1766114687850088473?= 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 May 17 04:34:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 95046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp873066vqo; Tue, 16 May 2023 21:37:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4DEG/LKjvvze+/XkQVuhimy1ZI9qrWYIWo4huKx808WB79DgJJ0It8nH7JdlejLOMd3cxK X-Received: by 2002:a05:6a20:4421:b0:101:914e:da75 with SMTP id ce33-20020a056a20442100b00101914eda75mr34877282pzb.25.1684298225228; Tue, 16 May 2023 21:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684298225; cv=none; d=google.com; s=arc-20160816; b=ifTBYsRWaGDaH0fMmnlOWitzPYbd/H/a8NwrnCptJIidqpm8r7x2Ns+HDhO1xrVb2A /LqCug1f1Amyud9G/O+UTlmHunqVe/ii7RjgY8s3iDh+M/3kHP8T/tE3XpXcqij1IDwC wJzFVjzwAoLD2oimaW2s7tHsFP55EdQazdK2e2/HQ1vrkL6w1WaOO2IyHlwX7hJ1UjxP QB3keMsgaW3n+zBKQ8vPWWRak3p20V+heJMpOP7nUATlEyVmm9tdsuaMPL0KNFVaimVW n4NaBDBENouvnR/dyxVpASANnlWd0bzIdPpfrYhlYdrRFctKxx/Q2UuVKm6Ng9KvkmTS MDDA== 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=mvwHWznV1CbjQr3A3SteeGWxU/09D9mqE8X8ZN62xhE=; b=KGPRQPlbJSjkGVbC2E8J1bO72xlPdghNUlaHvZbtQE60NEXsjqLe0p3CWt8HkwWRiW qZJOFc+rdk2Q1SmCsb443sCjGgFiunH8r1dsiDcQgU0diQJpEp3nm0yftne6y3T+L0VL 4jTUq160rGE4wZg1O2r2CnwVkA4vuKNBxEav8eYEWoFmF35Wizyx0ctlTkP3ykTQpoUo StJCLypVdfF7Snm7SSSFW5KT6o1SR9J/1ILsZ0hqBWJ/MyI+wwe7Sm2su2VFjcuAK/mR 2DgFPdUQWdBu3sCY0orDitr1tXYysEAlkW4I1jJV14/l04CG/HeN8NssjViSb3OdIIIp +8og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=pAJbYxZ9; 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 o25-20020a637e59000000b0053079f84a1esi14524932pgn.743.2023.05.16.21.36.53; Tue, 16 May 2023 21:37:05 -0700 (PDT) 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=pAJbYxZ9; 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 S232387AbjEQEgC (ORCPT + 99 others); Wed, 17 May 2023 00:36:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232109AbjEQEfq (ORCPT ); Wed, 17 May 2023 00:35:46 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E048A2D63; Tue, 16 May 2023 21:35:40 -0700 (PDT) X-UUID: 43a043b0f46c11edb20a276fd37b9834-20230517 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=mvwHWznV1CbjQr3A3SteeGWxU/09D9mqE8X8ZN62xhE=; b=pAJbYxZ9Kag4XhokRIGL/qVXn24LZ1emhs0uwaJ2IQQTnJObtyXQ1xz/I+beRSrV1rntlUDU4JDam9xQ+iOjO0bw52Y7+h3O9DU9z5m4xD1bRz/79E4Rdy19Rd9bsTsXoj34nC6HSnQ/SKsckbKltTiMfFs18S97VADj3lpM3kw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:f607bae1-7bfc-4c5c-a7cf-e7eb7c84301f,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.25,REQID:f607bae1-7bfc-4c5c-a7cf-e7eb7c84301f,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:d5b0ae3,CLOUDID:00b618c1-e32c-4c97-918d-fbb3fc224d4e,B ulkID:230517123535B3PXPBE0,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-CID-BAS: 0,_,0,_ X-UUID: 43a043b0f46c11edb20a276fd37b9834-20230517 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 606605858; Wed, 17 May 2023 12:35:34 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) 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.1118.26; Wed, 17 May 2023 12:35:33 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 17 May 2023 12:35:33 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , "Tinghan Shen" CC: , , , , , Subject: [PATCH v12 02/11] arm64: dts: mediatek: Update the node name of SCP rpmsg subnode Date: Wed, 17 May 2023 12:34:40 +0800 Message-ID: <20230517043449.26352-3-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230517043449.26352-1-tinghan.shen@mediatek.com> References: <20230517043449.26352-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,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED 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?1766114695789574709?= X-GMAIL-MSGID: =?utf-8?q?1766114695789574709?= Align the node name with the definition in SCP bindings. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno Acked-by: Matthias Brugger --- arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 2 +- arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi index 63952c1251df..ac4aeeded37c 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi @@ -825,7 +825,7 @@ pinctrl-names = "default"; pinctrl-0 = <&scp_pins>; - cros_ec { + cros-ec-rpmsg { compatible = "google,cros-ec-rpmsg"; mediatek,rpmsg-name = "cros-ec-rpmsg"; }; diff --git a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi index 5a440504d4f9..cd4d68f1d93b 100644 --- a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi @@ -1280,7 +1280,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 May 17 04:34:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 95049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp873093vqo; Tue, 16 May 2023 21:37:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6OhKpHDoE5nlH0wRwgT6m5kPIatBhAQhDEvwZIdOhc6HEcNcOJ/Y0+6iKsh30PkepkHIy8 X-Received: by 2002:a05:6a20:3c8b:b0:104:8045:c971 with SMTP id b11-20020a056a203c8b00b001048045c971mr21696973pzj.58.1684298230237; Tue, 16 May 2023 21:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684298230; cv=none; d=google.com; s=arc-20160816; b=FrJ7ExcdMEGS9QwMDLog8yvlda4qfxNlFYDIy2Xj6mva/TWHNuxpNzdF9tUkS6xtq7 XVMOOm7x+gXEszAmJ6+YaRQg2dr3TfVvMkKmCnpDiHV+ZvQO/6XRJPCMSgEfExkOSvH7 SFnmJMyd9NIVthne/yUV8DtYnBoGltQJz/xoCtGMSElN5ZTJNuxhsT0K8TjdSA10QWov crO2qcsfTOvCa4JvxZ43S3N0+/y8LouafTBK721XdmRIkUgbIOjyEN4TbrD2N9PSsgoX 7sm1t4qWESpnREAKkg6VV+FEbKK9rJ0xTn1AY8PCsBkqPoaSNPOqjM4zo12MpEruqzwV 37YQ== 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=JblePg9+ipUgwKreuv6vPTiCVfpDJvTaGPWkS1iUO1x+IiDPdKORHDskPMH9GZ0bcu R5Y58T0P4zi3CSRiSQg/Ttl+sopKLRjnF5Qn9QNxyulydASSBxqEAQ/M2lP86C0aPxAO otHvPyVHdLCzIYAQ8/8Ue9gNOGm180DV8DylLgiOZMhM7Zsm7mHafuIAJHlFI7M6zHcG 7XHJ8bprnHr760zzrb9jblOsNWClFqBpLuevkI5mjRkM6rz0kP3Ikf7Li7E6LhMUYSLF lywa7h4ut8WWVlNL5wNq/EHLOld2B64m28zpqjV3m9loaeoD8FcSKpOgJHxH4E3AOEjl 1BAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=CETtkgLa; 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 h21-20020a633855000000b005303c0e4c25si19432285pgn.276.2023.05.16.21.36.57; Tue, 16 May 2023 21:37:10 -0700 (PDT) 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=CETtkgLa; 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 S232441AbjEQEgL (ORCPT + 99 others); Wed, 17 May 2023 00:36:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232155AbjEQEfq (ORCPT ); Wed, 17 May 2023 00:35:46 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B72530F9; Tue, 16 May 2023 21:35:41 -0700 (PDT) X-UUID: 43b728d2f46c11edb20a276fd37b9834-20230517 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=CETtkgLavHcaOFquAMw6IyHbjOoefRHy+FnmC1/9ks2ZUl/hIDgnFprhwYwhGaTxIjeEGAYAcezBC53VuRaefx4VE/M1n5Vj4i4JStzwCBhSAu8Hr58JENlHGJgIIEvY7NexQaPTYJ89RQX2z/xVeuwg16MXfeImFtWyI83cdzw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:6f057aab-11c8-4e63-9d76-56f3611e8242,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:d5b0ae3,CLOUDID:8b5c116c-2f20-4998-991c-3b78627e4938,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-CID-BAS: 0,_,0,_ X-UUID: 43b728d2f46c11edb20a276fd37b9834-20230517 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 1427809753; Wed, 17 May 2023 12:35:34 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) 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.1118.26; Wed, 17 May 2023 12:35:33 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 17 May 2023 12:35:33 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v12 03/11] dt-bindings: remoteproc: mediatek: Support MT8195 dual-core SCP Date: Wed, 17 May 2023 12:34:41 +0800 Message-ID: <20230517043449.26352-4-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230517043449.26352-1-tinghan.shen@mediatek.com> References: <20230517043449.26352-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,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED 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?1766114700912302777?= X-GMAIL-MSGID: =?utf-8?q?1766114700912302777?= 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 Reviewed-by: Matthias Brugger --- .../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 May 17 04:34:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 95047 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp873064vqo; Tue, 16 May 2023 21:37:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7eQ9/uNjMrVNCHGOvgwu3/JEvNrYfxeId6TA5Viz4vswP/8dZUZ+b6MXbUz/d/adRKPJYJ X-Received: by 2002:a05:6a20:7f84:b0:107:35ed:285c with SMTP id d4-20020a056a207f8400b0010735ed285cmr3981173pzj.32.1684298224966; Tue, 16 May 2023 21:37:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684298224; cv=none; d=google.com; s=arc-20160816; b=v33CIXK1u81vCa1Q3gJS0NW7eaLkrNSup8XwSiNmGdi5XQOyzRCDRYhlsWlcgvVSGR BwuQSolEq8jpIj3ezcTJNVmzGQGJCzH9FNJ6BAte+mrIBmI6al4oSffZs6RfTGCNjF1z 3hsNBL9VPXByunp40S3gInsgJsabcKUnYyP3R0BbY/0hlBh5FdllNs+ZTjo2BVuWRkjg HYM1G23oSI3OlDqblVoFmkgW30kDcUWLONB63XA7eDlztwZWS44aecXwYu4Qe46dpdPI C4pCtTXO14TTfgNcXV8cL4DeBX6x0zp0K1DypTKzzcfM3YMZSfVDhumXSM2Yzk1i6Tq6 RY6Q== 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=CEveVxa65V9yiHQ1O3aqqq5fez2GB4dTHw/nJK1thn8=; b=zwaaJqYFFyfVcjjSruKAio2+6vsf/rxrMBVaa8+SXMNP8TyMIRNtc6hZi7m4cZ+6KO zTOrK/WY3rmH4Hc8BIb3i21v7W75V25E0HtZFVLIA7cTWy8zbn/v/B25bq7400caLLMK 7wZsRuy/A+ZEbbDwcP1MYkj7AFxxdy6o+fAH0a0jCKfFDgG/ay3a3BB0PijB7e7w2JIf 1HovyywLDisUf7rqMtQWNmKhqQScbkwEHlOeTWysWojnZCG+eINOAIh+3Oq2cbQCDCxf vm+9LENX+BO52iWdptx11QiYvpNH+6Ubcjb9NjPWDC/bT3fRFYiuQD4IOMg62oUan/dc zb/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=lu4eiLvl; 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 d70-20020a633649000000b0053070f4df43si15412392pga.450.2023.05.16.21.36.52; Tue, 16 May 2023 21:37:04 -0700 (PDT) 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=lu4eiLvl; 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 S232332AbjEQEgG (ORCPT + 99 others); Wed, 17 May 2023 00:36:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232113AbjEQEfq (ORCPT ); Wed, 17 May 2023 00:35:46 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BC1230FA; Tue, 16 May 2023 21:35:42 -0700 (PDT) X-UUID: 43d2542cf46c11ed9cb5633481061a41-20230517 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=CEveVxa65V9yiHQ1O3aqqq5fez2GB4dTHw/nJK1thn8=; b=lu4eiLvlA8T7TXU/QwQ2LVHVadSkj9vOJCkQCf8xpWzms8nnfkorbuwhdMlF7VPI72nFyvzuGesys8DSBjmfzAWCUquXctOEHK8qeva3Ye2axJeWTcFNqMXH3VdMmIHbdJGGqLFl3Ihvc64czMb47mOxWJf0TOaycAp+ll4qD2Q=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:1153359c-9ffb-46f8-9de0-8ab2d55bea84,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:d5b0ae3,CLOUDID:27b618c1-e32c-4c97-918d-fbb3fc224d4e,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-CID-BAS: 0,_,0,_ X-UUID: 43d2542cf46c11ed9cb5633481061a41-20230517 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 399646607; Wed, 17 May 2023 12:35:34 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) 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.1118.26; Wed, 17 May 2023 12:35:33 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 17 May 2023 12:35:33 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v12 04/11] remoteproc: mediatek: Add MT8195 SCP core 1 operations Date: Wed, 17 May 2023 12:34:42 +0800 Message-ID: <20230517043449.26352-5-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230517043449.26352-1-tinghan.shen@mediatek.com> References: <20230517043449.26352-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,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED 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?1766114695373481520?= X-GMAIL-MSGID: =?utf-8?q?1766114695373481520?= 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 Reviewed-by: Matthias Brugger --- drivers/remoteproc/mtk_common.h | 9 ++++++ drivers/remoteproc/mtk_scp.c | 56 +++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index ea6fa1100a00..c0905aec3b4b 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,14 @@ #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_CFG 0x20034 + #define SCP_FW_VER_LEN 32 #define SCP_SHARE_BUFFER_SIZE 288 diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index dcc94ee2458d..d66822dad943 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 = rproc->priv; @@ -989,6 +1033,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 May 17 04:34:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 95055 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp874715vqo; Tue, 16 May 2023 21:42:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5k48rgJhRiFuAP+7ip75EyofsJxmZJn9Y1H1V4IvJUllg2vb4fCNeVy4KvEr4v1FAwwHtL X-Received: by 2002:a17:902:d38c:b0:1ab:675:3e31 with SMTP id e12-20020a170902d38c00b001ab06753e31mr46416760pld.37.1684298544751; Tue, 16 May 2023 21:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684298544; cv=none; d=google.com; s=arc-20160816; b=PRlkCQ7gT6snmbvFT1wtm1WfaDLyopTJaV++bZVqnVWPhqnq6a/vv9D5fyaBCOlTbc 02pWEUKWZt+ZXtnH2MRSa0cHdh7PbqlFd9cPfV1sXJBwyCBmDDcql3TrYqW/Y5dwobq4 HyYCJffO8Z4WX1Vpa6xG8verReHlK19moNYHE0QuClY3jvxoKYsb79GRQvKBh/h5V4jA RVMqlWsPsz+uPzCyiKR2HIgSTgohP8FZ9uB/wBr2Y7k2Hff8J1g3/ZS8oRhwiNOrU1DG KEA5W3VotqPOXk9H+z8e0XYPcG2/mE2WyyUYLIHyP0knr1ZNdlnJibHZAYhEX+p0UhoF 1Ynw== 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=5NKxD9mELFEypwzYoUzbCsi3BBnNAKNkMuH30HSMTiY=; b=zKFxUrVaIfmng5JR6CScBknNim3a6GE8XF4pSS/ccyURHUZ0RoE17xcJrzUoU40ub4 T/bCcYDakHO2IAk3pJALWPNMvgWWNA3j0yTJqTmS390TX3DaCUk6zD+XKaZMzdEe7DKZ FK60ZSHzgOI0YRJaVx73wBb+rN5oSdRTznA0injweERJPKsQ1ZPbWt63ifeDjhOKAlkK JuMFBrRRCHMhk5h3nqoqu3axoGLiVn9dMYQ8Jrmx4XfPFs97W+YJv+i8kqU/OWpUuyjJ zHdeMym7z/TT1NlCzmC8ITkPFw13fPRmC9cPcDVdIDJLY15TeZRXkRQz6mZrrlj1kjQ2 Vv6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=CHscDgai; 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 m9-20020a170902db0900b001aaf4d2eef6si22022462plx.370.2023.05.16.21.42.13; Tue, 16 May 2023 21:42:24 -0700 (PDT) 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=CHscDgai; 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 S231821AbjEQEgb (ORCPT + 99 others); Wed, 17 May 2023 00:36:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232195AbjEQEfr (ORCPT ); Wed, 17 May 2023 00:35:47 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DF683A99; Tue, 16 May 2023 21:35:43 -0700 (PDT) X-UUID: 43786d68f46c11ed9cb5633481061a41-20230517 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=5NKxD9mELFEypwzYoUzbCsi3BBnNAKNkMuH30HSMTiY=; b=CHscDgaif5ybaKC+yQvxBJmAaeFji4UmjCc35WvKse3UdyDiYQ6V3lJPzyJhtoZMMMmE4vsCRrigmlu4v9WUO9XhDmlBJLvB6Y7EoBCak/ezO3FTsCYH1eVWOYYkjvT8k5dzgeAI9TRAQ4/HcdN/uwC7dt98eNZZeHXctl87v0A=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:b021014c-7199-425a-b89f-47b173d4d1a5,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:d5b0ae3,CLOUDID:ac5c116c-2f20-4998-991c-3b78627e4938,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-CID-BAS: 0,_,0,_ X-UUID: 43786d68f46c11ed9cb5633481061a41-20230517 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 1843277796; Wed, 17 May 2023 12:35:34 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) 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.1118.26; Wed, 17 May 2023 12:35:33 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 17 May 2023 12:35:33 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v12 05/11] remoteproc: mediatek: Introduce cluster on single-core SCP Date: Wed, 17 May 2023 12:34:43 +0800 Message-ID: <20230517043449.26352-6-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230517043449.26352-1-tinghan.shen@mediatek.com> References: <20230517043449.26352-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,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED 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?1766115031037717678?= X-GMAIL-MSGID: =?utf-8?q?1766115031037717678?= This is the preliminary step for probing multi-core SCP. The initialization procedure for remoteproc is similar for both single-core and multi-core architectures and is reusing to avoid redundant code. Rewrite the probing flow of single-core SCP to adapt with the 'cluster' concept needed by probing the multi-core SCP. The main differences are, - the SCP core object(s) is maintained at the cluster list instead of at the platofmr device driver data property. - save the cluster information at the platofmr device driver data property. - In order to keep the compatibility of exported SCP APIs which getting the SCP core object by SCP node phandle, move the SCP core object pointers to the platform device platform data property. The registers of config and l1tcm are shared for multi-core SCP. Reuse the mapped addresses for all cores. Signed-off-by: Tinghan Shen --- drivers/remoteproc/mtk_common.h | 2 + drivers/remoteproc/mtk_scp.c | 151 +++++++++++++++++++++++--------- 2 files changed, 112 insertions(+), 41 deletions(-) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index c0905aec3b4b..56395e8664cb 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -128,6 +128,8 @@ struct mtk_scp { size_t dram_size; struct rproc_subdev *rpmsg_subdev; + + struct list_head elem; }; /** diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index d66822dad943..c8fc6b46f82b 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -23,6 +23,14 @@ #define MAX_CODE_SIZE 0x500000 #define SECTION_NAME_IPI_BUFFER ".ipi_buffer" +struct mtk_scp_of_cluster { + void __iomem *reg_base; + void __iomem *l1tcm_base; + size_t l1tcm_size; + phys_addr_t l1tcm_phys; + struct list_head mtk_scp_list; +}; + /** * scp_get() - get a reference to SCP. * @@ -51,7 +59,7 @@ struct mtk_scp *scp_get(struct platform_device *pdev) return NULL; } - return platform_get_drvdata(scp_pdev); + return *(struct mtk_scp **)dev_get_platdata(&scp_pdev->dev); } EXPORT_SYMBOL_GPL(scp_get); @@ -810,14 +818,14 @@ static void scp_unmap_memory_region(struct mtk_scp *scp) static int scp_register_ipi(struct platform_device *pdev, u32 id, ipi_handler_t handler, void *priv) { - struct mtk_scp *scp = platform_get_drvdata(pdev); + struct mtk_scp *scp = *(struct mtk_scp **)dev_get_platdata(&pdev->dev); return scp_ipi_register(scp, id, handler, priv); } static void scp_unregister_ipi(struct platform_device *pdev, u32 id) { - struct mtk_scp *scp = platform_get_drvdata(pdev); + struct mtk_scp *scp = *(struct mtk_scp **)dev_get_platdata(&pdev->dev); scp_ipi_unregister(scp, id); } @@ -825,7 +833,7 @@ static void scp_unregister_ipi(struct platform_device *pdev, u32 id) static int scp_send_ipi(struct platform_device *pdev, u32 id, void *buf, unsigned int len, unsigned int wait) { - struct mtk_scp *scp = platform_get_drvdata(pdev); + struct mtk_scp *scp = *(struct mtk_scp **)dev_get_platdata(&pdev->dev); return scp_ipi_send(scp, id, buf, len, wait); } @@ -855,7 +863,8 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) } } -static int scp_probe(struct platform_device *pdev) +static struct mtk_scp *scp_rproc_init(struct platform_device *pdev, + struct mtk_scp_of_cluster *scp_cluster) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; @@ -867,52 +876,42 @@ static int scp_probe(struct platform_device *pdev) ret = rproc_of_parse_firmware(dev, 0, &fw_name); if (ret < 0 && ret != -EINVAL) - return ret; + return ERR_PTR(ret); rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp)); - if (!rproc) - return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n"); + if (!rproc) { + dev_err(dev, "unable to allocate remoteproc\n"); + return ERR_PTR(-ENOMEM); + } scp = rproc->priv; scp->rproc = rproc; scp->dev = dev; scp->data = of_device_get_match_data(dev); - platform_set_drvdata(pdev, scp); + platform_device_add_data(pdev, &scp, sizeof(scp)); + + scp->reg_base = scp_cluster->reg_base; + scp->l1tcm_base = scp_cluster->l1tcm_base; + scp->l1tcm_size = scp_cluster->l1tcm_size; + scp->l1tcm_phys = scp_cluster->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)) - return dev_err_probe(dev, PTR_ERR(scp->sram_base), - "Failed to parse and map sram memory\n"); + if (IS_ERR(scp->sram_base)) { + dev_err(dev, "Failed to parse and map sram memory\n"); + return ERR_PTR(PTR_ERR(scp->sram_base)); + } 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; + return ERR_PTR(ret); ret = scp_map_memory_region(scp); if (ret) - return ret; + return ERR_PTR(ret); mutex_init(&scp->send_lock); for (i = 0; i < SCP_IPI_MAX; i++) @@ -939,11 +938,7 @@ static int scp_probe(struct platform_device *pdev) goto remove_subdev; } - ret = rproc_add(rproc); - if (ret) - goto remove_subdev; - - return 0; + return scp; remove_subdev: scp_remove_rpmsg_subdev(scp); @@ -954,15 +949,13 @@ static int scp_probe(struct platform_device *pdev) mutex_destroy(&scp->ipi_desc[i].lock); mutex_destroy(&scp->send_lock); - return ret; + return ERR_PTR(ret); } -static void scp_remove(struct platform_device *pdev) +static void scp_free(struct mtk_scp *scp) { - struct mtk_scp *scp = platform_get_drvdata(pdev); int i; - rproc_del(scp->rproc); scp_remove_rpmsg_subdev(scp); scp_ipi_unregister(scp, SCP_IPI_INIT); scp_unmap_memory_region(scp); @@ -971,6 +964,82 @@ static void scp_remove(struct platform_device *pdev) mutex_destroy(&scp->send_lock); } +static int scp_cluster_init(struct platform_device *pdev) +{ + struct mtk_scp_of_cluster *scp_cluster = platform_get_drvdata(pdev); + struct list_head *cluster = &scp_cluster->mtk_scp_list; + struct mtk_scp *scp; + int ret; + + scp = scp_rproc_init(pdev, scp_cluster); + if (IS_ERR(scp)) + return PTR_ERR(scp); + + ret = rproc_add(scp->rproc); + if (ret) { + dev_err(dev, "Failed to add rproc\n"); + scp_free(scp); + return ret; + } + + list_add_tail(&scp->elem, cluster); + + return 0; +} + +static int scp_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct mtk_scp_of_cluster *scp_cluster; + struct resource *res; + int ret; + + scp_cluster = devm_kzalloc(dev, sizeof(*scp_cluster), GFP_KERNEL); + if (!scp_cluster) + return -ENOMEM; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg"); + scp_cluster->reg_base = devm_ioremap_resource(dev, res); + if (IS_ERR(scp_cluster->reg_base)) + return dev_err_probe(dev, PTR_ERR(scp_cluster->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_cluster->l1tcm_base = devm_ioremap_resource(dev, res); + if (IS_ERR(scp_cluster->l1tcm_base)) { + ret = PTR_ERR(scp_cluster->l1tcm_base); + if (ret != -EINVAL) + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n"); + + scp_cluster->l1tcm_base = NULL; + } else { + scp_cluster->l1tcm_size = resource_size(res); + scp_cluster->l1tcm_phys = res->start; + } + + INIT_LIST_HEAD(&scp_cluster->mtk_scp_list); + platform_set_drvdata(pdev, scp_cluster); + + ret = scp_cluster_init(pdev); + if (ret) + return ret; + + return 0; +} + +static void scp_remove(struct platform_device *pdev) +{ + struct mtk_scp_of_cluster *scp_cluster = platform_get_drvdata(pdev); + struct mtk_scp *scp, *temp; + + list_for_each_entry_safe_reverse(scp, temp, &scp_cluster->mtk_scp_list, elem) { + list_del(&scp->elem); + rproc_del(scp->rproc); + scp_free(scp); + } +} + static const struct mtk_scp_of_data mt8183_of_data = { .scp_clk_get = mt8183_scp_clk_get, .scp_before_load = mt8183_scp_before_load, From patchwork Wed May 17 04:34:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 95052 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp873168vqo; Tue, 16 May 2023 21:37:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7WYSKgcj0bpqTUBkp2e2fS0WHpaOk5pDuaBtodHvUHLmBV+fTPZi1oJY7zSKmsvVC3AfAd X-Received: by 2002:a17:902:6ac3:b0:1ac:93ba:a5ec with SMTP id i3-20020a1709026ac300b001ac93baa5ecmr25854545plt.52.1684298247399; Tue, 16 May 2023 21:37:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684298247; cv=none; d=google.com; s=arc-20160816; b=aIVo07FEx7KyNH1A0ezhBVs8MxoEbvl6TF9tun5+coTmRYcGLFVvquQ4R01csfB7YH j5QXRCioTwWIApvv2mQEEJXB4KpcTtWU+pdJDElIWL5Y9YRWP/rNL/BXjEC6kwn12r/i 1NXzs7ULkdMc1ObcvoDjfU4HCdsxEOmMMT1jAWeRyDghOklLmzIczppwCkaNlkOrTJo+ XYrIuCzGk+T4aiZ8JL/h3/Q3T2mLkpBi51R8yx2E62vnRmcO/0+aMVVRe2EFVcczfop5 5J6fxqsyzWUbOK0ByCyqDwotHmm+OzW3jKrP445O9MzZuYZk1pTnvCL9YCtP5YZ4YLYj WoeQ== 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=Hma6p26rQIyIThKNfeXF5jdshZtrw3Y5qqlbj4TWwLU=; b=cQ8V3fQFbG1Zy+LfcU9lsovZEFq02LBSTMnIKLoZ68skz1Q8b8GwFkAaNz3547sMnA ghkDdmeGMzi/4esXOCFgbpXdLQZNdWIEDMuv1HPbSjvnzfgb1Zu48VS72EAaR8fN/8BZ NYAQUs/yBlK1rd9CldrO9tJUI3gVLYeegyKtrGoDKpPmODKXSkne6ufSQMinwUhBt4gu EZYjBZthgY9YpNFd/SpXJtfsKMIL/HdFgXCTLwV9mTQ86qHtfZFBKkmVHA+fLUoDUGEE H38YJjiY7fqKAwLdmd9H7oacjakzCJDfVXHv80u3gcWZSwuXaoWL38wJlpBqDIAiyK65 JdKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="tvYig92/"; 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 m9-20020a170902db0900b001aaf4d2eef6si22022462plx.370.2023.05.16.21.37.15; Tue, 16 May 2023 21:37:27 -0700 (PDT) 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="tvYig92/"; 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 S232287AbjEQEgh (ORCPT + 99 others); Wed, 17 May 2023 00:36:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232193AbjEQEfr (ORCPT ); Wed, 17 May 2023 00:35:47 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B1733A97; Tue, 16 May 2023 21:35:43 -0700 (PDT) X-UUID: 43b8f9c8f46c11edb20a276fd37b9834-20230517 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=Hma6p26rQIyIThKNfeXF5jdshZtrw3Y5qqlbj4TWwLU=; b=tvYig92/t9jTNhppiElsYlRQfVz9dfjKnwtLVz+g9ifKWid+yXHK1jMycMzT2vDzwalj4Fb/Aa3YfNo15/Yk8LWfiAuihj0ABb2hM+OOl5nUj7nrSXO5NOZpUAtcwk5yNTvwDSLxw2rrd7rtw0KjovWfvyzaAgBwADApfxyQJI8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:19db995e-8353-4835-a703-5bbc8ac6f9fe,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:d5b0ae3,CLOUDID:04b618c1-e32c-4c97-918d-fbb3fc224d4e,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-CID-BAS: 0,_,0,_ X-UUID: 43b8f9c8f46c11edb20a276fd37b9834-20230517 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 2061545457; Wed, 17 May 2023 12:35:34 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) 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.1118.26; Wed, 17 May 2023 12:35:33 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 17 May 2023 12:35:33 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v12 06/11] remoteproc: mediatek: Probe multi-core SCP Date: Wed, 17 May 2023 12:34:44 +0800 Message-ID: <20230517043449.26352-7-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230517043449.26352-1-tinghan.shen@mediatek.com> References: <20230517043449.26352-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,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED 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?1766114719023414022?= X-GMAIL-MSGID: =?utf-8?q?1766114719023414022?= 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. Add the remoteproc instances of multi-core SCP to the SCP cluster list. When the SCP driver is removed, it cleanup resources by walking through the cluster list. Signed-off-by: Tinghan Shen --- drivers/remoteproc/mtk_scp.c | 115 +++++++++++++++++++++++++++++++++-- 1 file changed, 111 insertions(+), 4 deletions(-) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index c8fc6b46f82b..d644e232dfec 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -864,7 +864,8 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) } static struct mtk_scp *scp_rproc_init(struct platform_device *pdev, - struct mtk_scp_of_cluster *scp_cluster) + struct mtk_scp_of_cluster *scp_cluster, + const struct mtk_scp_of_data *of_data) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; @@ -887,7 +888,7 @@ static struct mtk_scp *scp_rproc_init(struct platform_device *pdev, scp = rproc->priv; scp->rproc = rproc; scp->dev = dev; - scp->data = of_device_get_match_data(dev); + scp->data = of_data; platform_device_add_data(pdev, &scp, sizeof(scp)); scp->reg_base = scp_cluster->reg_base; @@ -964,14 +965,15 @@ static void scp_free(struct mtk_scp *scp) mutex_destroy(&scp->send_lock); } -static int scp_cluster_init(struct platform_device *pdev) +static int scp_add_single_core(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct mtk_scp_of_cluster *scp_cluster = platform_get_drvdata(pdev); struct list_head *cluster = &scp_cluster->mtk_scp_list; struct mtk_scp *scp; int ret; - scp = scp_rproc_init(pdev, scp_cluster); + scp = scp_rproc_init(pdev, scp_cluster, of_device_get_match_data(dev)); if (IS_ERR(scp)) return PTR_ERR(scp); @@ -987,6 +989,100 @@ static int scp_cluster_init(struct platform_device *pdev) return 0; } +static int scp_add_multi_core(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev_of_node(dev); + struct platform_device *cpdev; + struct device_node *child; + struct mtk_scp_of_cluster *scp_cluster = platform_get_drvdata(pdev); + struct list_head *cluster = &scp_cluster->mtk_scp_list; + const struct mtk_scp_of_data **cluster_of_data; + struct mtk_scp *scp, *temp; + int core_id = 0; + int ret; + + cluster_of_data = (const struct mtk_scp_of_data **)of_device_get_match_data(dev); + + for_each_available_child_of_node(np, child) { + if (!cluster_of_data[core_id]) { + 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; + } + + scp = scp_rproc_init(cpdev, scp_cluster, cluster_of_data[core_id]); + put_device(&cpdev->dev); + if (IS_ERR(scp)) { + ret = PTR_ERR(scp); + dev_err(dev, "Failed to initialize core %d rproc\n", core_id); + of_node_put(child); + goto init_fail; + } + + ret = rproc_add(scp->rproc); + if (ret) { + dev_err(dev, "Failed to add rproc of core %d\n", core_id); + of_node_put(child); + scp_free(scp); + goto init_fail; + } + + list_add_tail(&scp->elem, cluster); + core_id++; + } + + return 0; + +init_fail: + list_for_each_entry_safe_reverse(scp, temp, cluster, elem) { + list_del(&scp->elem); + rproc_del(scp->rproc); + scp_free(scp); + } + + return ret; +} + +static int scp_is_single_core(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev_of_node(dev); + struct device_node *child; + + child = of_get_next_available_child(np, NULL); + if (!child) + return dev_err_probe(dev, -ENODEV, "No child node\n"); + + of_node_put(child); + return of_node_name_eq(child, "cros-ec-rpmsg"); +} + +static int scp_cluster_init(struct platform_device *pdev) +{ + int ret; + + ret = scp_is_single_core(pdev); + if (ret < 0) + return ret; + + if (ret) + ret = scp_add_single_core(pdev); + else + ret = scp_add_multi_core(pdev); + + return ret; +} + static int scp_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1021,6 +1117,10 @@ static int scp_probe(struct platform_device *pdev) INIT_LIST_HEAD(&scp_cluster->mtk_scp_list); platform_set_drvdata(pdev, scp_cluster); + ret = devm_of_platform_populate(dev); + if (ret) + return dev_err_probe(dev, ret, "Failed to populate platform devices\n"); + ret = scp_cluster_init(pdev); if (ret) return ret; @@ -1114,12 +1214,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 May 17 04:34:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 95053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp873182vqo; Tue, 16 May 2023 21:37:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ58/UiHl6BImqyP33z0zRcGxbJPU0oVQWHXUihvjRjou3LidMYpUZEoFJR9SjQbLLF/L/6w X-Received: by 2002:a17:902:c40a:b0:1ab:1a73:7c7f with SMTP id k10-20020a170902c40a00b001ab1a737c7fmr57503496plk.63.1684298251641; Tue, 16 May 2023 21:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684298251; cv=none; d=google.com; s=arc-20160816; b=bHnoh5Dg6K28uHrbbph4L0N9TKjX/mFHQm9USzphzGxORsbe0Px88JzKuuvM60A2GV eAN+G27uB97dgZNGurecBEfgZvOOBLNhubODreR7or9JWgG5NJ8uTkTGciQeDEXkwCBA q+hjGx3nteUqY3Ucba+7Osylfo403CMmN/Ae9iMLNV80oeWJskLCb6YFLRXJZHjdvkNj m2LTFRtPO9OpgBWIbJiG2T24rqkhag1k836QYJuOc3eqhyCKANTWJ8CsYw1fcqEq8dT/ PMg3H+Ffd3lH4CHXNx15V/PUlOKxdOV1JeekXcYCCYLnYtRloHZdtRaRAD7YoPlnhN+y AhFw== 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=mJFf4UqkEPOcLYt3DLx8HtQsPAkilJL1hZbjwl0w82s=; b=nUx28lVdhDO/whXMopiXTwb9Ns0hOyHvCPSv1qQO7TJq0wgGccgRyLtvJPR+yA6j+b 3qaKUmVNsLJq1Sz75WAPUm1NbE/f9S2YpOMm9gexXkQbOPLUBuOwx6p4/I1pvaPS20VT 8jaXw2l8/s77ag9AW7RJiIPUcNoYm4RxRMK79RUuLkyg3utFPWypyC1bgBMc3YAl/xus MG/noNW8WRn6Xw5B9MOIcnlsizcDI6rxpDh2IsbCye3KjsIBc4Ho9VWi468UUZTto7fn Ykf7BkKQBm0IeTJM6hsSL8uRsKMNcJA8cykEwwwoVPkvvVMjUDAckrdcZkv6kuHSy6r4 Y1ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=WVLqJtF9; 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 u18-20020a170902e81200b001a51368b098si21673383plg.209.2023.05.16.21.37.18; Tue, 16 May 2023 21:37:31 -0700 (PDT) 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=WVLqJtF9; 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 S232242AbjEQEgr (ORCPT + 99 others); Wed, 17 May 2023 00:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232182AbjEQEfr (ORCPT ); Wed, 17 May 2023 00:35:47 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BA1035AE; Tue, 16 May 2023 21:35:42 -0700 (PDT) X-UUID: 43a80370f46c11edb20a276fd37b9834-20230517 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=mJFf4UqkEPOcLYt3DLx8HtQsPAkilJL1hZbjwl0w82s=; b=WVLqJtF9cFoqmVcfsKUW3GptQbTKLqRNY93R2adOulu39PWz9hn2K6H9kLOFvIYFWR0mZFgZ1THLPcnHTOMp8Ykk/fLAW6k6EXQXRxAmvUUPQZt0X2RLHoiM+suUjQE5vj5GD8Dz9K02daILW8ncBOod35zBXLxzftu262hIReU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:908764d8-8d54-45bb-a7cb-5ed37705b5d3,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.25,REQID:908764d8-8d54-45bb-a7cb-5ed37705b5d3,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:d5b0ae3,CLOUDID:03b618c1-e32c-4c97-918d-fbb3fc224d4e,B ulkID:230517123535Y6AFSH7Q,BulkQuantity:0,Recheck:0,SF:17|19|48|38|29|28,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-CID-BAS: 0,_,0,_ X-UUID: 43a80370f46c11edb20a276fd37b9834-20230517 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1156253824; Wed, 17 May 2023 12:35:34 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) 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.1118.26; Wed, 17 May 2023 12:35:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 17 May 2023 12:35:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , "Tinghan Shen" CC: , , , , , Subject: [PATCH v12 07/11] remoteproc: mediatek: Control SCP core 1 by rproc subdevice Date: Wed, 17 May 2023 12:34:45 +0800 Message-ID: <20230517043449.26352-8-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230517043449.26352-1-tinghan.shen@mediatek.com> References: <20230517043449.26352-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,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED 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?1766114723520207718?= X-GMAIL-MSGID: =?utf-8?q?1766114723520207718?= 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 | 88 +++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index 56395e8664cb..85afed2e6928 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -100,6 +100,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; @@ -130,6 +137,8 @@ struct mtk_scp { struct rproc_subdev *rpmsg_subdev; struct list_head elem; + 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 d644e232dfec..18534b1179b5 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -863,6 +863,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 struct mtk_scp *scp_rproc_init(struct platform_device *pdev, struct mtk_scp_of_cluster *scp_cluster, const struct mtk_scp_of_data *of_data) @@ -957,6 +1011,7 @@ static void scp_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); @@ -989,6 +1044,15 @@ static int scp_add_single_core(struct platform_device *pdev) return 0; } +static void scp_rproc_boot_callback(const struct firmware *fw, void *context) +{ + struct rproc *rproc = context; + + rproc_boot(rproc); + + release_firmware(fw); +} + static int scp_add_multi_core(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1029,6 +1093,20 @@ static int scp_add_multi_core(struct platform_device *pdev) goto init_fail; } + scp->cluster = cluster; + if (!list_empty(cluster)) { + ret = scp_core_subdev_register(scp); + if (ret) { + dev_err(dev, "Failed to register core %d as subdev\n", core_id); + of_node_put(child); + scp_free(scp); + goto init_fail; + } + } + + /* boot after all cores finished rproc_add() */ + scp->rproc->auto_boot = false; + ret = rproc_add(scp->rproc); if (ret) { dev_err(dev, "Failed to add rproc of core %d\n", core_id); @@ -1041,6 +1119,16 @@ static int scp_add_multi_core(struct platform_device *pdev) core_id++; } + /* boot core 0, and other cores are booted following core 0 as subdevices */ + scp = list_first_entry(cluster, struct mtk_scp, elem); + ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_UEVENT, + scp->rproc->firmware, &scp->rproc->dev, GFP_KERNEL, + scp->rproc, scp_rproc_boot_callback); + if (ret < 0) { + dev_err(dev, "request_firmware_nowait err: %d\n", ret); + goto init_fail; + } + return 0; init_fail: From patchwork Wed May 17 04:34: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: 95048 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp873065vqo; Tue, 16 May 2023 21:37:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6e5dkE4qgMxXs9g/611dM9PD2ECymi8JX9wbyRzPEYGjl3U3h5WAV3lW0gI345X2B3ZcrE X-Received: by 2002:a17:90a:9307:b0:24d:ef6a:dd0a with SMTP id p7-20020a17090a930700b0024def6add0amr37977848pjo.5.1684298225235; Tue, 16 May 2023 21:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684298225; cv=none; d=google.com; s=arc-20160816; b=qq1eJSvp6OmlZioLPDtnrFCIqCno3MVIqSuTTefg2cncO6gf08tqKKu+x52hwhM8a3 pqd37kajkfHk+DYkTks3a+3dNivL6pDVyQkGB4d2TSS14/JQdSeW+74gkpuNO8oMBvGX S5tEdEMGYPhZAKWRjtbzwTpKCTwAuyZkvrJlptyFU+pdAC1RI5cYE7ZYH5x20fWyT1fm AfdtwwnjZerdZBENPBW0K/EnPDTEzhjPWsH2EbGU6vDDktlrsklPGZVkfw37MqCY8sMJ IwFZO+aBZuosb2lu+lMIzUYXGOHApmD050Y7CGX4eOCyoFPJfF0IeHlz0NG70Ejlu2rb SvRg== 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=dL6oOn1/EzbHszC8WZ/U270c7XCzijc88Afrg8FORWo=; b=P3i3CfVG5ANnNluLFX3zIvSiO/vh+o7lLOSgYCgtXKNXo2Cqy+YXDAF2wgyopdjAc/ 2SxrFltsAZciILMH3vwAjzd6qbrmiG2gm3647fByzW1gKm1TLtBe5qf2E56bmIVH79lR YVKskbusUfHseNk3j+2sWKtsf00Fwyz+UhOvxeemsoyoEwu/vAOqVtl9IQQ65w/OLhkn JBppGAj43LpkMp7sTNyBrE2U6V6SShoPDeDfrNUzYULL2UqzZK/VQUeuAUFLCo4+oiex l+wg3XIRWowD7W1gk4LW7UvzVHtfTuyKBuP4CXMH0YWXUZBq6Kd8UM6JJ1FOl7y8VeVK OIdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=bH3I2pme; 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 p22-20020a639516000000b0052c219ec8f6si20432057pgd.839.2023.05.16.21.36.53; Tue, 16 May 2023 21:37:05 -0700 (PDT) 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=bH3I2pme; 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 S232351AbjEQEf6 (ORCPT + 99 others); Wed, 17 May 2023 00:35:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232110AbjEQEfq (ORCPT ); Wed, 17 May 2023 00:35:46 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E59430D6; Tue, 16 May 2023 21:35:40 -0700 (PDT) X-UUID: 43d3ce56f46c11ed9cb5633481061a41-20230517 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=dL6oOn1/EzbHszC8WZ/U270c7XCzijc88Afrg8FORWo=; b=bH3I2pme6PjRpU2iBjYObCOlDmU6mx0+J1BmvFiGOqB0NYGr34udQqbmrzdGK3lvghy1T/tELNSjpSwQ6irqlz+agPTvrJ3IVTDV5jUADu8InysiqVvxyD35/+FdceWt1q2dl2Z2Lw0U8LUZa0vzFqlPbVoFipRmquAgls2TTXI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:26e49577-5f03-4d12-8c8e-ac078e30faf5,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:d5b0ae3,CLOUDID:24b618c1-e32c-4c97-918d-fbb3fc224d4e,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-CID-BAS: 0,_,0,_ X-UUID: 43d3ce56f46c11ed9cb5633481061a41-20230517 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1095195747; Wed, 17 May 2023 12:35:34 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) 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.1118.26; Wed, 17 May 2023 12:35:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 17 May 2023 12:35:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v12 08/11] remoteproc: mediatek: Setup MT8195 SCP core 1 SRAM offset Date: Wed, 17 May 2023 12:34:46 +0800 Message-ID: <20230517043449.26352-9-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230517043449.26352-1-tinghan.shen@mediatek.com> References: <20230517043449.26352-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,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED 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?1766114696259418387?= X-GMAIL-MSGID: =?utf-8?q?1766114696259418387?= 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_common.h | 7 +++++++ drivers/remoteproc/mtk_scp.c | 27 +++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index 85afed2e6928..e1cec3109fd9 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -65,6 +65,13 @@ #define MT8195_CORE1_MEM_ATT_PREDEF 0x20008 #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_FW_VER_LEN 32 #define SCP_SHARE_BUFFER_SIZE 288 diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 7b954d2f946e..2b6c1725fc13 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -485,6 +485,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. */ @@ -493,6 +496,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 May 17 04:34: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: 95051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp873125vqo; Tue, 16 May 2023 21:37:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7l/KR+HHB2B8nPXcFjRj0myMVh5LtCG3kokgenXtogK4iG8ozAnntgw3ZvWKgoo5/KfUT4 X-Received: by 2002:a17:902:9a85:b0:1a9:6a10:70e9 with SMTP id w5-20020a1709029a8500b001a96a1070e9mr873676plp.33.1684298237738; Tue, 16 May 2023 21:37:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684298237; cv=none; d=google.com; s=arc-20160816; b=mLgXYD9owF/+FNBg0GOPgSaxu4/uDOVfP77xOSLVaJrneHtIFK/ly73wEN2oSZiMlD NMuX58u4Sbpb5oJTe6pOTfAmSrpxJqEk4HDs/xVXkU0ukulbzsBHu5YdJ1iODHKtMLbT 2bxZfHkCuzH28IWq8dZymThAu51h+MWYMKYp7a8XAe0VNUO1h20/BVJdRViRhsO9Gm9C AAwvdOx2tkSXFmFOrDBSSHe/QwJajzv7OKMPYirCb5EN8GPrzp1kfG7qRIBsEHfAccTK egvRT7kiasqU6eylMY7SN0K2XNkwKri0iUPGRyZ9A49cwAALuf0fx/b3WmmxzcAmx7Eo IcYA== 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=4ifmf+9QmokTVKVyng3RiCJKe7cb0N/G7ML2NziLH00=; b=KDMRTTeCw+WOPMPwo4hlPltsKMMjwxpcujmVC1uGiiig6OZLp69SElXd0toZUtN3MG m3/zMUP5WvGtXS+QX4B9JYaTC3v+0s1EdduiwgESmE3mA9XEwMal9f0ed8PXliureZXp P+pXzqHty2YVZa32/U6sPz2svb0d2pBTWJkKtfvFxMQP6m6ZOfQ4rDQbdSv8Jgsrwkyt 8Bk0NJeBuVcuRpCQMQaJozlVlkkuzhaacwJLJEOnFqxCbPSsYVkf2eX8V1Uk6hAjxgux rKA+Y4cb/JiIYrd3+BXBEHxn3nPzxRXCnhvL5Raq1oexNgHfOZuc6zFSsouBEwdaw9F7 q+kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=LfyS4CIg; 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 d23-20020a170902729700b001aaee36e272si18594732pll.477.2023.05.16.21.37.05; Tue, 16 May 2023 21:37:17 -0700 (PDT) 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=LfyS4CIg; 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 S232478AbjEQEgX (ORCPT + 99 others); Wed, 17 May 2023 00:36:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232198AbjEQEfs (ORCPT ); Wed, 17 May 2023 00:35:48 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A14652D4F; Tue, 16 May 2023 21:35:45 -0700 (PDT) X-UUID: 44581b84f46c11edb20a276fd37b9834-20230517 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=4ifmf+9QmokTVKVyng3RiCJKe7cb0N/G7ML2NziLH00=; b=LfyS4CIgPTd9JHlApiaXHg1eoLxJVdeZPrpxUDb9OCF4WMbqkCUEmw544xIbkpgsov0e+FezfEZfLyyPQhPsQz8MIYQNBl1dW+RZxAlLDKFkgWwFMRYuf+7ufOiD/zpguI2QN5O6p7wwDcJGPER82WJIV5sgP8jrpmwatXFpHi0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:cf1de083-9979-4c7d-a3d2-6635faa9dcc4,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:d5b0ae3,CLOUDID:e25c116c-2f20-4998-991c-3b78627e4938,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-CID-BAS: 0,_,0,_ X-UUID: 44581b84f46c11edb20a276fd37b9834-20230517 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 774455029; Wed, 17 May 2023 12:35:35 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) 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.1118.26; Wed, 17 May 2023 12:35:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 17 May 2023 12:35:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v12 09/11] remoteproc: mediatek: Handle MT8195 SCP core 1 watchdog timeout Date: Wed, 17 May 2023 12:34:47 +0800 Message-ID: <20230517043449.26352-10-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230517043449.26352-1-tinghan.shen@mediatek.com> References: <20230517043449.26352-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,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED 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?1766114708962650848?= X-GMAIL-MSGID: =?utf-8?q?1766114708962650848?= 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 | 5 +++++ drivers/remoteproc/mtk_scp.c | 25 ++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index e1cec3109fd9..5ec83ac18503 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 @@ -63,6 +67,7 @@ #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 diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 2b6c1725fc13..6319ba21bcad 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -230,6 +230,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; @@ -1306,7 +1329,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 May 17 04:34: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: 95050 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp873120vqo; Tue, 16 May 2023 21:37:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Ke1XkdbR63ELbkwycWMs75v9FCpdMicqTTX+PReZaa8paTCO7vgSHS95iKx9BWZUbYMwe X-Received: by 2002:a17:903:1249:b0:1ab:220a:9068 with SMTP id u9-20020a170903124900b001ab220a9068mr52129215plh.42.1684298235829; Tue, 16 May 2023 21:37:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684298235; cv=none; d=google.com; s=arc-20160816; b=UoXyul9q7TJBaUEkcBHfp9xv+zebbcOJ7W5thQGFuW0PlnBoZU8vS10Aa6uFpgIJWn BWnImKsiEAF7Dyau4K7BoR7mgp9Dim7PNnfrTPHa3z2L3s2AykPdyIhp7keRVqr49sHu YSXz5nMrpofK4cRxRxR9eEk2LNyT5UyIapgJYEPw4FcQ5ce2amUO8seeKNunsjEz9ve/ 11VznOm5f9qHmdg5PVX7pCLlPy1AelWHhRDtqBJmzjuoCEWjUU1e5r8DIPoCvWjgtQs9 EOD87ee/Mwo0UHXlxJfK7FV0R8hqEDqU7QZIrgA9d3jFkuEBSI2YyRtTExLrUbIdlK7W 565Q== 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=o+2qZ/joTxqaOCpK2Ed4GFnS/HFhx4DEGcrraXqmCaE=; b=CrVmvVqLew9KotHolLfP/WeFzt53GYI+rcQABXOeEsddHROUI1vY+IaylVsqk1kwWH uiMbdn9k3bLsHfU1uV5VNf+WXsEqSVge410S5yUuvYxK6mOtdKPbdQWl+i6QYhp+ayyl ssEjBjKZeR0N7ZoeiD2jweAQTs55x5cb1dz9vBUfK25SMpEJGzcIXcKrFTQjWJMcjR7B BpcpoBYX3AuX6K/vly5TvD/IkCsaVtK/kM+yVxE96muqBNbWD92liAKi25ernAArzoyo g3pL1rxoRbRX8LzMRqMHP0byrK8aB8EF+caSRfj4/LWjBjVFyU/ojB3JxR/ZNMv9OHkM F4nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=T9mk9Emd; 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 a18-20020a170902ecd200b001aadba392b7si19215889plh.517.2023.05.16.21.37.03; Tue, 16 May 2023 21:37:15 -0700 (PDT) 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=T9mk9Emd; 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 S232237AbjEQEgR (ORCPT + 99 others); Wed, 17 May 2023 00:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbjEQEfr (ORCPT ); Wed, 17 May 2023 00:35:47 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A374D3A9F; Tue, 16 May 2023 21:35:44 -0700 (PDT) X-UUID: 44644b66f46c11edb20a276fd37b9834-20230517 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=o+2qZ/joTxqaOCpK2Ed4GFnS/HFhx4DEGcrraXqmCaE=; b=T9mk9EmdvPWuV5IePHjcB471Gw7RqTU6ewqa/Td1GqTuobBhBYf5NghAnhp7kRDmIcOTh57RoORu/zEifo88LAbAnDB1+u9o//pvHsPiEk6AHhUzGUNtuztDY5s330UN3nExu3r/rEyKmkVnvB+P1RapZmqhTo1OQvXKttaAWKQ=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:c74a437b-08ff-4993-9310-8a0f1c22b75e,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.25,REQID:c74a437b-08ff-4993-9310-8a0f1c22b75e,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:d5b0ae3,CLOUDID:e05c116c-2f20-4998-991c-3b78627e4938,B ulkID:230517123538V9C252YK,BulkQuantity:0,Recheck:0,SF:29|28|17|19|48|38,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-CID-BAS: 0,_,0,_ X-UUID: 44644b66f46c11edb20a276fd37b9834-20230517 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1338038676; Wed, 17 May 2023 12:35:35 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) 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.1118.26; Wed, 17 May 2023 12:35:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 17 May 2023 12:35:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v12 10/11] remoteproc: mediatek: Refine ipi handler error message Date: Wed, 17 May 2023 12:34:48 +0800 Message-ID: <20230517043449.26352-11-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230517043449.26352-1-tinghan.shen@mediatek.com> References: <20230517043449.26352-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,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED 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?1766114706661136790?= X-GMAIL-MSGID: =?utf-8?q?1766114706661136790?= 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 6319ba21bcad..706190d2db75 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -114,7 +114,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 May 17 04:34: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: 95044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp872962vqo; Tue, 16 May 2023 21:36:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4XQjCt681VuZR4P2p1dqvT3yG8V2fEecHgSYiHKVpvEzrxllHanR0L9+Mt0zhIt7B4gJr5 X-Received: by 2002:a17:902:e88e:b0:1ac:451d:34b with SMTP id w14-20020a170902e88e00b001ac451d034bmr52515609plg.9.1684298209599; Tue, 16 May 2023 21:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684298209; cv=none; d=google.com; s=arc-20160816; b=qYr7UXCsDzMwU7bts8SkRRVA7B046iy+rSrfJzIqK2PYj5fSpOrcf/t41iqiwudIFp yx4ASePAMJi2Y5E+MzZavlRqJ/VPLDMSngf7tu5qboF7z4QUCb+zRg6ygo5W4yDxM7xr /C8eGQ1afziw4iaZuQ6pqynGdEpBDzCfwCv+VUwHgP4XArn+hnLn+LHovvN7TSS8VtgV V+BfN0AxsjgSNcL5EnTJZuzgSmMegNOr7UzQvzNSbOHlLqvNw1bvx2dGemTV3Sj+qemb wsAURMbL5ikoZUqkWMFHuZgLA+PnjJ5RMUDs9fEqacKAJxo5qQ8oRNDvrWbH1G6CrE40 0ZjA== 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=zITZHaBffEXHgQvakViptRVDM6YtdJ7FNpbDESp+DO4=; b=sYsyghrmmMZSKJnYfPv526cU4cXYFmcoA3pPv73MKj06tMtAXHcoqDl5yzIlgD3Eax JE2m56KppjE3GgeJgtz8oHITV+nmma4BEegLL0fII4jKnkT5g6yLNDtcJqXAauPCP7Uc dTDT+kY1ioxW4VTMpDZ7omBKj4qVUB5XEkKXymyyxmLZ9Ed+2oiruGMJnlaB4G43OFzy 2nxthLd+iwXsBsUcAO0cYgv3sJJpdx+lISjG9ltmHiUZxdaE97mAERyW1Qoy2yZrSkmr tpQz6pqVSRHSYU8ousR1PbJfY+QDY+OMB2aC+4lMDi76TcnaMgh1QyrpmbqdcgxC2F0P XxOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=rg5FCpR+; 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 m9-20020a170902db0900b001ac68acb1e8si21820664plx.518.2023.05.16.21.36.37; Tue, 16 May 2023 21:36:49 -0700 (PDT) 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=rg5FCpR+; 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 S230127AbjEQEfr (ORCPT + 99 others); Wed, 17 May 2023 00:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231667AbjEQEfp (ORCPT ); Wed, 17 May 2023 00:35:45 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36EFA2D4F; Tue, 16 May 2023 21:35:39 -0700 (PDT) X-UUID: 447dd3d8f46c11ed9cb5633481061a41-20230517 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=zITZHaBffEXHgQvakViptRVDM6YtdJ7FNpbDESp+DO4=; b=rg5FCpR+2adm0lUwGcCji/DWBrJq4vux/x9QDZrGjWMi1LOieoNTeD+YkCjNY0CLn+P8zhmqc6Q7ZYYvxzVQBFqvUw1WSR3pLpHn3e8zwe3FNRLV75PBbK6aMIKV2oLBYv69L6E4KCrEcPNbyFMWDAKFL1iVketgxWtKxJ5FG3I=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:c778c494-0df7-4303-b7d4-3b608b102572,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.25,REQID:c778c494-0df7-4303-b7d4-3b608b102572,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:d5b0ae3,CLOUDID:a95c116c-2f20-4998-991c-3b78627e4938,B ulkID:230517123536FFYEAOTT,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-CID-BAS: 0,_,0,_ X-UUID: 447dd3d8f46c11ed9cb5633481061a41-20230517 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1071586012; Wed, 17 May 2023 12:35:36 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) 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.1118.26; Wed, 17 May 2023 12:35:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 17 May 2023 12:35:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v12 11/11] arm64: dts: mediatek: mt8195: Add SCP 2nd core Date: Wed, 17 May 2023 12:34:49 +0800 Message-ID: <20230517043449.26352-12-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230517043449.26352-1-tinghan.shen@mediatek.com> References: <20230517043449.26352-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, T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR,UNPARSEABLE_RELAY,URIBL_BLOCKED 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?1766114679246788960?= X-GMAIL-MSGID: =?utf-8?q?1766114679246788960?= 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 8ac80a136c37..8addb94a24a1 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi @@ -962,7 +962,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 a44aae4ab953..10947b4b4707 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi @@ -916,14 +916,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 { @@ -2464,7 +2480,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>;