From patchwork Fri Mar 3 08:33: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: 63797 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp294322wrd; Fri, 3 Mar 2023 00:37:56 -0800 (PST) X-Google-Smtp-Source: AK7set/4R3/i+jRYh9s4Nr2oPwpIrLIbFgqlRoyHUEvYBBYer1KjqgN6uZAxYg3WFVJ0c2D8BsMY X-Received: by 2002:a17:907:7205:b0:8b2:fa6d:45d5 with SMTP id dr5-20020a170907720500b008b2fa6d45d5mr1063726ejc.71.1677832676576; Fri, 03 Mar 2023 00:37:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677832676; cv=none; d=google.com; s=arc-20160816; b=Li5juMXntbzR5QTUZQz2EEYAM6uy94S7j92TOBY0lOJXbMKeUbPqyJnec762jMJMlp t9ea/rDwYf1xSjUsgTnVTDjMEiSppnSfsbkam3KKN+YLrxLs4n7NGWkrURqKAbYhIipM utREb/c53OE7Ex0OlNHOfWe3zJTg5SgEXaBvBnypOhdw6X6GnOX6+4hV8PD37UmnG28I 4CmFV8IrpGLtyOliXAnp4LUh9GqSnQWT6JxwBBSfJtb7XqsWtR8zOtc/vRQYASXp9ODo n9Vh70Kjwc4DVIzj0m6VC7mVGS2A37j+VFxs7aIWC7ytIJgeM9eSR9JMaPoPtaOa8koM bYRw== 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=rPT6l9i8wVv66njCsZ+5BRTAJ+ms3YzcjULeZKV975FhboOuHvp6oX0JMimIO3sUcB FQmvtjMTQySRsiKkKgLZUK4RlHL7ybcgMlGayDbNdUrvQ8ei/Xb1fWsPgIQIRMhA9p5c VC6hbHw5oUeBjBt/bUThfLCw7KA29dhjHsiMLNh8aG/KmKxNN2oQjchTIHNdJZ+dENnN dNxya5fsmt7jPpMxqqhku0sfWb9zvTHna0BJwknWpetoQysavKwaNkRvoPUbTIwxNdOU GkMFrXiJiOTY9AocdxuoeI7ujnopEqVJE5a449CLAuqvubT8+6DfLuPpqni8yKodPN0y ofYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=DId9CxbA; 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 a8-20020a1709063a4800b008b17b56c4d1si1671293ejf.1000.2023.03.03.00.37.34; Fri, 03 Mar 2023 00:37:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=DId9CxbA; 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 S230450AbjCCIe5 (ORCPT + 99 others); Fri, 3 Mar 2023 03:34:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230164AbjCCIeP (ORCPT ); Fri, 3 Mar 2023 03:34:15 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ACBE1027F; Fri, 3 Mar 2023 00:34:08 -0800 (PST) X-UUID: 25d54f6eb99e11eda06fc9ecc4dadd91-20230303 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=DId9CxbA9rDeeT6tLapBCan4FlfLVhYGvtTDs8THIFukH6npymH8sF884q4rcyNH9+42m8+EJ3HfqMgM8z2144KEQOFy+6Swf3D+lH+0Lw9ax7r/C/7zLWzkJSq1W+zF4ys9PErL2DzbS+X0oIHYAyjYlSzrllx0jMbR+qn2V/Q=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:4654a243-8d85-469b-abc8-c8385950a517,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:25b5999,CLOUDID:207ca9f4-ddba-41c3-91d9-10eeade8eac7,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-UUID: 25d54f6eb99e11eda06fc9ecc4dadd91-20230303 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1139701333; Fri, 03 Mar 2023 16:34:00 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Fri, 3 Mar 2023 16:33:59 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Fri, 3 Mar 2023 16:33:59 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v8 01/11] dt-bindings: remoteproc: mediatek: Improve the rpmsg subnode definition Date: Fri, 3 Mar 2023 16:33:45 +0800 Message-ID: <20230303083355.3378-2-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230303083355.3378-1-tinghan.shen@mediatek.com> References: <20230303083355.3378-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_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759335076880007597?= X-GMAIL-MSGID: =?utf-8?q?1759335076880007597?= 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 Fri Mar 3 08:33: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: 63796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp294129wrd; Fri, 3 Mar 2023 00:37:07 -0800 (PST) X-Google-Smtp-Source: AK7set/Y7cdJW4pcISIFL1Hp7lopyGAJ7ohAbSwJkfhDB2hOp7lgxdSeE6gW2A8pseYcuUNHOWHV X-Received: by 2002:a17:906:4787:b0:872:84dd:8903 with SMTP id cw7-20020a170906478700b0087284dd8903mr1219628ejc.59.1677832627587; Fri, 03 Mar 2023 00:37:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677832627; cv=none; d=google.com; s=arc-20160816; b=DSx1Xuba+BWUDxSXrLMSmewaXlNb669Px4QwHGxuG7stVNg7dsK7RnHpHs9E4xZv/f kITdcyw1MwtL6MtJXeVIVI2kww8pAQoFmmIO+liiJ08vxkCMPPMUIjoVmsvsPNtLauaw G+RMg6bCpAkP47sydsL08Rb/JmAgK8PnA9j8klV35jQ1u5f5XFZJAJclDT9l6SEpIEDq jFMfzogifWtlvMExuF/ic5kDpP045WLeKbPCp8nfzebVvlPWNtsWZ21EpkH7zwhUV/XJ bHJf67tFwk4Jir+kj82GWbjPE3KRQ074nbKhNvNAz5SSXgFv7yqnkqWn+ROlPCXrotMr yh+w== 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=0ATWdT8JEgK9WVD3GAytYZzwX478NdefTVtzSQUmDTg=; b=plsLtyL/7x0CZ3tXmSfpGvYX5rT8S9FzmuPlfhFheUloM7jWIm3xkuc61dU4YGTXda l6jyO5gxQxwe6IujXdjIJ1YrCpodbqmLUsbypkYYp9gsBrR1N1DoYL17jk0pVGNuQ2/S rtmU75AsN4R+Qb6e/kALuvTOVbUGXsZ6zakoZg8SpROVv8kXNQunP2SkMSgy1j0/vAfd nb9slmfSS97yjJf0upg6MiSFFTqphE5KPtC/TeDPGSUtcx9TQdnzxrNrqlGm3cfzybH/ kDTE5zM+8NOeP5ndpQV4luTlVaVbseOLJ9qI+vJQ2y0EZ19pRTgVxbIEfvkGWjSUgjRw Mjqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ZdcSWyQ5; 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 t22-20020a1709064f1600b008e259a32ab3si1695751eju.934.2023.03.03.00.36.45; Fri, 03 Mar 2023 00:37:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ZdcSWyQ5; 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 S230228AbjCCIe1 (ORCPT + 99 others); Fri, 3 Mar 2023 03:34:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230161AbjCCIeP (ORCPT ); Fri, 3 Mar 2023 03:34:15 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F422612053; Fri, 3 Mar 2023 00:34:07 -0800 (PST) X-UUID: 25e613d0b99e11ed945fc101203acc17-20230303 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=0ATWdT8JEgK9WVD3GAytYZzwX478NdefTVtzSQUmDTg=; b=ZdcSWyQ5xUBCxmeNSVqsCu6lVM2Ftn/ZrbqJWpsfsLGWe4938QEDodZi9yDipDsM7s4tVmuCzjGR/NubrdPdsXHFGoXjJDtcGY70S2aQ2cjNrU1Md0ScoRQGWlOtt2Ag0bnxOMiT8qixB7YQkoWn/ltMKKJafY/AjhaoL4Ot3xo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:ea75965d-f37a-4c3b-a9c9-fcfabf11b8f1,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.20,REQID:ea75965d-f37a-4c3b-a9c9-fcfabf11b8f1,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:25b5999,CLOUDID:e47ba9f4-ddba-41c3-91d9-10eeade8eac7,B ulkID:230303163402JKXIHIJ5,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,NGT X-UUID: 25e613d0b99e11ed945fc101203acc17-20230303 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1289242358; Fri, 03 Mar 2023 16:34:01 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.25; Fri, 3 Mar 2023 16:33:59 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Fri, 3 Mar 2023 16:33:59 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v8 02/11] arm64: dts: mediatek: Update the node name of SCP rpmsg subnode Date: Fri, 3 Mar 2023 16:33:46 +0800 Message-ID: <20230303083355.3378-3-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230303083355.3378-1-tinghan.shen@mediatek.com> References: <20230303083355.3378-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_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759335024918184146?= X-GMAIL-MSGID: =?utf-8?q?1759335024918184146?= Align the node name with the definition in SCP bindings. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 2 +- 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 fbe14b13051a..a259eb043de5 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi @@ -810,7 +810,7 @@ pinctrl-names = "default"; pinctrl-0 = <&scp_pins>; - cros_ec { + cros-ec-rpmsg { compatible = "google,cros-ec-rpmsg"; mediatek,rpmsg-name = "cros-ec-rpmsg"; }; diff --git a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi index 9f12257ab4e7..8f14b633c1e1 100644 --- a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi @@ -1260,7 +1260,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 Fri Mar 3 08:33: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: 63791 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp293757wrd; Fri, 3 Mar 2023 00:35:56 -0800 (PST) X-Google-Smtp-Source: AK7set/lR04cEuFJrAbpa+xiXYHeoYQtKKm1wrdgH5bAJUlnqo9N6m4xMvM7djEETxPUHYccQJeE X-Received: by 2002:a17:907:7283:b0:888:456a:cb76 with SMTP id dt3-20020a170907728300b00888456acb76mr1180781ejc.70.1677832556563; Fri, 03 Mar 2023 00:35:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677832556; cv=none; d=google.com; s=arc-20160816; b=QhcEDIY8H3NnsxD6ek1cKyFCHe3De4uHEx4X5l6zQ1N4BzQSVV0HMDU+uGFB4zi+Ub q5WmugnRrPc+b9joKyEbsA4J36fwMyuD7t21d5ItA0OExio0WHXxTQT8A69w8ue+wd0+ lj3sRP+OSI4HBOVrOmvuyYpOpPuJ264t36I1XubfToTqCaQlqSFLP8WiR4U9qzjYNufa ekYoRk3JXxSZ9v3ZuqPBU5MS7cShWLowKrf9B+HudtSpGN6C1fpS72qv2GctE4vJGfMd dngPDXimDnjML7J4xfRwe2KH9hW5kEbznpwz2rlMNYCERB4055SFfY/53wXqVYKQbRk8 nwEQ== 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=cniPAkvaWO6GOjvXSQJmNZHDPFyLNvUGzQp2v/ELKBEWpDk3Ntx8uNAW5hUHo3my4V IRPTjzhB31npnrflUZhLML6M6fQQQYDk+7JA170PVmhBpYZWCKLgvv1SraMwSoSuWyyV Vll6G/q+XVHSDqNb4nQnhivMmjSFO8Rexa0RMAeiRDp8+N5ZcRok1OOjhTIovVU5olRM MigQ8kRw0MYt5gnFNuH3KRPZK+FiKHFXlmgy2bfZLquEl0sflChxcvTsWuXbzpv1Mbhp 60u/Xg2a+a0VYJ1zj6G0aFks53Z8g42q5a6S0whgdwrRH6Bo0CMbSggVRlM/9eOKbLAY RUrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=CfMXdGGW; 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 kf13-20020a17090776cd00b008d672111f11si1904623ejc.479.2023.03.03.00.35.34; Fri, 03 Mar 2023 00:35:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=CfMXdGGW; 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 S230330AbjCCIet (ORCPT + 99 others); Fri, 3 Mar 2023 03:34:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbjCCIeT (ORCPT ); Fri, 3 Mar 2023 03:34:19 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E7C6113E8; Fri, 3 Mar 2023 00:34:09 -0800 (PST) X-UUID: 2632240ab99e11ed945fc101203acc17-20230303 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=CfMXdGGWkT40CqShQVt32alw7ClvAas1n3MoqpiBb8g6+tmkViu5Ji/1fPvkEj061U9mxsUiuZ/gQmnchQzBgst0CwZtuUltzB1UmPcugfGoAIRj6zKys6ebX2MK23NYNnYT1tFy7OA8hWAdVgi3nIzK0GhLRfl+bQDYTetwYD4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:c863f579-3117-4319-8d93-9334a5fedcaa,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:25b5999,CLOUDID:79333b27-564d-42d9-9875-7c868ee415ec,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 2632240ab99e11ed945fc101203acc17-20230303 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1347167827; Fri, 03 Mar 2023 16:34:01 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) 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.25; Fri, 3 Mar 2023 16:33:59 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Fri, 3 Mar 2023 16:33:59 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v8 03/11] dt-bindings: remoteproc: mediatek: Support MT8195 dual-core SCP Date: Fri, 3 Mar 2023 16:33:47 +0800 Message-ID: <20230303083355.3378-4-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230303083355.3378-1-tinghan.shen@mediatek.com> References: <20230303083355.3378-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759334951224472697?= X-GMAIL-MSGID: =?utf-8?q?1759334951224472697?= Extend the SCP binding to describe the MT8195 dual-core SCP. Under different applications, the MT8195 SCP can be used as single-core or dual-core. This change keeps the single-core definitions and adds new definitions for the dual-core use case. Signed-off-by: Tinghan Shen Reviewed-by: Rob Herring Reviewed-by: AngeloGioacchino Del Regno --- .../bindings/remoteproc/mtk,scp.yaml | 145 +++++++++++++++++- 1 file changed, 141 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml index 271081df0e46..09102dda4942 100644 --- a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +++ b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml @@ -21,6 +21,7 @@ properties: - mediatek,mt8188-scp - mediatek,mt8192-scp - mediatek,mt8195-scp + - mediatek,mt8195-scp-dual reg: description: @@ -31,10 +32,7 @@ properties: reg-names: minItems: 2 - items: - - const: sram - - const: cfg - - const: l1tcm + maxItems: 3 clocks: description: @@ -70,6 +68,81 @@ properties: unevaluatedProperties: false + '#address-cells': + const: 1 + + '#size-cells': + const: 1 + + ranges: + description: + Standard ranges definition providing address translations for + local SCP SRAM address spaces to bus addresses. + +patternProperties: + "^scp@[a-f0-9]+$": + type: object + description: + The MediaTek SCP integrated to SoC might be a multi-core version. + The other cores are represented as child nodes of the boot core. + There are some integration differences for the IP like the usage of + address translator for translating SoC bus addresses into address space + for the processor. + + Each SCP core has own cache memory. The SRAM and L1TCM are shared by + cores. The power of cache, SRAM and L1TCM power should be enabled + before booting SCP cores. The size of cache, SRAM, and L1TCM are varied + on differnt SoCs. + + The SCP cores do not use an MMU, but has a set of registers to + control the translations between 32-bit CPU addresses into system bus + addresses. Cache and memory access settings are provided through a + Memory Protection Unit (MPU), programmable only from the SCP. + + properties: + compatible: + enum: + - mediatek,scp-core + + reg: + description: The base address and size of SRAM. + maxItems: 1 + + reg-names: + const: sram + + interrupts: + maxItems: 1 + + firmware-name: + $ref: /schemas/types.yaml#/definitions/string + description: + If present, name (or relative path) of the file within the + firmware search path containing the firmware image used when + initializing sub cores of multi-core SCP. + + memory-region: + maxItems: 1 + + cros-ec-rpmsg: + $ref: /schemas/mfd/google,cros-ec.yaml + description: + This subnode represents the rpmsg device. The properties + of this node are defined by the individual bindings for + the rpmsg devices. + + required: + - mediatek,rpmsg-name + + unevaluatedProperties: false + + required: + - compatible + - reg + - reg-names + + additionalProperties: false + required: - compatible - reg @@ -99,7 +172,37 @@ allOf: reg: maxItems: 2 reg-names: + items: + - const: sram + - const: cfg + - if: + properties: + compatible: + enum: + - mediatek,mt8192-scp + - mediatek,mt8195-scp + then: + properties: + reg: + maxItems: 3 + reg-names: + items: + - const: sram + - const: cfg + - const: l1tcm + - if: + properties: + compatible: + enum: + - mediatek,mt8195-scp-dual + then: + properties: + reg: maxItems: 2 + reg-names: + items: + - const: cfg + - const: l1tcm additionalProperties: false @@ -121,3 +224,37 @@ examples: mediatek,rpmsg-name = "cros-ec-rpmsg"; }; }; + + - | + scp@10500000 { + compatible = "mediatek,mt8195-scp-dual"; + reg = <0x10720000 0xe0000>, + <0x10700000 0x8000>; + reg-names = "cfg", "l1tcm"; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x10500000 0x100000>; + + scp@0 { + compatible = "mediatek,scp-core"; + reg = <0x0 0xa0000>; + reg-names = "sram"; + + cros-ec-rpmsg { + compatible = "google,cros-ec-rpmsg"; + mediatek,rpmsg-name = "cros-ec-rpmsg"; + }; + }; + + scp@a0000 { + compatible = "mediatek,scp-core"; + reg = <0xa0000 0x20000>; + reg-names = "sram"; + + cros-ec-rpmsg { + compatible = "google,cros-ec-rpmsg"; + mediatek,rpmsg-name = "cros-ec-rpmsg"; + }; + }; + }; From patchwork Fri Mar 3 08:33: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: 63789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp293706wrd; Fri, 3 Mar 2023 00:35:46 -0800 (PST) X-Google-Smtp-Source: AK7set+sxinhW0x91w3LPUmWcslO2aWUj7i8fBPrrjTY3jyzfipUdeS+KcRbaUlLo4Gi57GFlFyD X-Received: by 2002:a05:6402:1291:b0:4ac:b32e:b65 with SMTP id w17-20020a056402129100b004acb32e0b65mr1088136edv.3.1677832546048; Fri, 03 Mar 2023 00:35:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677832546; cv=none; d=google.com; s=arc-20160816; b=DRWXc3f/jicFikKyA5Sh2HyH/C778JIGANF84Z7pNKIqwF0PvEuYvJzW/sAPJY1UAW bVpnpeilxDrEVNZNSIBDALb04qxXMucGm7l4eZLizIsq6V8S9CQ42X1424/kpbTBLQKd iMP1+ec8Qi/qcNeSW+5Nw9SxVRWszykOfzY1doCiDU25MQwrp+2ZlDPKOBKe47SIVWML baR649KXh5ja0TR5C3yItVFavAS4LyYE29dUojfRuizGW5as0mP8+fO0yW8ImHidxv19 J3Hg4AXh8OYqJYKRc4jnlp6ZLwBX2ZAh1lI2Y2HvWe1LAITop6lSkrQVcqhx48L+a+2u 3EEg== 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=cMNTIJZmGwYCT3gi3BFOionOLTyJOICMUovIktXwWP4=; b=Qu3owvJtCXaV3eOmkPQUQGGLjSYAJErcQ4FPTVEKQuPKYMfoOBgJSDEe5pzf1N4fpm XkD/MoyyvPUpNB9y4TIhIlEKHLM+1OrxPITzE0shvNE829SBnLYt+LNCPZByzqQWd3Z1 p+tRDGOYvdC8xx8IfqpD52y2XVdRuP7oLe3O++NNWvNcrbSiYTHTrYcnzYoAJxkmKulZ 8bxBu2lJlrjelE+DpsBHtgYwJQgzT4MRR0Pi5wK2XUQfpW+pWorTcp9pZcqik/910ZpN nY4Slwn4bUe5rHPlWjB229zPOUYSBsx7G7F46zgTNyecVeV1Gd04ReR7ATdAHB1f680D bE+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=H9nPsOkU; 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 r3-20020aa7cfc3000000b004bf2b13c5acsi534114edy.607.2023.03.03.00.35.23; Fri, 03 Mar 2023 00:35:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=H9nPsOkU; 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 S230274AbjCCIej (ORCPT + 99 others); Fri, 3 Mar 2023 03:34:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230167AbjCCIeT (ORCPT ); Fri, 3 Mar 2023 03:34:19 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E16E149BE; Fri, 3 Mar 2023 00:34:09 -0800 (PST) X-UUID: 25d77a6eb99e11eda06fc9ecc4dadd91-20230303 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=cMNTIJZmGwYCT3gi3BFOionOLTyJOICMUovIktXwWP4=; b=H9nPsOkUXY2tM/JLg7QdLVZRJPKZ9vOXN6cJE1kMt3xxDMdPU0z4xSUSfFpXGi7f9RQQ2YcmCW/WW1gmkjZHugzK1IFxPWJXe9RwAI8UKhNU3TbvuuHUJ+daimlQvHB1Xp/HI8wqpyxTA/kaDRkU75NcEC1+o6g28QVPAstr+FE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:5a627758-102b-45c7-b976-76cf7b67040c,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:25b5999,CLOUDID:237ca9f4-ddba-41c3-91d9-10eeade8eac7,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 25d77a6eb99e11eda06fc9ecc4dadd91-20230303 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 930686860; Fri, 03 Mar 2023 16:34:00 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Fri, 3 Mar 2023 16:34:00 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Fri, 3 Mar 2023 16:33:59 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v8 04/11] remoteproc: mediatek: Add MT8195 SCP core 1 operations Date: Fri, 3 Mar 2023 16:33:48 +0800 Message-ID: <20230303083355.3378-5-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230303083355.3378-1-tinghan.shen@mediatek.com> References: <20230303083355.3378-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759334939820153805?= X-GMAIL-MSGID: =?utf-8?q?1759334939820153805?= The SCP rproc driver has a set of chip dependent callbacks for boot sequence and IRQ handling. Implement these callbacks for MT8195 SCP core 1. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_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 0861b76f185f..a3b9bc158cd9 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -176,6 +176,16 @@ static void mt8192_scp_reset_deassert(struct mtk_scp *scp) writel(1, scp->reg_base + MT8192_CORE0_SW_RSTN_CLR); } +static void mt8195_scp_c1_reset_assert(struct mtk_scp *scp) +{ + writel(1, scp->reg_base + MT8195_CORE1_SW_RSTN_SET); +} + +static void mt8195_scp_c1_reset_deassert(struct mtk_scp *scp) +{ + writel(1, scp->reg_base + MT8195_CORE1_SW_RSTN_CLR); +} + static void mt8183_scp_irq_handler(struct mtk_scp *scp) { u32 scp_to_host; @@ -212,6 +222,18 @@ static void mt8192_scp_irq_handler(struct mtk_scp *scp) } } +static void mt8195_scp_c1_irq_handler(struct mtk_scp *scp) +{ + u32 scp_to_host; + + scp_to_host = readl(scp->reg_base + MT8195_SSHUB2APMCU_IPC_SET); + + if (scp_to_host & MT8192_SCP_IPC_INT_BIT) + scp_ipi_handler(scp); + + writel(scp_to_host, scp->reg_base + MT8195_SSHUB2APMCU_IPC_CLR); +} + static irqreturn_t scp_irq_handler(int irq, void *priv) { struct mtk_scp *scp = priv; @@ -453,6 +475,19 @@ static int mt8195_scp_before_load(struct mtk_scp *scp) return 0; } +static int mt8195_scp_c1_before_load(struct mtk_scp *scp) +{ + scp_sram_power_on(scp->reg_base + MT8195_CPU1_SRAM_PD, 0); + + /* hold SCP in reset while loading FW. */ + scp->data->scp_reset_assert(scp); + + /* enable MPU for all memory regions */ + writel(0xff, scp->reg_base + MT8195_CORE1_MEM_ATT_PREDEF); + + return 0; +} + static int scp_load(struct rproc *rproc, const struct firmware *fw) { struct mtk_scp *scp = rproc->priv; @@ -625,6 +660,15 @@ static void mt8195_scp_stop(struct mtk_scp *scp) writel(0, scp->reg_base + MT8192_CORE0_WDT_CFG); } +static void mt8195_scp_c1_stop(struct mtk_scp *scp) +{ + /* Power off CPU SRAM */ + scp_sram_power_off(scp->reg_base + MT8195_CPU1_SRAM_PD, 0); + + /* Disable SCP watchdog */ + writel(0, scp->reg_base + MT8195_CORE1_WDT_CFG); +} + static int scp_stop(struct rproc *rproc) { struct mtk_scp *scp = (struct mtk_scp *)rproc->priv; @@ -991,6 +1035,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 Fri Mar 3 08:33: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: 63792 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp293798wrd; Fri, 3 Mar 2023 00:36:05 -0800 (PST) X-Google-Smtp-Source: AK7set9U+Go6J6eO6ELT99nhdOqbCw9LEKJI70vCHEEsEtz/vSiNEb3Z4Vg3EnhBCQVtfqlg4V5X X-Received: by 2002:a17:906:da89:b0:8b1:7de6:e292 with SMTP id xh9-20020a170906da8900b008b17de6e292mr1088272ejb.9.1677832565266; Fri, 03 Mar 2023 00:36:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677832565; cv=none; d=google.com; s=arc-20160816; b=dWN7D6jPcYwCavcrXfJErO01koDSktnaUZcVqZwF8IwDh0MEEfFYhxIvmP++qIg3hi Ok65t/qB7TcwDYuMkhKmjBuuPo2MQ9w2YH4AW2lZgVqYzxCfxcA5p9pU8WFvHuEZ3gQy 1EdFwWIN0mAir20dpUKARD+2XB1dMPP2B+B9oOST0+8rMHiyEv3PVxbxA6FLsmNGUhmB Xnm/GqD43KL+F+nsu3BSIUgaUXdo3y97zFjoxZSGHMUTYLvK9ScOfZBuCXn14104AJFR 0cfAIdhbDsXXo1gJxf6IT7WMFBxfGIdTu3/n44+vEbEFronAC9n6aTfSSy1Eoxvqb3BX UjUQ== 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=J8arLHroTMYol8FfQEYCN4n7Ah1OENBm0QQvQbOCylo=; b=Z1fVq3jrv9EesoRT5dGamfyNbV3zsswNvNHfm8YTuITDnhl5bg/oPi5VAn4J1jgok1 RHZT7tU3r+BE5iynqngfZASeZMtbRfreuBEENC6La7tgUcpeb8GkCz3+x/LCjPSSKZ0l HJGNnTbZ0dMAk7zzGDdocHn9WGRrPb3KoWJkNn31T264k3sb3ggkZea6qYl+PgYs2daX 20xlEoGEHac4xraUlW1FyuftdjuqDdeBIC08Gm5muyGsj2FmA40yKwSwDeIFtNJpv0MM VcFr8UHF14C3JFTL9Ml8kSbauvPWsu0EzAZyKa7DiQ2kFHY+oYq4WfijePqoe0IvLazz prPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=L+fA76ma; 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 d16-20020a1709064c5000b008c53888c61bsi1663957ejw.493.2023.03.03.00.35.42; Fri, 03 Mar 2023 00:36:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=L+fA76ma; 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 S230419AbjCCIez (ORCPT + 99 others); Fri, 3 Mar 2023 03:34:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230169AbjCCIeT (ORCPT ); Fri, 3 Mar 2023 03:34:19 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 801D610433; Fri, 3 Mar 2023 00:34:10 -0800 (PST) X-UUID: 25cc883eb99e11eda06fc9ecc4dadd91-20230303 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=J8arLHroTMYol8FfQEYCN4n7Ah1OENBm0QQvQbOCylo=; b=L+fA76marF9ld1eY9yNjDDNSM6JtehZXRuCofbCegAP6RzJDlMqX2wVLPp4eMg/kQQJm6kZGCtYBggGioVnkBnFO5sNYN4m6I/gZm8rqYw+0YMZmJ+FhkkBg0ycR+yDwvhECBw8sTOHXXWpJzFXHNDV6fThlUd0pQ4rLhd6TrhI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:063b59de-ed2d-426e-be6f-d2774b178e42,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:25b5999,CLOUDID:a2c71bb2-beed-4dfc-bd9c-e1b22fa6ccc4,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 25cc883eb99e11eda06fc9ecc4dadd91-20230303 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 663826563; Fri, 03 Mar 2023 16:34:00 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) 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.25; Fri, 3 Mar 2023 16:34:00 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Fri, 3 Mar 2023 16:34:00 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v8 05/11] remoteproc: mediatek: Extract remoteproc initialization flow Date: Fri, 3 Mar 2023 16:33:49 +0800 Message-ID: <20230303083355.3378-6-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230303083355.3378-1-tinghan.shen@mediatek.com> References: <20230303083355.3378-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759334960335189612?= X-GMAIL-MSGID: =?utf-8?q?1759334960335189612?= This is the preparation for probing multi-core SCP. The remoteproc initialization flow is similar on cores and is reuesd to avoid redundant code. The registers of config and l1tcm are shared for multi-core SCP. Reuse the mapped addresses for all cores. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_scp.c | 62 ++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index a3b9bc158cd9..bdb5d87eeaa3 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -23,6 +23,13 @@ #define MAX_CODE_SIZE 0x500000 #define SECTION_NAME_IPI_BUFFER ".ipi_buffer" +struct mtk_scp_of_regs { + void __iomem *reg_base; + void __iomem *l1tcm_base; + size_t l1tcm_size; + phys_addr_t l1tcm_phys; +}; + /** * scp_get() - get a reference to SCP. * @@ -855,7 +862,8 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) } } -static int scp_probe(struct platform_device *pdev) +static int scp_rproc_init(struct platform_device *pdev, + struct mtk_scp_of_regs *of_regs) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; @@ -879,6 +887,11 @@ static int scp_probe(struct platform_device *pdev) scp->data = of_device_get_match_data(dev); platform_set_drvdata(pdev, scp); + scp->reg_base = of_regs->reg_base; + scp->l1tcm_base = of_regs->l1tcm_base; + scp->l1tcm_size = of_regs->l1tcm_size; + scp->l1tcm_phys = of_regs->l1tcm_phys; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram"); scp->sram_base = devm_ioremap_resource(dev, res); if (IS_ERR(scp->sram_base)) @@ -888,24 +901,6 @@ static int scp_probe(struct platform_device *pdev) scp->sram_size = resource_size(res); scp->sram_phys = res->start; - /* l1tcm is an optional memory region */ - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm"); - scp->l1tcm_base = devm_ioremap_resource(dev, res); - if (IS_ERR(scp->l1tcm_base)) { - ret = PTR_ERR(scp->l1tcm_base); - if (ret != -EINVAL) { - return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n"); - } - } else { - scp->l1tcm_size = resource_size(res); - scp->l1tcm_phys = res->start; - } - - scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg"); - if (IS_ERR(scp->reg_base)) - return dev_err_probe(dev, PTR_ERR(scp->reg_base), - "Failed to parse and map cfg memory\n"); - ret = scp->data->scp_clk_get(scp); if (ret) return ret; @@ -933,7 +928,6 @@ static int scp_probe(struct platform_device *pdev) ret = devm_request_threaded_irq(dev, platform_get_irq(pdev, 0), NULL, scp_irq_handler, IRQF_ONESHOT, pdev->name, scp); - if (ret) { dev_err(dev, "failed to request irq\n"); goto remove_subdev; @@ -957,6 +951,34 @@ static int scp_probe(struct platform_device *pdev) return ret; } +static int scp_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct resource *res; + struct mtk_scp_of_regs scp_regs; + int ret; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg"); + scp_regs.reg_base = devm_ioremap_resource(dev, res); + if (IS_ERR(scp_regs.reg_base)) + return dev_err_probe(dev, PTR_ERR(scp_regs.reg_base), + "Failed to parse and map cfg memory\n"); + + /* l1tcm is an optional memory region */ + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm"); + scp_regs.l1tcm_base = devm_ioremap_resource(dev, res); + if (IS_ERR(scp_regs.l1tcm_base)) { + ret = PTR_ERR(scp_regs.l1tcm_base); + if (ret != -EINVAL) + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n"); + } else { + scp_regs.l1tcm_size = resource_size(res); + scp_regs.l1tcm_phys = res->start; + } + + return scp_rproc_init(pdev, &scp_regs); +} + static int scp_remove(struct platform_device *pdev) { struct mtk_scp *scp = platform_get_drvdata(pdev); From patchwork Fri Mar 3 08:33:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 63793 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp293880wrd; Fri, 3 Mar 2023 00:36:21 -0800 (PST) X-Google-Smtp-Source: AK7set+E20yE32Q4jIdnpDsVGqqwMEHIXaCmhkBuxTbkIIxxNOTW3Ead6U13aAFaJh4BUTiRWi2a X-Received: by 2002:a17:907:c0c:b0:8af:2cf7:dd2b with SMTP id ga12-20020a1709070c0c00b008af2cf7dd2bmr1219303ejc.13.1677832581514; Fri, 03 Mar 2023 00:36:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677832581; cv=none; d=google.com; s=arc-20160816; b=QDuuevgnd+4JTr0tRma6DXyeTJ1Askjq2fumTDwMPEY6pElN0M30HGOLgyKyioJEtA r0/LB+icgtlOKvtiUkCWfF3sWBeNuWr+4I9SdpWugyVq9wqCO5v+bfQ+4LW1bmpk6D7c fuj9dBwdp1hUAmk0aioJa10U+DpNaxFqnmvEsOFp6krjCfGQfnHAVNcUFI8fuBfu1VdC nUFWJ8bXtx+DqXoJ5H/cKCil/vXwIUKU4VFPsrDidI8TfhD4p0VhiIJ8L9Kyw/FScRzZ vP+Lx3yycDu7dz4m6GSnApf1o9Q5YCgkoADYsLTpepIdyHCcRx3QdNOPWSzyCIcnhNKS rVsQ== 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=31re0b2NuOrptWFb2fgrkzjsMyp7nTXw1wGT3Tqnnuw=; b=MSFZx4BPqdQrcOdkKVNYJ3vlX2nMOdCw4y5r2gKH9NbMdFN919IK4g5KI8L5FmIgfI SMee98+JCMGcKaUgdkpVr2wPAdr7Iehlzo8XU/eTbaJ+3NPmDvxPJfTsuzJIjPsaeMH0 z+1hn276BmM1ZltRCIK2b/GHRfC4ewk8p24tXRdX2g/qdZi2aaE0C2/TPUeTqC8h2fYS RT7vOGzKBaTvWSzjZpKksIFrATuNDlk57eEM1QsBCuBoBNnwrzZ4lp2/qxzGFmFBkOWf +yUKzdZCkBDZJVrY8nVn38hr8b53bsQPny3jLCQonZPEbhgguLlqQEg2RVajM978VHJ5 m0Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Ak0GkdUZ; 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 r9-20020a170906280900b008d2c91d5119si1682579ejc.308.2023.03.03.00.35.59; Fri, 03 Mar 2023 00:36:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Ak0GkdUZ; 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 S230387AbjCCIex (ORCPT + 99 others); Fri, 3 Mar 2023 03:34:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230188AbjCCIeU (ORCPT ); Fri, 3 Mar 2023 03:34:20 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D3061ABD1; Fri, 3 Mar 2023 00:34:13 -0800 (PST) X-UUID: 25d9b25cb99e11eda06fc9ecc4dadd91-20230303 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=31re0b2NuOrptWFb2fgrkzjsMyp7nTXw1wGT3Tqnnuw=; b=Ak0GkdUZp1cWJQq1b82mJ6M9DZkKFVj7u1cejP6mTfw3BsaxChgiZ7GG2d1Cj+VNdCRwhCJDpPvh7sUywgG1eVwKwWbQmxcD3UamuyTChYq3n/ljR8666qyTz3jlexEVDG12b9ld0XRzt23BJrbU+CTAa2tUnrkU2wAkif2YkZA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:82640377-31a5-44e7-a086-db428e717cbe,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:25b5999,CLOUDID:257ca9f4-ddba-41c3-91d9-10eeade8eac7,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 25d9b25cb99e11eda06fc9ecc4dadd91-20230303 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1185111835; Fri, 03 Mar 2023 16:34:00 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Fri, 3 Mar 2023 16:34:00 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Fri, 3 Mar 2023 16:34:00 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v8 06/11] remoteproc: mediatek: Probe multi-core SCP Date: Fri, 3 Mar 2023 16:33:50 +0800 Message-ID: <20230303083355.3378-7-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230303083355.3378-1-tinghan.shen@mediatek.com> References: <20230303083355.3378-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759334976863511802?= X-GMAIL-MSGID: =?utf-8?q?1759334976863511802?= The difference of single-core SCP and multi-core SCP device tree is the presence of child device nodes described SCP cores. The SCP driver populates the platform device and checks the child nodes to identify whether it's a single-core SCP or a multi-core SCP. The resource structure of the multi-core SCP is a list of remoteproc instances which is different to the single-core SCP. The corresponding resource releasing action is based on the type of SCP. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_common.h | 4 + drivers/remoteproc/mtk_scp.c | 177 +++++++++++++++++++++++++++++--- 2 files changed, 166 insertions(+), 15 deletions(-) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index c0905aec3b4b..c088149e3dcc 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -128,6 +128,10 @@ struct mtk_scp { size_t dram_size; struct rproc_subdev *rpmsg_subdev; + + struct list_head elem; + struct list_head cluster_cores; + struct list_head *cluster; }; /** diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index bdb5d87eeaa3..84103a70f426 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -863,7 +863,9 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) } static int scp_rproc_init(struct platform_device *pdev, - struct mtk_scp_of_regs *of_regs) + struct mtk_scp_of_regs *of_regs, + const struct mtk_scp_of_data *of_data, + bool is_multi_core) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; @@ -884,7 +886,7 @@ static int scp_rproc_init(struct platform_device *pdev, scp = (struct mtk_scp *)rproc->priv; scp->rproc = rproc; scp->dev = dev; - scp->data = of_device_get_match_data(dev); + scp->data = of_data; platform_set_drvdata(pdev, scp); scp->reg_base = of_regs->reg_base; @@ -933,9 +935,11 @@ static int scp_rproc_init(struct platform_device *pdev, goto remove_subdev; } - ret = rproc_add(rproc); - if (ret) - goto remove_subdev; + if (!is_multi_core) { + ret = rproc_add(rproc); + if (ret) + goto remove_subdev; + } return 0; @@ -951,9 +955,123 @@ static int scp_rproc_init(struct platform_device *pdev, return ret; } +static void scp_rproc_free(struct mtk_scp *scp) +{ + int i; + + scp_remove_rpmsg_subdev(scp); + scp_ipi_unregister(scp, SCP_IPI_INIT); + scp_unmap_memory_region(scp); + for (i = 0; i < SCP_IPI_MAX; i++) + mutex_destroy(&scp->ipi_desc[i].lock); + mutex_destroy(&scp->send_lock); +} + +static void scp_rproc_exit(struct platform_device *pdev) +{ + struct mtk_scp *scp = platform_get_drvdata(pdev); + + rproc_del(scp->rproc); + scp_rproc_free(scp); +} + +static int scp_cluster_init(struct platform_device *pdev, + struct mtk_scp_of_regs *of_regs) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev_of_node(dev); + struct platform_device *cpdev; + struct device_node *child; + const struct mtk_scp_of_data **cluster_of_data; + struct list_head *cluster = NULL; + struct mtk_scp *scp, *temp; + int core_id = 0, num_cores; + int ret; + + cluster_of_data = (const struct mtk_scp_of_data **)of_device_get_match_data(dev); + + for (num_cores = 0; cluster_of_data[num_cores]; num_cores++) + ; + + for_each_available_child_of_node(np, child) { + if (core_id >= num_cores) { + ret = -EINVAL; + dev_err(dev, "Not support core %d\n", core_id); + of_node_put(child); + goto init_fail; + } + + cpdev = of_find_device_by_node(child); + if (!cpdev) { + ret = -ENODEV; + dev_err(dev, "Not found platform device for core %d\n", core_id); + of_node_put(child); + goto init_fail; + } + + ret = scp_rproc_init(cpdev, of_regs, cluster_of_data[core_id], true); + if (ret) { + dev_err(dev, "Failed to initialize core %d rproc\n", core_id); + put_device(&cpdev->dev); + of_node_put(child); + goto init_fail; + } + + scp = platform_get_drvdata(cpdev); + put_device(&cpdev->dev); + if (core_id == 0) { + INIT_LIST_HEAD(&scp->cluster_cores); + cluster = &scp->cluster_cores; + platform_set_drvdata(pdev, cluster); + } + + list_add_tail(&scp->elem, cluster); + scp->cluster = cluster; + + of_node_put(child); + core_id++; + } + + list_for_each_entry_safe_reverse(scp, temp, cluster, elem) { + ret = rproc_add(scp->rproc); + if (ret) + goto add_fail; + } + + return 0; + +add_fail: + list_for_each_entry_continue(scp, cluster, elem) { + rproc_del(scp->rproc); + } +init_fail: + if (cluster) { + list_for_each_entry_safe_reverse(scp, temp, cluster, elem) { + list_del(&scp->elem); + scp_rproc_free(scp); + } + } + return ret; +} + +static void scp_cluster_exit(struct platform_device *pdev) +{ + struct list_head *cluster = platform_get_drvdata(pdev); + struct platform_device *cpdev; + struct mtk_scp *scp, *temp; + + list_for_each_entry_safe_reverse(scp, temp, cluster, elem) { + list_del(&scp->elem); + cpdev = to_platform_device(scp->dev); + scp_rproc_exit(cpdev); + } +} + static int scp_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct device_node *core_node; struct resource *res; struct mtk_scp_of_regs scp_regs; int ret; @@ -976,21 +1094,43 @@ static int scp_probe(struct platform_device *pdev) scp_regs.l1tcm_phys = res->start; } - return scp_rproc_init(pdev, &scp_regs); + ret = devm_of_platform_populate(dev); + if (ret) + return dev_err_probe(dev, ret, "Failed to populate platform devices\n"); + + core_node = of_get_child_by_name(np, "scp"); + of_node_put(core_node); + + if (!core_node) { + dev_info(dev, "single-core scp\n"); + + ret = scp_rproc_init(pdev, &scp_regs, of_device_get_match_data(dev), false); + if (ret) + return dev_err_probe(dev, ret, "Failed to initialize single-core scp\n"); + } else { + dev_info(dev, "multi-core scp\n"); + + ret = scp_cluster_init(pdev, &scp_regs); + if (ret) + return dev_err_probe(dev, ret, "Failed to initialize scp cluster\n"); + } + + return 0; } static int scp_remove(struct platform_device *pdev) { - struct mtk_scp *scp = platform_get_drvdata(pdev); - int i; + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct device_node *core_node; - rproc_del(scp->rproc); - scp_remove_rpmsg_subdev(scp); - scp_ipi_unregister(scp, SCP_IPI_INIT); - scp_unmap_memory_region(scp); - for (i = 0; i < SCP_IPI_MAX; i++) - mutex_destroy(&scp->ipi_desc[i].lock); - mutex_destroy(&scp->send_lock); + core_node = of_get_child_by_name(np, "scp"); + of_node_put(core_node); + + if (!core_node) + scp_rproc_exit(pdev); + else + scp_cluster_exit(pdev); return 0; } @@ -1069,12 +1209,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 Fri Mar 3 08:33:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 63790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp293750wrd; Fri, 3 Mar 2023 00:35:55 -0800 (PST) X-Google-Smtp-Source: AK7set/VxUQIjpWugUnUMkOvo7G+aLdxSp7JKaixrQxi9wFOuSONdTKepF67zEix7rNUpCvwW9SV X-Received: by 2002:a17:907:6e15:b0:8b1:75a0:e5c6 with SMTP id sd21-20020a1709076e1500b008b175a0e5c6mr1049641ejc.18.1677832555682; Fri, 03 Mar 2023 00:35:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677832555; cv=none; d=google.com; s=arc-20160816; b=U4+KOAXwDVEOxEfaoHdrtihhRIF+w3nt6RJWZyIB4VBK0EzNRmW/uLDqrgEFx7x1+N oyA8+fsuu74c0mm7rDUpyyNp/a/9RSkeQsTwsU6D3vX9y1y/atOZpU+x3EzPn0T2HxBA GTNojZxqN7kBHdGk7oDb0V/h61ALN656tYATUF9ymZhkp225vldl+HN3Zg6MI3VwEAVb EeD4tdetvyev7c+Nn1iMyfAUFOh5ZiIUDP25KcLeqGMt6YXCSs+zmvnHxm8ZuggFjhHD cZgxJAxI/ufQITsTg6b6yVzhJWt+vEOAt6aqyD5fHEkc4yh4bzKnx3S9f7XHzk1WPwPu kLLQ== 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=k2NsdMzII8uR0ZS5dUPEg2ggyKG+ilv8qc1YzufrVHc=; b=uG6HVbhwpZn8B77lahQJqZzJjntr4uxU0bOkrOjzis5IiojXgAblxZZCIys5OF42V6 HGyj9Pc8bNYMMwCHPAh6YoYo74GTsvi2QW8FfhOV/EqH6h90T6ImlxaBaoWXjG0772ii u7z3NZvvCTBNo2RCcRBskFGYY0JOPppS5EpV9sX0rnBiEkgULiTqwy2cpZHToDzco25V OOCoTSTDuJ9piKnwRemm+bVZaihs8XD9CLmSNLaZ3BDQVz9fhp1dF6L8T5XFnuOIZs9Z jGvg8Sf5NDXMSYVB6SH4Ix9cYCgOGGMTJv0oaMdYvsQShWOOn5XmuO5vTOV7w28RA9nv n7WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="jC/aqXkM"; 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 l21-20020a170906795500b008d19011d63asi2344703ejo.4.2023.03.03.00.35.33; Fri, 03 Mar 2023 00:35:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="jC/aqXkM"; 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 S230295AbjCCIeo (ORCPT + 99 others); Fri, 3 Mar 2023 03:34:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230181AbjCCIeU (ORCPT ); Fri, 3 Mar 2023 03:34:20 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EE43158B0; Fri, 3 Mar 2023 00:34:12 -0800 (PST) X-UUID: 25ceb1aeb99e11eda06fc9ecc4dadd91-20230303 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=k2NsdMzII8uR0ZS5dUPEg2ggyKG+ilv8qc1YzufrVHc=; b=jC/aqXkMEi+m+7tiEEfbivwswVXwtwBSUhAJ1jBd13YNfw4J1l+AyCwbl0OElVI16t/TWm64FYyIl4WkhwkSOB5fKlOVp6J9xEJ+e2xHZ1Z7Wqj486mpm/CUO8e4DZKHQBaspcUuyJDlQysCCQYWTzJ3fQKrBmIYxL3UpRRDC+8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:19a38b04-1e91-448b-91fc-b3571caf3e77,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:25b5999,CLOUDID:a1c71bb2-beed-4dfc-bd9c-e1b22fa6ccc4,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 25ceb1aeb99e11eda06fc9ecc4dadd91-20230303 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 2043475578; Fri, 03 Mar 2023 16:34:00 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) 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.25; Fri, 3 Mar 2023 16:34:00 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Fri, 3 Mar 2023 16:34:00 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v8 07/11] remoteproc: mediatek: Control SCP core 1 by rproc subdevice Date: Fri, 3 Mar 2023 16:33:51 +0800 Message-ID: <20230303083355.3378-8-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230303083355.3378-1-tinghan.shen@mediatek.com> References: <20230303083355.3378-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759334950098058649?= X-GMAIL-MSGID: =?utf-8?q?1759334950098058649?= Register SCP core 1 as a subdevice of core 0 for the boot sequence and watchdog timeout handling. The core 1 has to boot after core 0 because the SCP clock and SRAM power is controlled by SCP core 0. As for watchdog timeout handling, the remoteproc framework helps to stop/start subdevices automatically when SCP driver receives watchdog timeout event. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_common.h | 9 +++++ drivers/remoteproc/mtk_scp.c | 66 +++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index c088149e3dcc..f0c16553c00b 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; @@ -132,6 +139,8 @@ struct mtk_scp { struct list_head elem; struct list_head cluster_cores; struct list_head *cluster; + + struct mtk_scp_core_subdev *core_subdev; }; /** diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 84103a70f426..0ee161c1478c 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -862,6 +862,60 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) } } +static int scp_core_subdev_start(struct rproc_subdev *subdev) +{ + struct mtk_scp_core_subdev *core_subdev = to_core_subdev(subdev); + struct mtk_scp *scp = core_subdev->scp; + + rproc_boot(scp->rproc); + + return 0; +} + +static void scp_core_subdev_stop(struct rproc_subdev *subdev, bool crashed) +{ + struct mtk_scp_core_subdev *core_subdev = to_core_subdev(subdev); + struct mtk_scp *scp = core_subdev->scp; + + rproc_shutdown(scp->rproc); +} + +static int scp_core_subdev_register(struct mtk_scp *scp) +{ + struct device *dev = scp->dev; + struct mtk_scp_core_subdev *core_subdev; + struct mtk_scp *scp_c0; + + scp_c0 = list_first_entry(scp->cluster, struct mtk_scp, elem); + if (!scp_c0) + return -ENODATA; + + core_subdev = devm_kzalloc(dev, sizeof(*core_subdev), GFP_KERNEL); + if (!core_subdev) + return -ENOMEM; + + core_subdev->scp = scp; + core_subdev->subdev.start = scp_core_subdev_start; + core_subdev->subdev.stop = scp_core_subdev_stop; + + scp->core_subdev = core_subdev; + rproc_add_subdev(scp_c0->rproc, &scp->core_subdev->subdev); + + return 0; +} + +static void scp_core_subdev_unregister(struct mtk_scp *scp) +{ + struct mtk_scp *scp_c0; + + if (scp->core_subdev) { + scp_c0 = list_first_entry(scp->cluster, struct mtk_scp, elem); + rproc_remove_subdev(scp_c0->rproc, &scp->core_subdev->subdev); + devm_kfree(scp->dev, scp->core_subdev); + scp->core_subdev = NULL; + } +} + static int scp_rproc_init(struct platform_device *pdev, struct mtk_scp_of_regs *of_regs, const struct mtk_scp_of_data *of_data, @@ -959,6 +1013,7 @@ static void scp_rproc_free(struct mtk_scp *scp) { int i; + scp_core_subdev_unregister(scp); scp_remove_rpmsg_subdev(scp); scp_ipi_unregister(scp, SCP_IPI_INIT); scp_unmap_memory_region(scp); @@ -1033,6 +1088,17 @@ static int scp_cluster_init(struct platform_device *pdev, } list_for_each_entry_safe_reverse(scp, temp, cluster, elem) { + if (!list_is_first(&scp->elem, cluster)) { + ret = scp_core_subdev_register(scp); + if (ret) { + dev_err_probe(scp->dev, ret, "Failed to register as subdev\n"); + goto add_fail; + } + + /* sub cores are booted as subdevices of core 0 */ + scp->rproc->auto_boot = false; + } + ret = rproc_add(scp->rproc); if (ret) goto add_fail; From patchwork Fri Mar 3 08:33:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 63795 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp293993wrd; Fri, 3 Mar 2023 00:36:41 -0800 (PST) X-Google-Smtp-Source: AK7set8+Y5tJMbpIani+5FU2HDV+4DUKSFd9YYCAFg/qxLNpLfQL+/Bis7cLFsXMroQ64Ku9pfv7 X-Received: by 2002:a17:906:246:b0:8b1:fc1a:7d21 with SMTP id 6-20020a170906024600b008b1fc1a7d21mr989543ejl.5.1677832601183; Fri, 03 Mar 2023 00:36:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677832601; cv=none; d=google.com; s=arc-20160816; b=p43dzpzYrqhrLaHrmC4JxudCLfj5aA7kiOzIHEdnq/DTqaGFoqkr51rXhw7cxwffrP xux4ZyBtQiIdlTm0uvyQvHIKXiqfarqXl8ky9on/dYViYZggig+LYiIuNfhe6b4Uoyc9 gZqx+hmO7M7QIwO4tiwjfZuMc25PAHEUo44aFdo0gRHKoRAaxoHlscsv06COTAsCpEVf hbkF29hkV2b612jm5BFi9AgM0MnKQt2JRX+6VRu8jcnOUYMzZNpsJJ/XQvd07Nq6CU8d sNxppSv4vYSC26MJ37d6Rk1Qa8l1WwsBEURg1/hYUT6xuMWHph7nlHvM7JsqTmoUhwSf 6ZjQ== 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=uEpeUycuqvtzTVVPvzs3TcbkHzJy8hTzqIV9WdzIm/c=; b=cqR2eyIvlGIaIQd/tTcf44nKJlwOJ9BxeGzvy7YFS63azQc8dtP5H1uGIQHwKgB3iT sS61WNeptqOtqrGGRuIljJrxtGHo40DoA1KdZtqc55IUJjV/G6XXgsESRI8szfCr7ucj IbNnua0x2Aj0aS6df4f4LCc6mJ+8+yNgy+g/Y/USA4prNd4m6VcTQB6HY+A7DIGdJF1S DUoSyjGH2waYLPVsqQJUOdKXVgSWqF+B01nTSLpr97fCx/SBxHCGPeOxnzIzwgv5uSRJ 4F6EWz4k7KT69+TkEj0QNjFdAaOpIAPOz+3W3qydrlkGOIFOPDGZALmBjeJ7Ojo3lw9P DEwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=SuLeR4aL; 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 nb18-20020a1709071c9200b008d2060ebc70si2419473ejc.726.2023.03.03.00.36.19; Fri, 03 Mar 2023 00:36:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=SuLeR4aL; 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 S230478AbjCCIe7 (ORCPT + 99 others); Fri, 3 Mar 2023 03:34:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230168AbjCCIeT (ORCPT ); Fri, 3 Mar 2023 03:34:19 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E9EE136E1; Fri, 3 Mar 2023 00:34:11 -0800 (PST) X-UUID: 25d10e90b99e11eda06fc9ecc4dadd91-20230303 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=uEpeUycuqvtzTVVPvzs3TcbkHzJy8hTzqIV9WdzIm/c=; b=SuLeR4aLdz/HYdMz4sOMFzJWB9xOPNELqJyJflzgKi1Zi+igDutXAZQLGzOvZILA6F9Dwaxy/WsjQZIPxMdnLzCcpWWpmxYysVxqXO3WV8kToEW7nvFTEeTwxCVBislHTco5+stpyztwgHoIENXszuBgtXF8zqXtFAB0gcRixkA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:5170a27e-72fe-4032-bcf2-9ebcbb5843a9,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:25b5999,CLOUDID:247ca9f4-ddba-41c3-91d9-10eeade8eac7,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 25d10e90b99e11eda06fc9ecc4dadd91-20230303 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 219285221; Fri, 03 Mar 2023 16:34:00 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) 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.25; Fri, 3 Mar 2023 16:34:00 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Fri, 3 Mar 2023 16:34:00 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v8 08/11] remoteproc: mediatek: Setup MT8195 SCP core 1 SRAM offset Date: Fri, 3 Mar 2023 16:33:52 +0800 Message-ID: <20230303083355.3378-9-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230303083355.3378-1-tinghan.shen@mediatek.com> References: <20230303083355.3378-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759334997646096628?= X-GMAIL-MSGID: =?utf-8?q?1759334997646096628?= 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 f0c16553c00b..80be712a3583 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 0ee161c1478c..049688c731f7 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -484,6 +484,9 @@ static int mt8195_scp_before_load(struct mtk_scp *scp) static int mt8195_scp_c1_before_load(struct mtk_scp *scp) { + u32 sec_ctrl; + struct mtk_scp *scp_c0; + scp_sram_power_on(scp->reg_base + MT8195_CPU1_SRAM_PD, 0); /* hold SCP in reset while loading FW. */ @@ -492,6 +495,30 @@ static int mt8195_scp_c1_before_load(struct mtk_scp *scp) /* enable MPU for all memory regions */ writel(0xff, scp->reg_base + MT8195_CORE1_MEM_ATT_PREDEF); + /* + * The L2TCM_OFFSET_RANGE and L2TCM_OFFSET shift the destination address + * on SRAM when SCP core 1 accesses SRAM. + * + * This configuration solves booting the SCP core 0 and core 1 from + * different SRAM address because core 0 and core 1 both boot from + * the head of SRAM by default. this must be configured before boot SCP core 1. + * + * The value of L2TCM_OFFSET_RANGE is from the viewpoint of SCP core 1. + * When SCP core 1 issues address within the range (L2TCM_OFFSET_RANGE), + * the address will be added with a fixed offset (L2TCM_OFFSET) on the bus. + * The shift action is tranparent to software. + */ + writel(0, scp->reg_base + MT8195_L2TCM_OFFSET_RANGE_0_LOW); + writel(scp->sram_size, scp->reg_base + MT8195_L2TCM_OFFSET_RANGE_0_HIGH); + + scp_c0 = list_first_entry(scp->cluster, struct mtk_scp, elem); + writel(scp->sram_phys - scp_c0->sram_phys, scp->reg_base + MT8195_L2TCM_OFFSET); + + /* enable SRAM offset when fetching instruction and data */ + sec_ctrl = readl(scp->reg_base + MT8195_SEC_CTRL); + sec_ctrl |= MT8195_CORE_OFFSET_ENABLE_I | MT8195_CORE_OFFSET_ENABLE_D; + writel(sec_ctrl, scp->reg_base + MT8195_SEC_CTRL); + return 0; } From patchwork Fri Mar 3 08:33:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 63787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp293590wrd; Fri, 3 Mar 2023 00:35:23 -0800 (PST) X-Google-Smtp-Source: AK7set+HAnbSejQNQTFGX0PZ2VGiz9OvDUn6tQS7U1Q0Td1MZv3FEC6XE+Z9e/slyN8Xrtv1BHf/ X-Received: by 2002:a05:6402:6d2:b0:4af:51b6:fe49 with SMTP id n18-20020a05640206d200b004af51b6fe49mr965386edy.13.1677832523680; Fri, 03 Mar 2023 00:35:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677832523; cv=none; d=google.com; s=arc-20160816; b=MJylJUqgHdQRMQ3r++qW/cfOLhqyqCFEQc281x/6mSR268Mvc57U2ujtCVSSylh+D8 DKcqQGOpZFuFy/Zbqf0AjFoouRbdRVzY/1z7/65XSNCQ1WO9juNPHDJSXOyL1H7t6nOK 3YGkxFG4L9zSuMPe+72S+0vFmQVNoFFcyHMMzyr998D//N5tLZx6kpaOdR3QOiMZxOHI RuCzZ81Zq7vaN3mJIue8AyN9zgcsX9M7DGxXdf5uEMzsegJYnM9/lVFeCmh0iRoyT5Zh lUuOdlGoXl7MoMyKTv8ZNtMO/BZypBmvpPQAH8J0nx6Tgh9WzIufV99bBok+1H0Yho2j xrNg== 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=VXNvkSE666U3KVDnuZr8zG2wpLjRqGaDYzDsWg0/Ibs=; b=ub/De5TPzjo+ChINFmoN5ia/9hn479mB3F8319YVOKTodv1+nNKi+xI2P0xdXogPQY coyrcdh/Y2FZp2GhO4D1UjE9GmSZbZgXJwTo6FBEYwLESKQWW/zHAhVM26/AgMEJg+m2 ay9KL4dFuVEQ0GP4TT7ByMOn0ahd9+w0u0NlE05yT8Y324MwJUoX5Q1/UOKdNHL/Jfvk 62W2BKR/MstFGvPWDWIkkx+UgY2PDcdiLxPZEqZ8ZyrObcPqjN69hOJN1vR8br0VGTao 94VBm4CoHa8AOLwrKhbs4mnI5jebHlmNq3jHV7e5TixObSI1vaMI/fNg7keqWpOhvXZQ hnVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=LNNnxQhx; 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 p15-20020aa7d30f000000b004bf8bc6757bsi2224312edq.598.2023.03.03.00.35.01; Fri, 03 Mar 2023 00:35:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=LNNnxQhx; 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 S230195AbjCCIeU (ORCPT + 99 others); Fri, 3 Mar 2023 03:34:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229985AbjCCIeP (ORCPT ); Fri, 3 Mar 2023 03:34:15 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DF7311E8F; Fri, 3 Mar 2023 00:34:07 -0800 (PST) X-UUID: 25db946eb99e11eda06fc9ecc4dadd91-20230303 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=VXNvkSE666U3KVDnuZr8zG2wpLjRqGaDYzDsWg0/Ibs=; b=LNNnxQhxpjibn91CTFApjPW+YN1h9retfu53TmDbk/rjJQNfa14UHL3Hip58g9zTKuXpsoHVMXn8yGn/YmONxt9BBe406vRJaajeWWXshrXWXJfGHCIwdhjnknj6JScAEYqKrS49lhzgPWnQiIFtzbMtbSEBuQCjz+SeKqlgxe8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:499404c1-5a0b-4aec-8d60-d1182db1d0e7,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:25b5999,CLOUDID:217ca9f4-ddba-41c3-91d9-10eeade8eac7,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 25db946eb99e11eda06fc9ecc4dadd91-20230303 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1356464550; Fri, 03 Mar 2023 16:34:00 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Fri, 3 Mar 2023 16:34:00 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Fri, 3 Mar 2023 16:34:00 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v8 09/11] remoteproc: mediatek: Handle MT8195 SCP core 1 watchdog timeout Date: Fri, 3 Mar 2023 16:33:53 +0800 Message-ID: <20230303083355.3378-10-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230303083355.3378-1-tinghan.shen@mediatek.com> References: <20230303083355.3378-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_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759334916153091364?= X-GMAIL-MSGID: =?utf-8?q?1759334916153091364?= 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 80be712a3583..80b072c17cc7 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 049688c731f7..056a814486a3 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -229,6 +229,29 @@ static void mt8192_scp_irq_handler(struct mtk_scp *scp) } } +static void mt8195_scp_irq_handler(struct mtk_scp *scp) +{ + u32 scp_to_host; + + scp_to_host = readl(scp->reg_base + MT8192_SCP2APMCU_IPC_SET); + + if (scp_to_host & MT8192_SCP_IPC_INT_BIT) { + scp_ipi_handler(scp); + } else { + u32 reason = readl(scp->reg_base + MT8195_SYS_STATUS); + + if (reason & MT8195_CORE0_WDT) + writel(1, scp->reg_base + MT8192_CORE0_WDT_IRQ); + + if (reason & MT8195_CORE1_WDT) + writel(1, scp->reg_base + MT8195_CORE1_WDT_IRQ); + + scp_wdt_handler(scp, reason); + } + + writel(scp_to_host, scp->reg_base + MT8192_SCP2APMCU_IPC_CLR); +} + static void mt8195_scp_c1_irq_handler(struct mtk_scp *scp) { u32 scp_to_host; @@ -1281,7 +1304,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 Fri Mar 3 08:33:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 63788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp293694wrd; Fri, 3 Mar 2023 00:35:44 -0800 (PST) X-Google-Smtp-Source: AK7set+a+g4xYGaqKtWtB1yGqbqBFfrsDZW1QeZqy+Skd/fneKCN3p1h5DDUeDtYhQPBFTbkWESW X-Received: by 2002:a17:906:af67:b0:8b1:2ebf:386c with SMTP id os7-20020a170906af6700b008b12ebf386cmr850714ejb.11.1677832544506; Fri, 03 Mar 2023 00:35:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677832544; cv=none; d=google.com; s=arc-20160816; b=gavOl4nz+g8i7ovfgUaKKU8p5FIdY6hKiNXNZoVb9ZAxoGkkaGCj8cV7vkQ+TDUkK6 BxwNMICu6PgUAPEoAEEFj3OJeAhn0MnwtuG322bqrhnDjvPpeVuLxx1WS6HfE6wK/9XL eP7FKUNirwCT9lbKwtIIXAYgtuOD0V5+akeVJbVjeYK9G/AjhuJBe4ogLyohrJGaLLcE VTR1XB83PouKlxpvepWz6Uvh5r+Zw+PNY0itxuDg2oqBMVNFbgg2PySuJRlRDSOXbIjt Kdky6MnUSsWNpy10zXZ4hIX0oBaiukxMRsOAAXvQwJgbzmqD9FqZa3xc5Dmpbq72epW4 ye0A== 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=ELFAv6mnjMIL1R/76fzrZkUpb1TnLkxsaCN2YHOI1ms=; b=zhOvyzqJ6JV0IXdN2OvlVs4RHJHyB0Mu6EQE64cKayVmmeBNbJVhweHOx7uNxLcZIK Yj41ek3+YHAn+4hJBv8X+s1UryjG7+O84ZpzaOBLmV0gOm0hDuR9l8PDk4NN01VuTbe/ b6GYalQ7sM8Z0xYGTrvR+Erb1xprdf1HssmlgfD+1GZOSESiQeSvJ4iOQCzLm0H1VS4/ iDOTL44bTzEJmd5/2E77owHSVoACxH2vFmirKTNWPtIlgHXx2KHEs2pgBMDOHGkDQFWG VGAFOnLoX8RbdHwgpePmRJyk1fqS8o1lR24RszM1X2GCFM0W0bXBOfhxY/U+8rdCf5Rq cQLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=YgdGeE4A; 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 e7-20020a1709061e8700b008cf02438e0dsi1654360ejj.683.2023.03.03.00.35.22; Fri, 03 Mar 2023 00:35:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=YgdGeE4A; 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 S230260AbjCCIee (ORCPT + 99 others); Fri, 3 Mar 2023 03:34:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230166AbjCCIeS (ORCPT ); Fri, 3 Mar 2023 03:34:18 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 889CE13D77; Fri, 3 Mar 2023 00:34:11 -0800 (PST) X-UUID: 26b85fa2b99e11ed945fc101203acc17-20230303 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=ELFAv6mnjMIL1R/76fzrZkUpb1TnLkxsaCN2YHOI1ms=; b=YgdGeE4Ay21UXir5GhXR+in/EabycuGcQnp66fY7H0nP+fK6yEv7cDvffxRkpliznUEgs5NC2uDqirmFhad80x6G9lAafaaO3Nr+yxHAN5OngCXKb3fuEnYkvnp8BI+aPCw6ttCsSAGit52UyQGtHOblCzQeJVM/JmZR0lslxIg=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:45128724-ae79-46eb-9bf8-db47d35454c9,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:25b5999,CLOUDID:dcc71bb2-beed-4dfc-bd9c-e1b22fa6ccc4,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 26b85fa2b99e11ed945fc101203acc17-20230303 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1771808149; Fri, 03 Mar 2023 16:34:02 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) 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.25; Fri, 3 Mar 2023 16:34:00 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Fri, 3 Mar 2023 16:34:00 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v8 10/11] remoteproc: mediatek: Refine ipi handler error message Date: Fri, 3 Mar 2023 16:33:54 +0800 Message-ID: <20230303083355.3378-11-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230303083355.3378-1-tinghan.shen@mediatek.com> References: <20230303083355.3378-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759334938093123975?= X-GMAIL-MSGID: =?utf-8?q?1759334938093123975?= 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 056a814486a3..6094f79e9565 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -113,7 +113,7 @@ static void scp_ipi_handler(struct mtk_scp *scp) scp_ipi_lock(scp, id); handler = ipi_desc[id].handler; if (!handler) { - dev_err(scp->dev, "No such ipi id = %d\n", id); + dev_err(scp->dev, "No handler for ipi id = %d\n", id); scp_ipi_unlock(scp, id); return; } From patchwork Fri Mar 3 08:33:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 63794 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp293902wrd; Fri, 3 Mar 2023 00:36:27 -0800 (PST) X-Google-Smtp-Source: AK7set8h2/8lI3j4KlQw9CxDNVLbvryaneotgG4FYhTvqvb+r9CpNWYXbNuXo59HP9uZXsIHqs+7 X-Received: by 2002:a17:906:66d8:b0:872:b17a:9b59 with SMTP id k24-20020a17090666d800b00872b17a9b59mr929528ejp.38.1677832587805; Fri, 03 Mar 2023 00:36:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677832587; cv=none; d=google.com; s=arc-20160816; b=E9tMMPRarZ/d4lMsQlh9J5v+wTmI4esBz2Ap7AYli9E7EifFQ/sfHQgzAfbqiyqR8w v8b5OFhV6ZgAd6CP8mFG7FmQkrteiIMcanNtIVPMgxzzIC8uRxTlTXWSAiTFZPzSh14k 5rv8XPWtaSv1E5l+vQ7zs2a0mRvjk/dk9GCniXQ+DhDOdib1J2Z5As6W4aEdN4ByCCmr iTc9upoEPU2DjPmsgb8vA6dyz8BQPpGJcRgOR4tMDoByOq5TIEMaFrSNoLOs7oQqJRHk JFxW99H60O8e16YFCaUkgkFwq7CTAeExKRIAFR6w70aOU+p4FSDIeM+UfKQ9Gh4Srt55 ytiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=e6eQQOvqn+zPWnCwihlkrd8bxgyCpuOOMe/nTlCqPLo=; b=yOOwb83fwF6f5E8opFPdSxWqlFrb/tp07TejvANe84lsyoszrf2HSxcpNM/omJqBEp xzh/9K4alxVJr+wu/APw3u4PId2EjOP0tI9SiSlj6wjJbvfwiJaysqiYLfkgcynZcxNu FRoUOPmPg5Cfssotn9we1E3crpMf4cSci0/qDhAYJVvG0BrEnut7n5ITU3wk2aw7zlim sSwe8t6hsiIHDPFn9L4vOfyr/1ztoHZ530P/l+QmXBsO6ky7pLD3dbOQ1A8iZ9fkKJCZ SVs+Z346Sl2h7txVm0HS5mP6EbzJQ+0XIVvt9xaCo6n4EtZ/jR/jma7nbUYTDNjkROGH 6O2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=XNk98tPN; 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 pv25-20020a170907209900b008b9314d13a7si1677826ejb.640.2023.03.03.00.36.05; Fri, 03 Mar 2023 00:36:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=XNk98tPN; 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 S230247AbjCCIea (ORCPT + 99 others); Fri, 3 Mar 2023 03:34:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230165AbjCCIeS (ORCPT ); Fri, 3 Mar 2023 03:34:18 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AEC2144A1; Fri, 3 Mar 2023 00:34:08 -0800 (PST) X-UUID: 269feb5cb99e11ed945fc101203acc17-20230303 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=e6eQQOvqn+zPWnCwihlkrd8bxgyCpuOOMe/nTlCqPLo=; b=XNk98tPNi4uX4l0ExCw2GhNpZ6iFk0ISuX0BcBI8iXRem1Ho9z4m+QpwA8daC1DdSzBwcvxZBDYEWfuYbnDBuWCACgP4H7+tJ8XLfRvva7NtKL0mzzPfIOYuXpyyw5YlT5z/6bK1FYnT7gKjfKC4RbD6GZ7qbrmFwqcizL7k44M=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20,REQID:4c5daf3c-4e1a-47e0-97fb-d360f26a717b,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:25b5999,CLOUDID:e67ba9f4-ddba-41c3-91d9-10eeade8eac7,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 269feb5cb99e11ed945fc101203acc17-20230303 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 1701353715; Fri, 03 Mar 2023 16:34:02 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Fri, 3 Mar 2023 16:34:00 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Fri, 3 Mar 2023 16:34:00 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v8 11/11] arm64: dts: mediatek: mt8195: Add SCP 2nd core Date: Fri, 3 Mar 2023 16:33:55 +0800 Message-ID: <20230303083355.3378-12-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230303083355.3378-1-tinghan.shen@mediatek.com> References: <20230303083355.3378-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_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759334983650967674?= X-GMAIL-MSGID: =?utf-8?q?1759334983650967674?= Rewrite the MT8195 SCP device node as a cluster and add the SCP 2nd core in it. Since the SCP device node is changed to multi-core structure, enable SCP cluster to enable probing SCP core 0. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- .../boot/dts/mediatek/mt8195-cherry.dtsi | 6 +++- arch/arm64/boot/dts/mediatek/mt8195.dtsi | 32 ++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi index 56749cfe7c33..31415d71b6a4 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi @@ -933,7 +933,11 @@ interrupts-extended = <&pio 222 IRQ_TYPE_LEVEL_HIGH>; }; -&scp { +&scp_cluster { + status = "okay"; +}; + +&scp_c0 { status = "okay"; firmware-name = "mediatek/mt8195/scp.img"; diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi index 8f1264d5290b..31209ef7e55d 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi @@ -826,14 +826,30 @@ clocks = <&infracfg_ao CLK_INFRA_AO_GCE2>; }; - scp: scp@10500000 { - compatible = "mediatek,mt8195-scp"; - reg = <0 0x10500000 0 0x100000>, - <0 0x10720000 0 0xe0000>, - <0 0x10700000 0 0x8000>; - reg-names = "sram", "cfg", "l1tcm"; - interrupts = ; + scp_cluster: scp@10500000 { + compatible = "mediatek,mt8195-scp-dual"; + reg = <0 0x10720000 0 0xe0000>, <0 0x10700000 0 0x8000>; + reg-names = "cfg", "l1tcm"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0 0x10500000 0x100000>; status = "disabled"; + + scp_c0: scp@0 { + compatible = "mediatek,scp-core"; + reg = <0x0 0xa0000>; + reg-names = "sram"; + interrupts = ; + status = "disabled"; + }; + + scp_c1: scp@a0000 { + compatible = "mediatek,scp-core"; + reg = <0xa0000 0x20000>; + reg-names = "sram"; + interrupts = ; + status = "disabled"; + }; }; scp_adsp: clock-controller@10720000 { @@ -2291,7 +2307,7 @@ <&iommu_vdo M4U_PORT_L19_VENC_REF_LUMA>, <&iommu_vdo M4U_PORT_L19_VENC_REF_CHROMA>; interrupts = ; - mediatek,scp = <&scp>; + mediatek,scp = <&scp_c0>; clocks = <&vencsys CLK_VENC_VENC>; clock-names = "venc_sel"; assigned-clocks = <&topckgen CLK_TOP_VENC>;