From patchwork Mon Feb 13 03:37: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: 56012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2156585wrn; Sun, 12 Feb 2023 19:39:27 -0800 (PST) X-Google-Smtp-Source: AK7set8nWBhXpfQa6r6Kxqa6myTcOmMmbgrFop+ojQSwjPxppP49Fm+us7sMC5UoYJbNXbqtZZy0 X-Received: by 2002:a05:6a20:3c8c:b0:bc:63d0:d9d9 with SMTP id b12-20020a056a203c8c00b000bc63d0d9d9mr27126136pzj.47.1676259566895; Sun, 12 Feb 2023 19:39:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676259566; cv=none; d=google.com; s=arc-20160816; b=jlPMlUnjLTAZ+Mw0v1TZK655ElgtuYrTeO7lfEnpoyyPpd5WxfDNXBzWZ+JMoQ6HOd 23CvDzPrXg/95IB3Jn/d/+ZTQFG88dLnY8FU6Nl2gadVbAMnNTx3S4SOfs3oK22A46uG n8pFQQluxcv4U4gVMbdahP2YnuYtUXQcYWUxYMsYEnvcjM8tRoC04zlvErM6Af/G+puK /1YOIOPiAlhCTMf55zZRa2IcnRApogVymmWQsDgZCoxxB7M2T8PIyN8wx9vVdNUcD06u VhR9KGP/vv+mx/VdmeZQkDSyi891C8VAQvC1KbjPn6LEC56kWlK65UMDKzMOjum4BRl4 UOkg== 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=rdfbv0T07N5J2m8yw3AM9F59/y4cKYiiR8JDyqKd2T4RitmUGo0EsDmKG+Ez0Z0M9N rX4hwSs8rXjBFhW7NC9G3Sb6HIxMM5KN3LYvc2xME6sCqfz8zIgBVtw7veWNV6VLHhD6 XPT1rRNreExg7WV3n3saiIQXZRsi3uC82GI2mv/2XrY4Pa0NagMWh1FNCZ/EiQLJUYev MkDpSrv5zAxxe3C1GLgneK7G4398re5z5KhPHmoV2g7f+MT/uo+6V5WRW27pd9fBLLFQ idPunJermYHKhNce5TNvkIUc+TWiBSSDVgA3+B/czmS3tX6zB1GEg5GGtE6wOzjPptGX KrJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=HtvnUG3c; 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 q85-20020a632a58000000b004fb7e7ef77fsi5535067pgq.536.2023.02.12.19.39.14; Sun, 12 Feb 2023 19:39:26 -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=HtvnUG3c; 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 S229969AbjBMDih (ORCPT + 99 others); Sun, 12 Feb 2023 22:38:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbjBMDiP (ORCPT ); Sun, 12 Feb 2023 22:38:15 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1901CC12; Sun, 12 Feb 2023 19:38:09 -0800 (PST) X-UUID: d2823eaaab4f11ed945fc101203acc17-20230213 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=HtvnUG3cZkIJhBpm+fHs7w44QXG5ws5RRgXoRf42yw2yVr0kLvJ7TKEcPIutuKRP/3I/WxFo+VQP9Qc7+umDFcmMnkE6W1BrlsjW74r4NRLkH++7KbH9t67PPaow80BAdv9fCF4pEd5mGtlS6voSGJUoNrM11O4XCGUVRH1Eq1Q=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:3ac2002d-d992-4437-a2a5-449858cd98d3,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:f3813cf8-ff42-4fb0-b929-626456a83c14,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: d2823eaaab4f11ed945fc101203acc17-20230213 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1935960359; Mon, 13 Feb 2023 11:38:04 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) 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.792.15; Mon, 13 Feb 2023 11:38:02 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 13 Feb 2023 11:38:02 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v6 01/12] dt-bindings: remoteproc: mediatek: Improve the rpmsg subnode definition Date: Mon, 13 Feb 2023 11:37:47 +0800 Message-ID: <20230213033758.16681-2-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230213033758.16681-1-tinghan.shen@mediatek.com> References: <20230213033758.16681-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?1757685551343013200?= X-GMAIL-MSGID: =?utf-8?q?1757685551343013200?= 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 Mon Feb 13 03:37: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: 56004 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2156463wrn; Sun, 12 Feb 2023 19:38:56 -0800 (PST) X-Google-Smtp-Source: AK7set//rK5jIIxAUTkorHdGvcw+f+aomCCwAGUmKh0WFjD5cHKT9y6a4P6o6TejCmmKZ6cHsQjY X-Received: by 2002:a17:902:db11:b0:199:2e77:fe5a with SMTP id m17-20020a170902db1100b001992e77fe5amr26703198plx.61.1676259536311; Sun, 12 Feb 2023 19:38:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676259536; cv=none; d=google.com; s=arc-20160816; b=vGlvZDFu2ribUOTjfWpFk6bnrJAbQxq56Fx2qrdcE+O/U9Dj8dk8FM/fdhcGcL4+v1 f85Nk5dvBHS0ZeSv/h9hN78U3v1s+STDdPcHMgNJrs/ODUVEnelD7TnKYANVBYamsOFH SAYKCuID7ujJbtvmjS88X5u3yNoM7REYY3jbxOoveZgISqLPuWeKQTg37NgMiW9BK2se YyHVwl2yrXCKdAyIHwpj4ZRf2j8tmJPwSATA67Rn5Nf9fG/DoXraCt9KKHLpmFywBdh3 tJsN0UwVFUaeUcCVmeq+jyWcO8eYZ6TIXV5o1X8ZOvZsMKPYpyrOtnGFJ96xgtofiKaL 05GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=pUSE1wzbu3r1aEcwMoKUD5CVWfuQSPXwRVeJZfMrP8w=; b=gbSfj59Pwjtwrthq1dJB2rdmUZLOS20Pc6U1WmhisA7fB+pLUQQYAyp/+73UFwM6T1 5GlYCtJ05M9JO9CLSP4GQXFME9SvGxobJDQDjfWINYywbJaQ6VXk8/AMEbF7y6P0pu9N TZrWmLSLHHw7tuYTNprpEYWCvSxnOeEggZH8Ra3tru/N6H+urNjcIMDTFukGT+AzamkW eXsFi2LpwkVBHKJKrtvq7afoSSmmTxqbrrqYqOIzlS2Ea8kbJ6ZtLeSQnreXlMAr+JXi PStn721Qo4yiCRRRRFqKZWR+mzGiYwnGYj+IdqYPBrO1dtb8WDDdPRQsZp06sgY59x+o TcYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=c4r9sSfH; 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 y4-20020a170902864400b0019931c82e24si9908330plt.195.2023.02.12.19.38.43; Sun, 12 Feb 2023 19:38: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=c4r9sSfH; 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 S229881AbjBMDiN (ORCPT + 99 others); Sun, 12 Feb 2023 22:38:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229687AbjBMDiK (ORCPT ); Sun, 12 Feb 2023 22:38:10 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A160BCC23; Sun, 12 Feb 2023 19:38:08 -0800 (PST) X-UUID: d29e15d0ab4f11ed945fc101203acc17-20230213 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=pUSE1wzbu3r1aEcwMoKUD5CVWfuQSPXwRVeJZfMrP8w=; b=c4r9sSfHsEmLh1qywFIpSILGz0KbElpvJrtDT2V3Qkml4xPpQ9CFun2vtkZnf+Yn5Wg9miE+Qh86uEePr0kVnlVcNlVq8vxtSTxOTJ0CD1HWoO87Ew4jmffAkaM587Rum44VjbizCbKTl+37EA0Jb5hl+Ozdo8bFT9QESsXS0n0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:609b9f74-e1ab-4295-a8b2-dee11076386f,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:3ccd1257-dd49-462e-a4be-2143a3ddc739,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: d29e15d0ab4f11ed945fc101203acc17-20230213 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 678154243; Mon, 13 Feb 2023 11:38:04 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 13 Feb 2023 11:38:02 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 13 Feb 2023 11:38:02 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v6 02/12] arm64: dts: mediatek: mt8183-kukui: Update the node name of SCP rpmsg subnode Date: Mon, 13 Feb 2023 11:37:48 +0800 Message-ID: <20230213033758.16681-3-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230213033758.16681-1-tinghan.shen@mediatek.com> References: <20230213033758.16681-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?1757685519240195913?= X-GMAIL-MSGID: =?utf-8?q?1757685519240195913?= Align the node name with the definition in SCP bindings. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi index fbe14b13051a..a259eb043de5 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi @@ -810,7 +810,7 @@ pinctrl-names = "default"; pinctrl-0 = <&scp_pins>; - cros_ec { + cros-ec-rpmsg { compatible = "google,cros-ec-rpmsg"; mediatek,rpmsg-name = "cros-ec-rpmsg"; }; From patchwork Mon Feb 13 03:37: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: 56013 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2156601wrn; Sun, 12 Feb 2023 19:39:31 -0800 (PST) X-Google-Smtp-Source: AK7set8u8x05aSkro97RQXz7++UX2kZUoiZxKIKp+ufsLXoogZYRmLxV5wcEQKwdpeHfflwhVfX7 X-Received: by 2002:a17:90b:3147:b0:230:75f4:175 with SMTP id ip7-20020a17090b314700b0023075f40175mr25550203pjb.19.1676259571253; Sun, 12 Feb 2023 19:39:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676259571; cv=none; d=google.com; s=arc-20160816; b=NvZJsCTlsnwY7fZtYbvkyV8G2IRfe5eHLrF7YfblrwYtD6r5CDZNW/BbkEYDGVl4zp cFMFTBdtVhC8htvhD0bZyClE7DVLwWAMkgZtvPKjxVsWHT7FT3v9hcvKll/OamWf3+7w raoVAgWOJzNLh0kJwe1YxUMDszj4rk6QddDQf70/hQ8i6QH4fKtFk2ZmqczDKmWSt80S uCmVa1fuPGUpZS/7m2Gx1CM7VWz7lUaXnrBsOWccG3BDs7ad7nqnJpbZAN2rWawskndJ sglqdQ2FLt+8fKa2lC9aSG8ij3j5ja87VwvPGBkJe7Hfv0GKH9qf5pQ4v7Gk2Pnslnpz n3eQ== 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=aJL5WwuNkLLAmjwNWyIG/SEF2/AxJaZzO9N8ums8eME=; b=r4LJ8xLGhwaA6D4BhPvSvDngXRtp+eGKrasb+//zKdtpfIiJWknw/6E6Ed2Zg8Fry7 yuEUw58Tsk7Fc5Zrl/0OwgRQ3z5OcvMb85LC/ANqlwFEyzIbDxwwqoQQNvUf6cqMfmcc COdDs3vKDCbY1TXpxUwcOgN+Twf6/XOsx7cU8UcAgaS9lVCmjN/p4BI8lYPfnVV42DCU IRQmtCE/WQeFLyt4VJK0i+WmCMwjo9jdS3nbH+hAycvQSClTajvjvAlFoAJAxaNvtOBi JR6KTl7fpiO/c0jKxOEIrL545QPCYVzZrrvqBQthPqNUtPI2NK4JspZ0KTs4W5WToxKK Ms/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=JTaSAQ6G; 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 t11-20020a17090ae50b00b00233a8c55053si8253526pjy.37.2023.02.12.19.39.19; Sun, 12 Feb 2023 19:39:31 -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=JTaSAQ6G; 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 S229908AbjBMDik (ORCPT + 99 others); Sun, 12 Feb 2023 22:38:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbjBMDiS (ORCPT ); Sun, 12 Feb 2023 22:38:18 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B01BDBC3; Sun, 12 Feb 2023 19:38:14 -0800 (PST) X-UUID: d2b27be2ab4f11eda06fc9ecc4dadd91-20230213 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=aJL5WwuNkLLAmjwNWyIG/SEF2/AxJaZzO9N8ums8eME=; b=JTaSAQ6GS0v4aFf0gUPiBsI4J4NrcQoLgzUuvxUzTBo9iWLIqg7bG6IpBuE6XEE1sS9VfeTeCoRr9AmAgwoHQXmKMvl2h6yWBGM7qgt9SFCoStWE+ROXx/AYFQAS92YLisExDQckMQ0OVeuYQDRSORaFwX6w3fuMUCenOlWQIGw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:c0627788-989e-4ee5-9bfa-50d9b2c517e4,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.19,REQID:c0627788-989e-4ee5-9bfa-50d9b2c517e4,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:885ddb2,CLOUDID:786ead8e-8530-4eff-9f77-222cf6e2895b,B ulkID:230213113807VPHMUHJI,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: d2b27be2ab4f11eda06fc9ecc4dadd91-20230213 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 161831734; Mon, 13 Feb 2023 11:38:04 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 13 Feb 2023 11:38:03 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 13 Feb 2023 11:38:03 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v6 03/12] dt-bindings: remoteproc: mediatek: Support MT8195 dual-core SCP Date: Mon, 13 Feb 2023 11:37:49 +0800 Message-ID: <20230213033758.16681-4-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230213033758.16681-1-tinghan.shen@mediatek.com> References: <20230213033758.16681-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?1757685556545316642?= X-GMAIL-MSGID: =?utf-8?q?1757685556545316642?= 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 definition and adds new definitions for 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 Mon Feb 13 03:37: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: 56009 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2156565wrn; Sun, 12 Feb 2023 19:39:19 -0800 (PST) X-Google-Smtp-Source: AK7set+5AQum/sbxTa9QR4rtgKwEMLT5fWAaKg38+XyE41DhBO6352m6ZbGO7dbFx6h1pd2bbUo9 X-Received: by 2002:a17:903:4112:b0:19a:6b03:c375 with SMTP id r18-20020a170903411200b0019a6b03c375mr9307988pld.0.1676259559292; Sun, 12 Feb 2023 19:39:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676259559; cv=none; d=google.com; s=arc-20160816; b=xa4piZjF6i/o5DtU007JDpFawJi3zfJnlXkBnTFefIykDZCcQlBsOYGk834N8ZCa4F fOziYOlAK5tVUGKZouo79LXQJiV5JymAgWwMEo0T2sxv3E/bLDzSTpbKXwTtO8QOTnli gjdDQ7nWVF0bTjAkvQx5PSH1Bjl6D/qspyi26O23L5InvbXIpajdy7CmdiudX3erePW8 BDVZ1QPWzF0NAKzDch4ylFN8o6g8/1I0avMwABuHHdKV2A1pjhxb5SmHLzcZ0s9pRHpO CtCE4cawe1sWO1MCuXPImbAx+JzI+WSfpki1t64nhBYwOw0M4LoBwqmHjtPD2DUmaKPv YA9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6HhKK4J2H3bm5JiXJDgPozBzQTQbRGkWm2dygfVNSZ0=; b=iIqza8F4Z1JbXlVv06YmkvmGLQqn3r5yLexd3fyx+DI5jLmjvovjSjViyNjcskVR11 qyxunCOlgg/fOegTnA0/0xrV1nhPq+2bi26YSZh8gk4licqvPAMk6DJRhWevByouFFql 7hXObjz8zSBaEPYxEbYFLaeEQfLT1uZsVPwMIdoegFJn4ZL5f+FLieR7x6WIzlPtDZkh cXiAuCY9xBIz25MVhGfT2QQKuk+xVKX2KMGlkBxtYsp+7TsDHaL9Z4HOPeMpaLQE290P 8qnOSiDsGhMEZ3UkAU6MHfq4j6G7zYkBBO2KC2fqH5/+4uEXVKIYCtab2z2mSilUSyj0 dO1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=WA6EJYwr; 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 g1-20020a170902740100b0019a9611edf2si3401020pll.432.2023.02.12.19.39.07; Sun, 12 Feb 2023 19:39:19 -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=WA6EJYwr; 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 S229993AbjBMDi3 (ORCPT + 99 others); Sun, 12 Feb 2023 22:38:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbjBMDiO (ORCPT ); Sun, 12 Feb 2023 22:38:14 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 459EFCC3E; Sun, 12 Feb 2023 19:38:13 -0800 (PST) X-UUID: d2d59082ab4f11eda06fc9ecc4dadd91-20230213 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=6HhKK4J2H3bm5JiXJDgPozBzQTQbRGkWm2dygfVNSZ0=; b=WA6EJYwryjQBC+mfUQEyxmg/6y5jSCuiUiO+nAfiRYHQyTtDqCj3enbB9CcyjGvCWAYUgVA4oWCJU8/Opn20AzBWwm7Ne0ptKyGQibwsnKb1+x8TV8REN7A04d/vJaAcn9GpR2WcXZFF+p6/UafaeCiAM6HG/Gy9kEQlYffkHrw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:9d5a4863-ad76-4d67-8a13-8d324aed67b3,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:885ddb2,CLOUDID:62823cf8-ff42-4fb0-b929-626456a83c14,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: d2d59082ab4f11eda06fc9ecc4dadd91-20230213 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1244439873; Mon, 13 Feb 2023 11:38:04 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Mon, 13 Feb 2023 11:38:03 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 13 Feb 2023 11:38:03 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v6 04/12] remoteproc: mediatek: Add SCP core 1 register definitions Date: Mon, 13 Feb 2023 11:37:50 +0800 Message-ID: <20230213033758.16681-5-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230213033758.16681-1-tinghan.shen@mediatek.com> References: <20230213033758.16681-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?1757685543492074861?= X-GMAIL-MSGID: =?utf-8?q?1757685543492074861?= Add MT8195 SCP core 1 related register definitions. Signed-off-by: Tinghan Shen Reviewed-by: Mathieu Poirier Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_common.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index ea6fa1100a00..3778894c96f3 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -47,6 +47,7 @@ #define MT8192_SCP2SPM_IPC_CLR 0x4094 #define MT8192_GIPC_IN_SET 0x4098 #define MT8192_HOST_IPC_INT_BIT BIT(0) +#define MT8195_CORE1_HOST_IPC_INT_BIT BIT(4) #define MT8192_CORE0_SW_RSTN_CLR 0x10000 #define MT8192_CORE0_SW_RSTN_SET 0x10004 @@ -56,6 +57,26 @@ #define MT8195_L1TCM_SRAM_PDN_RESERVED_RSI_BITS GENMASK(7, 4) +#define MT8195_CPU1_SRAM_PD 0x1084 +#define MT8195_SSHUB2APMCU_IPC_SET 0x4088 +#define MT8195_SSHUB2APMCU_IPC_CLR 0x408C +#define MT8195_CORE1_SW_RSTN_CLR 0x20000 +#define MT8195_CORE1_SW_RSTN_SET 0x20004 +#define MT8195_CORE1_MEM_ATT_PREDEF 0x20008 +#define MT8195_CORE1_WDT_IRQ 0x20030 +#define MT8195_CORE1_WDT_CFG 0x20034 + +#define MT8195_SEC_CTRL 0x85000 +#define MT8195_CORE_OFFSET_ENABLE_D BIT(13) +#define MT8195_CORE_OFFSET_ENABLE_I BIT(12) +#define MT8195_L2TCM_OFFSET_RANGE_0_LOW 0x850b0 +#define MT8195_L2TCM_OFFSET_RANGE_0_HIGH 0x850b4 +#define MT8195_L2TCM_OFFSET 0x850d0 +#define SCP_SRAM_REMAP_LOW 0 +#define SCP_SRAM_REMAP_HIGH 1 +#define SCP_SRAM_REMAP_OFFSET 2 +#define SCP_SRAM_REMAP_SIZE 3 + #define SCP_FW_VER_LEN 32 #define SCP_SHARE_BUFFER_SIZE 288 From patchwork Mon Feb 13 03:37: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: 56014 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2156637wrn; Sun, 12 Feb 2023 19:39:39 -0800 (PST) X-Google-Smtp-Source: AK7set9j46X72RFgVNRhgmGZwDb8ppAcS3WoB0BHTsMXzlWBDA6JbEzRTMSQaBFnG35Y+fmbJIes X-Received: by 2002:a62:38d6:0:b0:5a8:c0e7:4e62 with SMTP id f205-20020a6238d6000000b005a8c0e74e62mr519386pfa.15.1676259579141; Sun, 12 Feb 2023 19:39:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676259579; cv=none; d=google.com; s=arc-20160816; b=ci1vfvV5j+JIOm+4zJdFIhPjOje2Oq5/IoUMT/s5MUw/9Yh35klfOkIDEBaqoyWrlm SDUJr8+HcODPczxcsyUXLKW+pYYF/iST2NR0kfMORi1Fu1PIQOqXlkpZHnhpgb5Xiay5 qTBoerDlggmiy5rpXgcrivu7VIyupfOAvG3TBnSgs4N2tlRD3P4Qkypmmjv5vQ0h8puM 2SO+5srhlrMr0Sqkvs5p+I9exEFT99+lazeD//cbrGou8/NwGS4kvf3CEI1HLAOv/Git bh0NVQ/2MFxVFMr0TRItBD5rWwf6yI7iF0MNCrflq6e/WCtbLuL3Kh2YXZGcrXGC1pC9 C5Ag== 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=s5+DrK5/DG5W3BlDj7d5kYpJc3FLAcebyhcFosJRTc4=; b=RaoAeDGtEs8sLBJD3shxg6dcLjYtMWUOnVvDkZ9UZOQ+rtOaUo/RP8PcTzs0C1vWhV BZm0HMw+yUwBe1eJNAMhxVIFEK/2N0/y3/TUX14XPUJXW0/pWe/q9x7AFK2bCmGK7frl +AuLpT/ruTPPWtiM81ZupkqrDwnsY91uVa1L0Lqef0+uM44DO8+E43GEbR0bC6W+8Zpb /Ap++z75crOxrws8txMf1FP15XuYw4QQFOf2eCDb5BN+vMUvsFxVkQ6XbTnjJ9/C3f0w jbmExSsaSMLiILibUn+3haA9SNscdB+56Z/dA9TVnABibqhzNvpo0BgP/JEBpn0LQkzX xSwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=p+Efe7Qk; 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 g12-20020aa796ac000000b00592d5c262aasi10314639pfk.137.2023.02.12.19.39.27; Sun, 12 Feb 2023 19:39:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=p+Efe7Qk; 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 S229919AbjBMDin (ORCPT + 99 others); Sun, 12 Feb 2023 22:38:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229867AbjBMDiS (ORCPT ); Sun, 12 Feb 2023 22:38:18 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F220DBF0; Sun, 12 Feb 2023 19:38:14 -0800 (PST) X-UUID: d2d83eccab4f11eda06fc9ecc4dadd91-20230213 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=s5+DrK5/DG5W3BlDj7d5kYpJc3FLAcebyhcFosJRTc4=; b=p+Efe7QknpsV2A/rZ1yZzedbkNN5EFTO0tUEoYbBOYu6GRLHSDP8Y+tH9oV7Nq2UeZLVx7a7pCwVbr+P6+34uwGVaqDbkcF7J6RbYDWmoK/UPdYOkyHOO7GzqWlEdlbeV6LU0Lfm+8unJQhRDwcoTAhL8+Hg1k+Rka6rCYwsg7c=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:855715a6-b37d-4a6b-a87b-b40fe2f6ac3b,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:64823cf8-ff42-4fb0-b929-626456a83c14,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: d2d83eccab4f11eda06fc9ecc4dadd91-20230213 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1526139698; Mon, 13 Feb 2023 11:38:04 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Mon, 13 Feb 2023 11:38:03 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 13 Feb 2023 11:38:03 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v6 05/12] remoteproc: mediatek: Add MT8195 SCP core 1 operations Date: Mon, 13 Feb 2023 11:37:51 +0800 Message-ID: <20230213033758.16681-6-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230213033758.16681-1-tinghan.shen@mediatek.com> References: <20230213033758.16681-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?1757685564619842112?= X-GMAIL-MSGID: =?utf-8?q?1757685564619842112?= The SCP rproc driver has a set of chip dependent callbacks for boot sequence and IRQ handling. Implement these callbacks for MT8195 SCP core 1. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_scp.c | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index d421a2ccaa1e..b92274067522 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -176,6 +176,16 @@ static void mt8192_scp_reset_deassert(struct mtk_scp *scp) writel(1, scp->reg_base + MT8192_CORE0_SW_RSTN_CLR); } +static void mt8195_scp_c1_reset_assert(struct mtk_scp *scp) +{ + writel(1, scp->reg_base + MT8195_CORE1_SW_RSTN_SET); +} + +static void mt8195_scp_c1_reset_deassert(struct mtk_scp *scp) +{ + writel(1, scp->reg_base + MT8195_CORE1_SW_RSTN_CLR); +} + static void mt8183_scp_irq_handler(struct mtk_scp *scp) { u32 scp_to_host; @@ -212,6 +222,18 @@ static void mt8192_scp_irq_handler(struct mtk_scp *scp) } } +static void mt8195_scp_c1_irq_handler(struct mtk_scp *scp) +{ + u32 scp_to_host; + + scp_to_host = readl(scp->reg_base + MT8195_SSHUB2APMCU_IPC_SET); + + if (scp_to_host & MT8192_SCP_IPC_INT_BIT) + scp_ipi_handler(scp); + + writel(scp_to_host, scp->reg_base + MT8195_SSHUB2APMCU_IPC_CLR); +} + static irqreturn_t scp_irq_handler(int irq, void *priv) { struct mtk_scp *scp = priv; @@ -453,6 +475,19 @@ static int mt8195_scp_before_load(struct mtk_scp *scp) return 0; } +static int mt8195_scp_c1_before_load(struct mtk_scp *scp) +{ + scp_sram_power_on(scp->reg_base + MT8195_CPU1_SRAM_PD, 0); + + /* hold SCP in reset while loading FW. */ + scp->data->scp_reset_assert(scp); + + /* enable MPU for all memory regions */ + writel(0xff, scp->reg_base + MT8195_CORE1_MEM_ATT_PREDEF); + + return 0; +} + static int scp_load(struct rproc *rproc, const struct firmware *fw) { struct mtk_scp *scp = rproc->priv; @@ -625,6 +660,15 @@ static void mt8195_scp_stop(struct mtk_scp *scp) writel(0, scp->reg_base + MT8192_CORE0_WDT_CFG); } +static void mt8195_scp_c1_stop(struct mtk_scp *scp) +{ + /* Power off CPU SRAM */ + scp_sram_power_off(scp->reg_base + MT8195_CPU1_SRAM_PD, 0); + + /* Disable SCP watchdog */ + writel(0, scp->reg_base + MT8195_CORE1_WDT_CFG); +} + static int scp_stop(struct rproc *rproc) { struct mtk_scp *scp = (struct mtk_scp *)rproc->priv; @@ -990,6 +1034,18 @@ static const struct mtk_scp_of_data mt8195_of_data = { .host_to_scp_int_bit = MT8192_HOST_IPC_INT_BIT, }; +static const struct mtk_scp_of_data mt8195_of_data_c1 = { + .scp_clk_get = mt8195_scp_clk_get, + .scp_before_load = mt8195_scp_c1_before_load, + .scp_irq_handler = mt8195_scp_c1_irq_handler, + .scp_reset_assert = mt8195_scp_c1_reset_assert, + .scp_reset_deassert = mt8195_scp_c1_reset_deassert, + .scp_stop = mt8195_scp_c1_stop, + .scp_da_to_va = mt8192_scp_da_to_va, + .host_to_scp_reg = MT8192_GIPC_IN_SET, + .host_to_scp_int_bit = MT8195_CORE1_HOST_IPC_INT_BIT, +}; + static const struct of_device_id mtk_scp_of_match[] = { { .compatible = "mediatek,mt8183-scp", .data = &mt8183_of_data }, { .compatible = "mediatek,mt8186-scp", .data = &mt8186_of_data }, From patchwork Mon Feb 13 03:37: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: 56005 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2156475wrn; Sun, 12 Feb 2023 19:38:58 -0800 (PST) X-Google-Smtp-Source: AK7set9rKkwMZmhjLUQA7WQS48uqjkbohk4GMhlN0hVBrcX8ACzH9scle6oDIBdBL84IklWKnqrV X-Received: by 2002:a17:90a:1a19:b0:230:7b4a:45dd with SMTP id 25-20020a17090a1a1900b002307b4a45ddmr26080981pjk.20.1676259537993; Sun, 12 Feb 2023 19:38:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676259537; cv=none; d=google.com; s=arc-20160816; b=b7UIgwTS/a/VzASjeh+289PIzhEaBf941EymgqgQX361a9BuLFqpbTOsGZM3KVN6Fy a00cLOYEBQh5592jsfi6LZcGS7564iIs8XYFGmhx5sZ8mpXXGMFONNFv5JNwdN12bwt8 dAGO1T7jk0tiDEO/7UfkWROHG95khV7fX8dkw0FNsFWYkU74I+xA6WdUtv12i0mJLIs6 +VnJUnJW217Go97jQxJpPEWkf/2spncIHQ7Sjv9jfnQJKXn5CU8CZgf/3T9NcxUL9zgA IyPb7/6n44nzmGLqgJuK9xw4f1vdRSnR5Sj3GUBVCBp9Z1c84wU9o88t60Wi5jFjvfkC wMzA== 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=2ZGn0IvDPxIog6tx3+RdLYDRVovvbUtDdnQV/mCC9lg=; b=XIhoAbIFlXilBd6vx/d8jT1U6EML6E1gZDn796PlFfpzcvxXEcYjYGnIl5bqBqcA40 1Lvw284HKzDDRmJZ9EACOpHsdH8+O8Kd5cn9460wEIpG9nxzrCZD7dK19WDgRvwm3ADG mjzidkym+XKCpNGNNcprvGkwydTqwfAMfERw7CSL9rBwssjiayZxscwJ0AX1zTxHoVKR k1pr8JF9VoGBoKbfbLgP5F5Qne/2sqAH1n+Bc8pW7rh7pF8oNP70FYWO9xjOUD7NkBI5 D47Sq7KiRWgBK0d41g90pzPA9EEIt+ESadd7tV8CgZTr5m9Nh3A/8xMp9gzmr9aUVnyI WuWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=WXmnCA3C; 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 m28-20020a63711c000000b004fb5f4bf492si8091447pgc.506.2023.02.12.19.38.45; Sun, 12 Feb 2023 19:38:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=WXmnCA3C; 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 S229910AbjBMDiQ (ORCPT + 99 others); Sun, 12 Feb 2023 22:38:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbjBMDiM (ORCPT ); Sun, 12 Feb 2023 22:38:12 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33E77CA0A; Sun, 12 Feb 2023 19:38:09 -0800 (PST) X-UUID: d2fb08a8ab4f11ed945fc101203acc17-20230213 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=2ZGn0IvDPxIog6tx3+RdLYDRVovvbUtDdnQV/mCC9lg=; b=WXmnCA3CWumHOkn1dND+mRutHiL4ogTLPtKR+xn44kGailwGCPgJ8SEiXrPXWnCrMauci2YNPuJ+RBoQMiSMvv+qQOn5emVdR5MePNvt4NsUnth0xmPnHqhkHIPGrsyl7xYjSMSjj4/8fbF7xGy5xHnct/jyn/PM71r7CjykoyU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:0993af85-7f30-4e5a-8bc5-d882843d7038,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:885ddb2,CLOUDID:7d6ead8e-8530-4eff-9f77-222cf6e2895b,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: d2fb08a8ab4f11ed945fc101203acc17-20230213 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 628862384; Mon, 13 Feb 2023 11:38:04 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 13 Feb 2023 11:38:03 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 13 Feb 2023 11:38:03 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v6 06/12] remoteproc: mediatek: Extract remoteproc initialization flow Date: Mon, 13 Feb 2023 11:37:52 +0800 Message-ID: <20230213033758.16681-7-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230213033758.16681-1-tinghan.shen@mediatek.com> References: <20230213033758.16681-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?1757685521644497399?= X-GMAIL-MSGID: =?utf-8?q?1757685521644497399?= This is the preparation for probing multi-core SCP. The remoteproc initialization flow is similar on cores and is reuesd to avoid redundant code. The registers of config and l1tcm are shared for multi-core SCP. Reuse the mapped addresses for all cores. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_scp.c | 62 ++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index b92274067522..6270c388727a 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -23,6 +23,13 @@ #define MAX_CODE_SIZE 0x500000 #define SECTION_NAME_IPI_BUFFER ".ipi_buffer" +struct mtk_scp_of_regs { + void __iomem *reg_base; + void __iomem *l1tcm_base; + size_t l1tcm_size; + phys_addr_t l1tcm_phys; +}; + /** * scp_get() - get a reference to SCP. * @@ -854,7 +861,8 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) } } -static int scp_probe(struct platform_device *pdev) +static int scp_rproc_init(struct platform_device *pdev, + struct mtk_scp_of_regs *of_regs) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; @@ -878,6 +886,11 @@ static int scp_probe(struct platform_device *pdev) scp->data = of_device_get_match_data(dev); platform_set_drvdata(pdev, scp); + scp->reg_base = of_regs->reg_base; + scp->l1tcm_base = of_regs->l1tcm_base; + scp->l1tcm_size = of_regs->l1tcm_size; + scp->l1tcm_phys = of_regs->l1tcm_phys; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram"); scp->sram_base = devm_ioremap_resource(dev, res); if (IS_ERR(scp->sram_base)) @@ -887,24 +900,6 @@ static int scp_probe(struct platform_device *pdev) scp->sram_size = resource_size(res); scp->sram_phys = res->start; - /* l1tcm is an optional memory region */ - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm"); - scp->l1tcm_base = devm_ioremap_resource(dev, res); - if (IS_ERR(scp->l1tcm_base)) { - ret = PTR_ERR(scp->l1tcm_base); - if (ret != -EINVAL) { - return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n"); - } - } else { - scp->l1tcm_size = resource_size(res); - scp->l1tcm_phys = res->start; - } - - scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg"); - if (IS_ERR(scp->reg_base)) - return dev_err_probe(dev, PTR_ERR(scp->reg_base), - "Failed to parse and map cfg memory\n"); - ret = scp->data->scp_clk_get(scp); if (ret) return ret; @@ -932,7 +927,6 @@ static int scp_probe(struct platform_device *pdev) ret = devm_request_threaded_irq(dev, platform_get_irq(pdev, 0), NULL, scp_irq_handler, IRQF_ONESHOT, pdev->name, scp); - if (ret) { dev_err(dev, "failed to request irq\n"); goto remove_subdev; @@ -956,6 +950,34 @@ static int scp_probe(struct platform_device *pdev) return ret; } +static int scp_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct resource *res; + struct mtk_scp_of_regs scp_regs; + int ret; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg"); + scp_regs.reg_base = devm_ioremap_resource(dev, res); + if (IS_ERR(scp_regs.reg_base)) + return dev_err_probe(dev, PTR_ERR(scp_regs.reg_base), + "Failed to parse and map cfg memory\n"); + + /* l1tcm is an optional memory region */ + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm"); + scp_regs.l1tcm_base = devm_ioremap_resource(dev, res); + if (IS_ERR(scp_regs.l1tcm_base)) { + ret = PTR_ERR(scp_regs.l1tcm_base); + if (ret != -EINVAL) + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n"); + } else { + scp_regs.l1tcm_size = resource_size(res); + scp_regs.l1tcm_phys = res->start; + } + + return scp_rproc_init(pdev, &scp_regs); +} + static int scp_remove(struct platform_device *pdev) { struct mtk_scp *scp = platform_get_drvdata(pdev); From patchwork Mon Feb 13 03:37: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: 56015 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2156650wrn; Sun, 12 Feb 2023 19:39:42 -0800 (PST) X-Google-Smtp-Source: AK7set9jqTPzuIeSHeGLBneYMKbtreDGHcZDvphTbp0GP+IFDHIiBNk9rZ2nkdMuSN0JSiJHm0Y0 X-Received: by 2002:a17:902:f2cb:b0:19a:60e7:9442 with SMTP id h11-20020a170902f2cb00b0019a60e79442mr10445899plc.32.1676259582197; Sun, 12 Feb 2023 19:39:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676259582; cv=none; d=google.com; s=arc-20160816; b=fTM+ecFIkyOVMTIDOUb+9p5/z31T/WW4+CFxpg2kaKMXkU6RV9ftmMvWH2LLSVywot 0QI/c1SEOTeQr4Y2w13deGnE1XA35zEukOQDnKvbZYTFxLMvGcCqqwm/GlrMdi4uBdHe 8FSRTUoYzuAPmmatu+NDRldOrJPe/5o1vQTyQaa5KXWopMyDRNTBuMt+gnAL2EjkQOT6 5wMciLXomOxIBT0j6O6iB9LFdA68654HF9rvYFtPLPw91t3RTN342hYabFTCoATy8Gmt 2cLyDdFkm9IEjPzr6njY9TZ8GnTjIqv9IuKp6cHwWfkzXNWQ6jkkPtJ/S92umhyAMXuh 4KRw== 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=b5t2Z+WOOYoxxipSNq6Ylw1/7XcqBaaI7oFa7Np+alo=; b=kJkj1/2j2qsIHzKOyfJRA9gjehZz+zoIWzHmlpYt7EpvIsz6XN2ieBG+Q8uko/nV/g ajTj2As+/Eyul4/TTue7JWEySBGgtqW8bE3WZHFt1dQu4Ve4DRQPJMOKhQmowiJRcH2z yz+Va7e7qqvVzjExXVp9NqL7vXP7gX3SOgVbOmf6fDGfl3uePDoyKP7rE4tacfF6pkAY BU6NUbkrzjmMVUNvuxZyDgSCo47/yz5QGOrjVEfo6N3WIL1IFk+H6YpHmGeTRhVi78VP QELySrkb7avZL+nKr7hZyDVf7H6IFl3bMERpvLM+xjPNkCTzxrx6A/7YV0vyW0RzcVg2 r/cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=rjAgB3YG; 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 d6-20020a170902cec600b0018542a1b588si4023877plg.196.2023.02.12.19.39.30; Sun, 12 Feb 2023 19:39:42 -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=rjAgB3YG; 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 S229947AbjBMDiq (ORCPT + 99 others); Sun, 12 Feb 2023 22:38:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbjBMDiT (ORCPT ); Sun, 12 Feb 2023 22:38:19 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BB8FCC2C; Sun, 12 Feb 2023 19:38:15 -0800 (PST) X-UUID: d2b4a426ab4f11eda06fc9ecc4dadd91-20230213 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=b5t2Z+WOOYoxxipSNq6Ylw1/7XcqBaaI7oFa7Np+alo=; b=rjAgB3YGSLuMEnPx5REFRMvB3qTnvqRO2sWISi5PHcA+VYUHc9wGxRQG4Ghx7k0CDmiXUIba4RJnjuMCGSbwe70AfsnUJ4bxHMCGRlWxuMEBco6josFjwVzNnwUMkA1ki1KNaNwQXiQAdMlJowtZZMQQvMf/CxlwMdbWZOTsF20=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:df06b904-28ba-42ae-9338-115ac54220db,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:90 X-CID-INFO: VERSION:1.1.19,REQID:df06b904-28ba-42ae-9338-115ac54220db,IP:0,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:90 X-CID-META: VersionHash:885ddb2,CLOUDID:68823cf8-ff42-4fb0-b929-626456a83c14,B ulkID:2302131138079ABHDLGS,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: d2b4a426ab4f11eda06fc9ecc4dadd91-20230213 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1390800571; Mon, 13 Feb 2023 11:38:04 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 13 Feb 2023 11:38:03 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 13 Feb 2023 11:38:03 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v6 07/12] remoteproc: mediatek: Probe multi-core SCP Date: Mon, 13 Feb 2023 11:37:53 +0800 Message-ID: <20230213033758.16681-8-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230213033758.16681-1-tinghan.shen@mediatek.com> References: <20230213033758.16681-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?1757685567559137125?= X-GMAIL-MSGID: =?utf-8?q?1757685567559137125?= 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 | 7 ++ drivers/remoteproc/mtk_scp.c | 177 +++++++++++++++++++++++++++++--- 2 files changed, 169 insertions(+), 15 deletions(-) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index 3778894c96f3..635b17676de8 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -112,6 +112,10 @@ struct mtk_scp_of_data { size_t ipi_buf_offset; }; +struct mtk_scp_cluster { + struct list_head cores; +}; + struct mtk_scp { struct device *dev; struct rproc *rproc; @@ -140,6 +144,9 @@ struct mtk_scp { size_t dram_size; struct rproc_subdev *rpmsg_subdev; + + struct list_head elem; + struct mtk_scp_cluster *cluster; }; /** diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 6270c388727a..fd054a06ea5b 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -862,7 +862,9 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) } static int scp_rproc_init(struct platform_device *pdev, - struct mtk_scp_of_regs *of_regs) + struct mtk_scp_of_regs *of_regs, + const struct mtk_scp_of_data *of_data, + struct mtk_scp_cluster *cluster) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; @@ -883,7 +885,8 @@ 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; + scp->cluster = cluster; platform_set_drvdata(pdev, scp); scp->reg_base = of_regs->reg_base; @@ -932,9 +935,13 @@ static int scp_rproc_init(struct platform_device *pdev, goto remove_subdev; } - ret = rproc_add(rproc); - if (ret) - goto remove_subdev; + if (scp->cluster) { + list_add_tail(&scp->elem, &scp->cluster->cores); + } else { + ret = rproc_add(rproc); + if (ret) + goto remove_subdev; + } return 0; @@ -950,11 +957,115 @@ 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 mtk_scp_cluster *cluster = platform_get_drvdata(pdev); + 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 mtk_scp *scp, *temp; + int core_id, num_cores; + int ret; + + cluster_of_data = (const struct mtk_scp_of_data **)of_device_get_match_data(dev); + + for (num_cores = 0; cluster_of_data[num_cores]; num_cores++) + ; + + core_id = 0; + for_each_available_child_of_node(np, child) { + if (core_id >= num_cores) { + ret = -EINVAL; + dev_err(dev, "Not support core %d\n", core_id); + of_node_put(child); + goto init_fail; + } + + cpdev = of_find_device_by_node(child); + if (!cpdev) { + ret = -ENODEV; + dev_err(dev, "Not found platform device for core %d\n", core_id); + of_node_put(child); + goto init_fail; + } + + ret = scp_rproc_init(cpdev, of_regs, cluster_of_data[core_id], cluster); + put_device(&cpdev->dev); + if (ret) { + dev_err(dev, "Failed to initialize core %d rproc\n", core_id); + of_node_put(child); + goto init_fail; + } + + of_node_put(child); + core_id++; + } + + list_for_each_entry_safe_reverse(scp, temp, &cluster->cores, elem) { + ret = rproc_add(scp->rproc); + if (ret) + goto add_fail; + } + + return 0; + +add_fail: + list_for_each_entry_continue(scp, &cluster->cores, elem) { + rproc_del(scp->rproc); + } +init_fail: + list_for_each_entry_safe_reverse(scp, temp, &cluster->cores, elem) { + list_del(&scp->elem); + cpdev = to_platform_device(scp->dev); + scp_rproc_free(scp); + } + return ret; +} + +static void scp_cluster_exit(struct platform_device *pdev) +{ + struct mtk_scp_cluster *cluster = platform_get_drvdata(pdev); + struct platform_device *cpdev; + struct mtk_scp *scp, *temp; + + list_for_each_entry_safe_reverse(scp, temp, &cluster->cores, 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; + struct mtk_scp_cluster *cluster; int ret; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg"); @@ -975,21 +1086,50 @@ 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), NULL); + if (ret) + return dev_err_probe(dev, ret, "Failed to initialize single-core scp\n"); + } else { + dev_info(dev, "multi-core scp\n"); + + cluster = devm_kzalloc(dev, sizeof(*cluster), GFP_KERNEL); + if (!cluster) + return dev_err_probe(dev, -ENOMEM, "Unable to allocate scp cluster\n"); + + INIT_LIST_HEAD(&cluster->cores); + platform_set_drvdata(pdev, cluster); + + ret = scp_cluster_init(pdev, &scp_regs); + if (ret) + return dev_err_probe(dev, ret, "Failed to initialize scp cluster\n"); + } + + return 0; } static int scp_remove(struct platform_device *pdev) { - struct mtk_scp *scp = platform_get_drvdata(pdev); - int i; + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct device_node *core_node; - rproc_del(scp->rproc); - scp_remove_rpmsg_subdev(scp); - scp_ipi_unregister(scp, SCP_IPI_INIT); - scp_unmap_memory_region(scp); - for (i = 0; i < SCP_IPI_MAX; i++) - mutex_destroy(&scp->ipi_desc[i].lock); - mutex_destroy(&scp->send_lock); + core_node = of_get_child_by_name(np, "scp"); + of_node_put(core_node); + + if (!core_node) + scp_rproc_exit(pdev); + else + scp_cluster_exit(pdev); return 0; } @@ -1068,12 +1208,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 Mon Feb 13 03:37: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: 56010 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2156574wrn; Sun, 12 Feb 2023 19:39:23 -0800 (PST) X-Google-Smtp-Source: AK7set8CvPG4D9MyIcttdkYdWyNlH36AwKNa6bxtYq/91MMK2NOJFSemadpdMe9lkUDokKZzvPYB X-Received: by 2002:a05:6a20:e489:b0:bf:1662:b2f4 with SMTP id ni9-20020a056a20e48900b000bf1662b2f4mr18750132pzb.49.1676259563072; Sun, 12 Feb 2023 19:39:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676259563; cv=none; d=google.com; s=arc-20160816; b=N8ao//NIwsSAkdPDMGjqsLcJYKf1r62r5UpYHLMHdJsP7NFZZfXCnuJjPqvZrC2Z90 I+ZEqOSmVQjbyakhNwln0tujdehe2sYybWIPltUp4U7wWERdfYNfrYw/8sCqwQ1dKuvk AUeixUpRiVJ7ZDBszVHFXNrWaBmTe0DUZyV0FVAFwu8L8mw9bgsHZna/QvDqhk3aehrc 1m+giWH+7uUaPXa/w+WbaUWkzUw/kJnArtwDi0aFp05FTpVrDfSd+PSMUczvDf8jLcNV IC/FFNSmXKFPGuTgApJKlbxH5mJa+6r6O/dmrF6osDRWAtZdb8pFIf/4wisKeM7+PVkd SbMg== 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=zTQSKAt6/ITBhx0Lj+iP18sxdOpw2FhE91TsAsCit5I=; b=Dp7YePtSrMRV2KEYUwO++caRFEiIB06FBIR++f3bCwXsEOyJ7rcZBzwGkGw+n5p4dH VPq3b4kppuqIAxBo2vYXQZka5JHctlWar3IU4JbzzfSus0a9yw2RdEZ+x1Z46grGuneK kmtILqYzAyfiQmUO1MxDSM7UA4XCr/2aoTnSSYtcpp9aMoujZgQoGi3NnRXOtvY5Ukft JHMSbATFivxtHJrHsR0m1bFcq2168WQ2g1jEp0PTy3a9VhCXNSKmlSZcC7vdSAmgOAvm 6TzqrXiogLck/TggBaOiA1uCYSgoBcygw2VFDCGa5DjeOroWZUyAz1u+q/OO7GYtf/Zl Iwsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=TWHvivKJ; 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 w21-20020a639355000000b004fb961e0592si3575222pgm.565.2023.02.12.19.39.10; Sun, 12 Feb 2023 19:39: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=TWHvivKJ; 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 S230011AbjBMDic (ORCPT + 99 others); Sun, 12 Feb 2023 22:38:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbjBMDiP (ORCPT ); Sun, 12 Feb 2023 22:38:15 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9718CC17; Sun, 12 Feb 2023 19:38:10 -0800 (PST) X-UUID: d284f8d4ab4f11ed945fc101203acc17-20230213 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=zTQSKAt6/ITBhx0Lj+iP18sxdOpw2FhE91TsAsCit5I=; b=TWHvivKJsBIJaxjqHratEqcWT2ZojOf/XxSDKIW4qPF9s+NGg0rA+4Gr/U1VCeF5gChrZ+GCoBG+qtBzscnyffXwE7jNasxBf3GpjxVlq8t4aJurBM9eatFKrgXoHKclgXjn0YWFp62HMXnfb4Lvf+nroGWpmSwaNi0NaFpeteI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:3d2f692d-31fb-4bab-88c2-aea973e5fc57,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:f4813cf8-ff42-4fb0-b929-626456a83c14,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: d284f8d4ab4f11ed945fc101203acc17-20230213 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1703861230; Mon, 13 Feb 2023 11:38:04 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) 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.792.15; Mon, 13 Feb 2023 11:38:03 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 13 Feb 2023 11:38:03 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v6 08/12] remoteproc: mediatek: Control SCP core 1 by rproc subdevice Date: Mon, 13 Feb 2023 11:37:54 +0800 Message-ID: <20230213033758.16681-9-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230213033758.16681-1-tinghan.shen@mediatek.com> References: <20230213033758.16681-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?1757685547823465199?= X-GMAIL-MSGID: =?utf-8?q?1757685547823465199?= 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 | 8 ++++ drivers/remoteproc/mtk_scp.c | 66 +++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index 635b17676de8..47c06882880c 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -116,6 +116,13 @@ struct mtk_scp_cluster { struct list_head cores; }; +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; @@ -147,6 +154,7 @@ struct mtk_scp { struct list_head elem; struct mtk_scp_cluster *cluster; + struct mtk_scp_core_subdev *core_subdev; }; /** diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index fd054a06ea5b..f1943b2457f9 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -861,6 +861,60 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) } } +static int scp_core_subdev_start(struct rproc_subdev *subdev) +{ + struct mtk_scp_core_subdev *core_subdev = to_core_subdev(subdev); + struct mtk_scp *scp = core_subdev->scp; + + rproc_boot(scp->rproc); + + return 0; +} + +static void scp_core_subdev_stop(struct rproc_subdev *subdev, bool crashed) +{ + struct mtk_scp_core_subdev *core_subdev = to_core_subdev(subdev); + struct mtk_scp *scp = core_subdev->scp; + + rproc_shutdown(scp->rproc); +} + +static int scp_core_subdev_register(struct mtk_scp *scp) +{ + struct device *dev = scp->dev; + struct mtk_scp_core_subdev *core_subdev; + struct mtk_scp *scp_c0; + + scp_c0 = list_first_entry(&scp->cluster->cores, 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->cores, 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, @@ -961,6 +1015,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); @@ -1025,6 +1080,17 @@ static int scp_cluster_init(struct platform_device *pdev, } list_for_each_entry_safe_reverse(scp, temp, &cluster->cores, elem) { + if (!list_is_first(&scp->elem, &scp->cluster->cores)) { + 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 Mon Feb 13 03:37: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: 56006 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2156492wrn; Sun, 12 Feb 2023 19:39:02 -0800 (PST) X-Google-Smtp-Source: AK7set/W661rZbp6QXuGRn1ZQ19olct2+jKoSZQ1HFH4Ngf+JHY4w5o8YrsPLecEwxxGx4O7i8N2 X-Received: by 2002:a17:90b:3842:b0:233:d7a4:9bcc with SMTP id nl2-20020a17090b384200b00233d7a49bccmr5459065pjb.32.1676259542060; Sun, 12 Feb 2023 19:39:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676259542; cv=none; d=google.com; s=arc-20160816; b=SVrY4C+Y1RoX6fkSyrPEW78Jwod/jOL1RlsqZc5rrrrzm0Dv2C/6gFgOG5CWjBWb9N bmzLUz0NtEnShC794w5nuKAOJiDqJK9qgO6gIEyfP2Fk08TLTIS1j5wQqA6FdPZ5L2Hf G0uxz+yEK3X9bultgfzw8pCYExDtIy2he//ewCDoGvQXAl7fUAYn4pVlkse+IpyD3Hi6 Vc8SKX+v6xFkmDRcRciJFkDKL4hLf+zyUaetKldYZIO7Dmxhl5xd596ZsO/cV3zHDZt9 U/7shnIFLuGmKL898cs7+KzMaIUY6bp3gPmBoJc8W+b+1l+2/zQpWlmvzxIUMrMToJiD rqpA== 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=2rYTw18c4aYuvwIDBQWVHIIYrCaRjebbMG5AwF0hk9M=; b=QzTh5ycB0xe2nEsHPtos0nl2gBn0HeiB8Ir8cY+rbFH+PZNYdumfQkLjONImB0fXZb YRUyAGOK70YHxPIwJHKp91nFmQOb/GiTG45JD/s3fc+44Ez5iPjfgah1T9K+fmH99s06 YMPIjlePP5Htg7JcTwQFycuRb3Ztz6rkIDzk45PqXrAJ7164qg6VwX/Zyd2BUt/GpvgZ iX9v1kLVZn2w8ekPb9LDwmuGzGji8OQv7LDKYvCYCjdHYGi7bpCTHZpfX5yFNeLJhkJA bSacUKopgS4HcucEWq4D1TRsjQrQ0RaXvZIVpzgDykrLFGw9/dHYC3EJXoD4bdj/afc1 TIpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=m0AOGGLU; 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 q24-20020a656a98000000b004def536009dsi10992496pgu.180.2023.02.12.19.38.49; Sun, 12 Feb 2023 19:39:02 -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=m0AOGGLU; 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 S229950AbjBMDiT (ORCPT + 99 others); Sun, 12 Feb 2023 22:38:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbjBMDiM (ORCPT ); Sun, 12 Feb 2023 22:38:12 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D252ACC1F; Sun, 12 Feb 2023 19:38:10 -0800 (PST) X-UUID: d34c24c2ab4f11ed945fc101203acc17-20230213 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=2rYTw18c4aYuvwIDBQWVHIIYrCaRjebbMG5AwF0hk9M=; b=m0AOGGLUXYpo/jqtV4F2trgq2aPJZUIWhBzIFjs1OD45vb6wtwP8lv1WnNj3BNuBQUjJgUV5vUfIoSBrLTm7JrTU1dfMTqPRvXvfm8MWTD2HC5A1iZRBEQYcEZxwnBxsqM274EBnoioMzj0aArYNHowcCrH7lerUJ8WFDPJmRj8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:ddb1a504-f2e9-4f7b-95da-a6e785fdff33,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.19,REQID:ddb1a504-f2e9-4f7b-95da-a6e785fdff33,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:885ddb2,CLOUDID:7f6ead8e-8530-4eff-9f77-222cf6e2895b,B ulkID:230213113807QI6OC0RT,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: d34c24c2ab4f11ed945fc101203acc17-20230213 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 401231307; Mon, 13 Feb 2023 11:38:05 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 13 Feb 2023 11:38:03 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 13 Feb 2023 11:38:03 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v6 09/12] remoteproc: mediatek: Setup MT8195 SCP core 1 SRAM offset Date: Mon, 13 Feb 2023 11:37:55 +0800 Message-ID: <20230213033758.16681-10-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230213033758.16681-1-tinghan.shen@mediatek.com> References: <20230213033758.16681-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?1757685525683681772?= X-GMAIL-MSGID: =?utf-8?q?1757685525683681772?= Because MT8195 SCP core 0 and core 1 both boot from head of SRAM and have the same viewpoint of SRAM, SCP has a "core 1 SRAM offset" configuration to control the access destination of SCP core 1 to boot core 1 from different SRAM location. The "core 1 SRAM offset" configuration is composed by a range and an offset. It works like a simple memory mapped mechanism. When SCP core 1 accesses a SRAM address located in the range, the SCP bus adds the configured offset to the address to shift the physical destination address on SCP SRAM. This shifting is transparent to the software running on SCP core 1. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_scp.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index f1943b2457f9..50eea0eb1fb9 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->cores, 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 Mon Feb 13 03:37:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 56008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2156528wrn; Sun, 12 Feb 2023 19:39:11 -0800 (PST) X-Google-Smtp-Source: AK7set9DIUxVSCjgfiyS/fdG1S47yzwhar+WyvSYPDyvDTidnjGFIbV12OQqmbuB4GE07934HB2X X-Received: by 2002:a05:6a21:99a4:b0:be:ed2a:b2dd with SMTP id ve36-20020a056a2199a400b000beed2ab2ddmr17021739pzb.6.1676259551019; Sun, 12 Feb 2023 19:39:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676259551; cv=none; d=google.com; s=arc-20160816; b=js1OyhXob950XD6Gy9SFb3Kw9yaI1IZ8CoSPOG5sVrfwBtjws80dOYLLAJv2w+Y+88 QSCKqRtgvMbfDrHMcZDWoqpTr63I6ZfEuZ7xdbl1I3jF36cAgQON85Ej1KF+mRfYXlbI xTXbLuQnnAdDQTrhD2tc3kO49emXoMvb1tRhkSPD5AhHoArlF/xtgQ5fGzJZme/+8VDg KsiBXkaLDkkdZPzOgrTUUW9eGltHhnAZiah9yO3NQsXeiThoHz6Y22P9Bm4KP9NMlONs LowxBNzqdpbKAfSSViWCNXJ3Biif2E7+mQKsGsjB7/D84ru3X82bJVmsotEQ7jDNMh3t uAIg== 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=83LxHn0KuLIOw5PeHj1B8xMXUMZvQjuTlPj32+8lR4s=; b=gfC9lWHE2xF3uZC3vAX4snw4t2cVjMYx1tFHtC2ictzwl4R03z0bj3zufbCA3q1uMo Ij7UtZg/dOjEcCYVdUUbbAXlFa2ae/3IHzO2uLmTzvrMUNt08WN91fhk3RMvLAB70f+6 MfH/5GMV52lI785ochwnh1530Jx4hx3PCRy3NxBi59bl/+7keO5HSYne71WARUoPtVua rESw7LOGfoMgXnplgJZ4Z6vSyPOh1x1y9aiWsXaE33O8+l/0s3DU9+ZfaAmDe7sEWo+b 4nonptGB06S1sgEihDrCy/reA9Vj1Kv5ndlYuORHoshkwrxiobkoh8A8ier4CDjKtqiz ugmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=g0kbqHpn; 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 h185-20020a636cc2000000b004f2bbbca525si10573259pgc.435.2023.02.12.19.38.59; Sun, 12 Feb 2023 19:39:10 -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=g0kbqHpn; 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 S229588AbjBMDiZ (ORCPT + 99 others); Sun, 12 Feb 2023 22:38:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjBMDiN (ORCPT ); Sun, 12 Feb 2023 22:38:13 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4E5DCDC3; Sun, 12 Feb 2023 19:38:11 -0800 (PST) X-UUID: d2b688aeab4f11eda06fc9ecc4dadd91-20230213 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=83LxHn0KuLIOw5PeHj1B8xMXUMZvQjuTlPj32+8lR4s=; b=g0kbqHpnaUsFOA8IZXkOy4a3J9mb4ejy7cYRq3D56RsiXjkpgjEH9hfczzC0yjsCIoR8Q3PuaeBgMOMw6J/r4Zg3dyo5mI277GePmBgi5vOLh+KcajfGOZAiBHskIBfmewSutttDZHx+n5pjjpHdjtEOaRpKXcPM+BDyEUbfFEQ=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:c9a8aac3-d99e-42fd-9226-f6df99171d36,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.19,REQID:c9a8aac3-d99e-42fd-9226-f6df99171d36,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:885ddb2,CLOUDID:63823cf8-ff42-4fb0-b929-626456a83c14,B ulkID:230213113807YTWK3BYU,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: d2b688aeab4f11eda06fc9ecc4dadd91-20230213 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1738861086; Mon, 13 Feb 2023 11:38:04 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 13 Feb 2023 11:38:04 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 13 Feb 2023 11:38:04 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v6 10/12] remoteproc: mediatek: Handle MT8195 SCP core 1 watchdog timeout Date: Mon, 13 Feb 2023 11:37:56 +0800 Message-ID: <20230213033758.16681-11-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230213033758.16681-1-tinghan.shen@mediatek.com> References: <20230213033758.16681-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?1757685534913795515?= X-GMAIL-MSGID: =?utf-8?q?1757685534913795515?= The MT8195 SCP core 1 watchdog timeout needs to be handled in the SCP core 0 IRQ handler because the MT8195 SCP core 1 watchdog timeout IRQ is wired on the same IRQ entry for core 0 watchdog timeout. MT8195 SCP has a watchdog status register to identify the watchdog timeout source when IRQ triggered. Signed-off-by: Tinghan Shen Reviewed-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_common.h | 4 ++++ drivers/remoteproc/mtk_scp.c | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index 47c06882880c..7cba34462ece 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -55,6 +55,10 @@ #define MT8192_CORE0_WDT_IRQ 0x10030 #define MT8192_CORE0_WDT_CFG 0x10034 +#define MT8195_SYS_STATUS 0x4004 +#define MT8195_CORE0_WDT BIT(16) +#define MT8195_CORE1_WDT BIT(17) + #define MT8195_L1TCM_SRAM_PDN_RESERVED_RSI_BITS GENMASK(7, 4) #define MT8195_CPU1_SRAM_PD 0x1084 diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 50eea0eb1fb9..ffb60190e0e3 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; @@ -1280,7 +1303,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 Mon Feb 13 03:37:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 56007 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2156519wrn; Sun, 12 Feb 2023 19:39:09 -0800 (PST) X-Google-Smtp-Source: AK7set+Vv4hfvE5bv61L6wkbPjs5HMGc5ZGEBn5fBINa33YV+LlWGppA1LowsHAR6fOtHtqsuWYO X-Received: by 2002:a17:902:da8b:b0:199:38a:afd8 with SMTP id j11-20020a170902da8b00b00199038aafd8mr27986166plx.19.1676259549377; Sun, 12 Feb 2023 19:39:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676259549; cv=none; d=google.com; s=arc-20160816; b=eNfefHeWXN2r4P8W0ynkKZ6T9aOGZZaXCnwX4AtwBXZE8Ze4Pw5jVA1983wphVDB7P 71zQ4xPo67J9pPwJ2oIJ/zSpyuwvwhBosHEbTd8KOIlw536oSxeUcIkOuRePDZng9YpW w9YyhSQbqD19Z5YlH1xW+mT6TJe6A0leTXGiX07ABwBi2gXmcGJnljIp2mUx5atlLXxd 7V0nhUrhoZozFjIWEDqN0FJAKRoC2rUyFg9E/fl8Y5eeC9WyCyUHuXZB/oOHeCciAxzv souUqZl7XDHcUgtmFfNh0stKtFIWKAyAIRjb5qC1GCQbSlZzxfj3YbmylCFQeWN2Dn5Z iOfQ== 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=Kw/laKt8Jh/wyQuS+44ClXZkURDa/heTSZaQkJO9kBU=; b=YkexmfXPA37TqNPWd+fKwYLi2AsjPcrCH1wwz9yworCpmYhCL4LL4jNja0HU0ZvvTo uXUvLHkfZRt9kSqmfcCBC63qxrMJ7dP2y+0F03HZxNuUQ2nWiL0CAuCZb73V7DgiDAW+ KkSODf9RddqPMSnp7/AjTa55s/NddZU+eglQ79ce6zBPXl2+Cj62SrjhlyQPoHYIEtMu hqcQJlwKqkuxmBlE7iV3539xyOWE1WnzuOLcVuc+uuyiKp40M0UktdLh7WBQ7qYl3hau /0ACaT+ekUM0qjMlpxfvJINjAMCXclsqcE1MKDmz5I7wdJ0vs5QNJO/6jOovKaV/8RIC ioQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Ec4UdRcd; 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 d9-20020a170903230900b00189005c48aesi12008228plh.108.2023.02.12.19.38.57; Sun, 12 Feb 2023 19:39:09 -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=Ec4UdRcd; 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 S229978AbjBMDiW (ORCPT + 99 others); Sun, 12 Feb 2023 22:38:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbjBMDiN (ORCPT ); Sun, 12 Feb 2023 22:38:13 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4F0CCDC5; Sun, 12 Feb 2023 19:38:11 -0800 (PST) X-UUID: d34eeaaeab4f11ed945fc101203acc17-20230213 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=Kw/laKt8Jh/wyQuS+44ClXZkURDa/heTSZaQkJO9kBU=; b=Ec4UdRcd/j0sY3wo+3D4u3TXYH4tv7B/bLmjhXeoeAfiSppJ+706Zj2AsJxEgqjK7aSMmVH86siPA33oWoROKLnxJXPSUnIAyjva1juBrZaZflDWtl3JlH4XKvvoX+sl1I22WP6crAKMPqENPSNOsfEJGmCmmA2uQbGfsjgO4j4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:26ebdf6f-1617-4daa-b032-540659061b8d,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.19,REQID:26ebdf6f-1617-4daa-b032-540659061b8d,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:885ddb2,CLOUDID:6d823cf8-ff42-4fb0-b929-626456a83c14,B ulkID:230213113807GU93AZUA,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: d34eeaaeab4f11ed945fc101203acc17-20230213 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 66067966; Mon, 13 Feb 2023 11:38:05 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 13 Feb 2023 11:38:04 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 13 Feb 2023 11:38:04 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v6 11/12] remoteproc: mediatek: Refine ipi handler error message Date: Mon, 13 Feb 2023 11:37:57 +0800 Message-ID: <20230213033758.16681-12-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230213033758.16681-1-tinghan.shen@mediatek.com> References: <20230213033758.16681-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?1757685533306917561?= X-GMAIL-MSGID: =?utf-8?q?1757685533306917561?= 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 ffb60190e0e3..3522f458c33c 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 Mon Feb 13 03:37:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 56011 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2156584wrn; Sun, 12 Feb 2023 19:39:27 -0800 (PST) X-Google-Smtp-Source: AK7set8ovcaKk4MlY931KATK7dS6/rsKu9ZHVNLpo/jtvzGrAechvHMYXnkJ2cTvR+sYibYdbhZb X-Received: by 2002:a05:6a20:8e29:b0:c3:3ea7:e33a with SMTP id y41-20020a056a208e2900b000c33ea7e33amr16956097pzj.47.1676259566676; Sun, 12 Feb 2023 19:39:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676259566; cv=none; d=google.com; s=arc-20160816; b=bG+alLyZZXScI5peXUUEq89JWCW9JEZpEwU7l++1Zm0nff+Ni52Qy31CTvGbTaWza+ mhWr6ZZekPxs9lMqRN88TX25Jj3jFDVnQuNXE2OcphtegqihRoa2bOK8RCuQq5BArroc iaRBCowVMEOwN9qTi2HDAMSKbUwowPXHxRnTqRvp5eqDhUSg27vf/9+mbKV8iulJ9Vpg RxXUUtdhDZMrFNhhi6a5S3XbN0PxCAl1g6/Pk4AXbNVQmdCfnSgRiEJWDLmlajNW6teA kMo/lLNslCd6HATrDXpgjnBK6NUtWF0WG6e8ECl37jSal06oDrXngANKBz3C93Hh08GR 6vjA== 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=X3B3LOPCtGznL/3zbzh8oFbKSoG5H8smIYZ9Cke0oP2/GXY5+CfzU7V6hB7z5euJp7 RCvu+euMIscWx4fR2vKyPvVW0B3MDAiEF+5tSO+YI8dU65D9d8ifdnxrKRWVAekOHS64 EDAr/HdHllrcWEkvq/teKlBHDAA/E8MRwNQkJwQr+GL3oWxH/l3jcBCAiRYwNKOfK8Mx Mk48akRpoNAaPe89wV7lJUKrOhhPPK2rt1jM2W1wQj98kdPClqtIy+oRDUAL6PmSNYTB 6nMpcCkAhXpb925logPFNK9N0utFB3JIO4KuTbMIska9rp+XX7JWYx73jmSHZsrjwyBk zx6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=XpqDAnWr; 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 d4-20020a633604000000b004fb358f497esi893884pga.436.2023.02.12.19.39.14; Sun, 12 Feb 2023 19:39:26 -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=XpqDAnWr; 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 S230020AbjBMDie (ORCPT + 99 others); Sun, 12 Feb 2023 22:38:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229909AbjBMDiP (ORCPT ); Sun, 12 Feb 2023 22:38:15 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51A81CDF2; Sun, 12 Feb 2023 19:38:12 -0800 (PST) X-UUID: d374ff1eab4f11eda06fc9ecc4dadd91-20230213 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=XpqDAnWrAhpipnsfhow9eDnZQOiLfzHaWDJS3yIMFiwiTfxEr6IyXLvdGI5BV841V8KugBfTNc73OkAfhUycama4f//Rb+CyvlQw2Sba0fgcvb76WS/zeQVFxMROY7Yc8kF9pRH6ULyLNaGUC9UYsVqghGKeCv7WB+TdFc0OB7g=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:a5463a69-7150-4ecd-ab3a-6705b0248bfe,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.19,REQID:a5463a69-7150-4ecd-ab3a-6705b0248bfe,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:885ddb2,CLOUDID:a1cd1257-dd49-462e-a4be-2143a3ddc739,B ulkID:230213113807BZSMG37V,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: d374ff1eab4f11eda06fc9ecc4dadd91-20230213 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1131588885; Mon, 13 Feb 2023 11:38:05 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) 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.792.15; Mon, 13 Feb 2023 11:38:04 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 13 Feb 2023 11:38:04 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v6 12/12] arm64: dts: mediatek: mt8195: Add SCP 2nd core Date: Mon, 13 Feb 2023 11:37:58 +0800 Message-ID: <20230213033758.16681-13-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230213033758.16681-1-tinghan.shen@mediatek.com> References: <20230213033758.16681-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?1757685551409429082?= X-GMAIL-MSGID: =?utf-8?q?1757685551409429082?= 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>;