From patchwork Fri Feb 10 08:59:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55330 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp840294wrn; Fri, 10 Feb 2023 01:02:02 -0800 (PST) X-Google-Smtp-Source: AK7set8VEbUOqqDvUeCE+Lo10qnqr++m6//ArPkQn9bTvsYkgA0Nkngdn2Au5Q6oGhQiZm2uKQrR X-Received: by 2002:a17:90a:1b0c:b0:233:aaf1:1da7 with SMTP id q12-20020a17090a1b0c00b00233aaf11da7mr1347244pjq.32.1676019722199; Fri, 10 Feb 2023 01:02:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019722; cv=none; d=google.com; s=arc-20160816; b=pccEVGfXB4ubf/4lNZ6JysawKAgiN5TiIb7Qw42OVv7Lc3H27va01aqmPVMyJmHO1R tf9R1jBnZvLZs2O31gXMfuWixVm8FG2vkRYTaJ0nzDsxNYpDs3Ti/JGPNb3z7AHgZ0QI CQTECgGe8U83Mm6s9B2NjxlLyovAbivK2Glyfe42d7SnUGhZdvLfrfp6n9Asxu+d2tE5 qo4xsguOtrNuAKH1KETmO5a+jKkSlwq1RrFdgUkpX/LEv0o6nDVdFFhZ03vJkH2w4NST vFL9W00cfEs1UIw88J3/AuZGdTmQr5pA8wPijx8G31cWaFuGKdjA1DMhjokcQ2INA3Vn tKQg== 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=F+fkkazjXsKDKFeXK9xVp0xW6jvWfBA291K1dw8igE+nKXOZ2wdGOKUbbzitdSEso4 kL/eFNu501E5WrQaEnLDZ36ZZd5czsfGVANWtfrQjoKH8QFlMh4onzQgYFup4Ufsw1qm 3nFI/KVbA8LfigQX8Fio5lAM3kjcSZ18lGBSC3isyGb97tFC7sb4gUcPnu9grQCjArt7 IC8tCY2Awuv4D55cIiTch9dXmn3QygBb+5ipdqOLu5wgcRlzECLzOC/Oj3En3WCSke9s 3gWm/WzYuGm2XHTlAFYr7xydDOnWhf+uPz867gnudPgFXLbfrpsMc+I+BsDTriDFSald FduQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="Tj0/xaco"; 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 n29-20020a638f1d000000b004f23305262bsi4355243pgd.14.2023.02.10.01.01.47; Fri, 10 Feb 2023 01:02: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="Tj0/xaco"; 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 S231804AbjBJJAH (ORCPT + 99 others); Fri, 10 Feb 2023 04:00:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231704AbjBJI7n (ORCPT ); Fri, 10 Feb 2023 03:59:43 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 160D24902F; Fri, 10 Feb 2023 00:59:40 -0800 (PST) X-UUID: 3d7efd96a92111eda06fc9ecc4dadd91-20230210 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=Tj0/xacoHU/cXBilhUhqJ0htlbyUo4TgYBGqpsYTfsc74Mn4Y4SJ20bMoL+7p9QYFwvhDIHEp+P3JzjcXlwkV1+82l3xv9p9Zm4nSmU9jV/6Q8SjU7+VOwqOeD3fFiSZJ6PrLSCtThrchgf8TAOiRWrOyMln5NCAV5UPhsP6GcA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:7c2794eb-9bf6-4ca0-9c06-18f4dbd60067,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:0ef8e556-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,NGT X-UUID: 3d7efd96a92111eda06fc9ecc4dadd91-20230210 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 1870624459; Fri, 10 Feb 2023 16:59:34 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 10 Feb 2023 16:59:33 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:33 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 01/12] dt-bindings: remoteproc: mediatek: Improve the rpmsg subnode definition Date: Fri, 10 Feb 2023 16:59:20 +0800 Message-ID: <20230210085931.8941-2-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-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?1757434055817527162?= X-GMAIL-MSGID: =?utf-8?q?1757434055817527162?= Improve the definition of the rpmsg subnode by assigning a distinct node name and adding the definition source of node properties. Signed-off-by: Tinghan Shen Acked-by: Rob Herring --- .../bindings/remoteproc/mtk,scp.yaml | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml index 895415772d1d..271081df0e46 100644 --- a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml +++ b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml @@ -58,6 +58,18 @@ properties: memory-region: maxItems: 1 + cros-ec-rpmsg: + $ref: /schemas/mfd/google,cros-ec.yaml + description: + This subnode represents the rpmsg device. The properties + of this node are defined by the individual bindings for + the rpmsg devices. + + required: + - mediatek,rpmsg-name + + unevaluatedProperties: false + required: - compatible - reg @@ -89,21 +101,7 @@ allOf: reg-names: maxItems: 2 -additionalProperties: - type: object - description: - Subnodes of the SCP represent rpmsg devices. The names of the devices - are not important. The properties of these nodes are defined by the - individual bindings for the rpmsg devices. - properties: - mediatek,rpmsg-name: - $ref: /schemas/types.yaml#/definitions/string-array - description: - Contains the name for the rpmsg device. Used to match - the subnode to rpmsg device announced by SCP. - - required: - - mediatek,rpmsg-name +additionalProperties: false examples: - | @@ -118,7 +116,8 @@ examples: clocks = <&infracfg CLK_INFRA_SCPSYS>; clock-names = "main"; - cros_ec { + cros-ec-rpmsg { + compatible = "google,cros-ec-rpmsg"; mediatek,rpmsg-name = "cros-ec-rpmsg"; }; }; From patchwork Fri Feb 10 08:59:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55328 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp840014wrn; Fri, 10 Feb 2023 01:01:32 -0800 (PST) X-Google-Smtp-Source: AK7set/siQQGlk9+JQ/cElATv4DX4qevPTN38KRC9Jfp6WVhakSjqQa4sMUooOgZUCw5MpXTelBS X-Received: by 2002:a05:6a21:3389:b0:bc:c86a:f60f with SMTP id yy9-20020a056a21338900b000bcc86af60fmr16734377pzb.54.1676019691964; Fri, 10 Feb 2023 01:01:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019691; cv=none; d=google.com; s=arc-20160816; b=dpeS54JFpzyEG4tZg0h01LT4chi/+u7MtXxj0uOtr1bNl2ZYXX6Uo3Z/LhThA9XNb2 ndPbHeQLm/RkRKoBsQzfRos/gnCnM8J2fwjWvx2UUkaNPrOd1vUkwP3ElqNuoWeA/1VC IWwHwGqgRKviUbF8KNRHkuLioiPMiOsFdfh6iE/4vtqEfv3yJZcqQNImbgO524sJvVMy cyqyRcYaBuxuXVbCfDj/rEZkSlAukE5vZxl2o3c/Na+pD8xCmXAWrhY4If8kc/LbMyNg TkdCq4zKZ1iZZyatmr+w4SHaE78V0RjLRvpsorcu7Radg8twKqpW4736P5rRvIhRWJup sR3A== 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=oQ1bNeIenWJmL+rqJAotRu2st/6oG95QVlIWK3KW0Dw=; b=xqDlzmDEv7BYOQjrQQk0bSwL6P0PMllFnvH0Zw0mDuNYT+79lbWxr9cBsI+8l4PhcW 9UPeUUZONWNLGBZkf7TSv9U2AgXO/h9N0Stk19baZDY1mmeB5TWm42VmJ77mCuj8EITQ 7sdar/qKbEtVPG3eQrEOMpDzJGhR/1+HMtNXLopkpfOJZKrdSUGdL7RdgmijIE6WBvYD 0PB6Cad4rggjJWgPJbGeEzOGGCKvVmpnXYjJwXRVq5QLCJejKMiS0lP5A+suXhXz2KTY 2EBQGISgkeHrgAIhMjMFD6U/BhMXaIBQgAqlGlTuEFM/bp2BRK6FjYk/Jp+mURmr1+E5 ET4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=oIQOHXou; 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 i127-20020a639d85000000b0049e0bab8d55si4344880pgd.133.2023.02.10.01.01.19; Fri, 10 Feb 2023 01:01: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=oIQOHXou; 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 S231733AbjBJI7z (ORCPT + 99 others); Fri, 10 Feb 2023 03:59:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231716AbjBJI7m (ORCPT ); Fri, 10 Feb 2023 03:59:42 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20250582BC; Fri, 10 Feb 2023 00:59:38 -0800 (PST) X-UUID: 3d963cb8a92111eda06fc9ecc4dadd91-20230210 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=oQ1bNeIenWJmL+rqJAotRu2st/6oG95QVlIWK3KW0Dw=; b=oIQOHXouNlCmLORe4VMeNP/Cec8CVEx1bdJGAmYr2flM2bHckH+LlZ0WD20VGBo+7zrewhiPgBXFyhUTrlbc7x2NJdkygcRopD+bMHjkLtOPZc42W9g+vz7Hyt/r9ASwwxcC7KeiO8vhqMoRCfw+k7LS20AdHbvNrN/Ja+6igQA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:766afc4a-0329-431a-a89f-49d88c896677,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:8aa6808e-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,NGT X-UUID: 3d963cb8a92111eda06fc9ecc4dadd91-20230210 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1224184379; Fri, 10 Feb 2023 16:59:35 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 10 Feb 2023 16:59:33 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:33 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 02/12] arm64: dts: mediatek: mt8183-kukui: Update the node name of SCP rpmsg subnode Date: Fri, 10 Feb 2023 16:59:21 +0800 Message-ID: <20230210085931.8941-3-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-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?1757434024160674172?= X-GMAIL-MSGID: =?utf-8?q?1757434024160674172?= 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 Fri Feb 10 08:59:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55336 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp840926wrn; Fri, 10 Feb 2023 01:03:13 -0800 (PST) X-Google-Smtp-Source: AK7set82VSL1Rk+EI3QQgeNw5gEw5s5EyGCifCVIKQsA75kQecua2ZbH25bawzg3CM97+xpLI7eP X-Received: by 2002:a17:902:e5c7:b0:196:4643:e1e7 with SMTP id u7-20020a170902e5c700b001964643e1e7mr15954876plf.30.1676019793011; Fri, 10 Feb 2023 01:03:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019792; cv=none; d=google.com; s=arc-20160816; b=n6QNULEZR0sx+fBJwvwxHehkQgGEAtxivC6zz91gypMU0yLDqtC86jXDGzY0EUGmXP sahOZXlSEM+HTvPYUtIAs1a1iRApoybhvjKancLIYfFwrhAY7DiYKgq9B9V72V7uKagp h1/6zvy7nNW5gUq1B7x/16TWz1gnHA+dxIU23R36tMFW+uFkJTUlYXPjvdrEeBXTuVjO DKNF/lQKiDhK4H55QE2QM/6KRqZjN/352tpjzWsYBs9xZgLiCsrYeO6fMIWUVZmh2Agh 2Umbp8tzQfcJW2lqUVEr40D93PMdXhyWBnDCs3j/hPlaMVolnqdDlA+fJuKyk7RkBiCi OS+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=atQWRcSek6PWJlT7aE+2JjkFkwP8wvCtOypkshFnQlU=; b=xtPm2hzIaWd+K7+cJgqjfLkBj90URWBZAu9a5TlLqsoQdoo8dOzkY8t30MEggtgJ4v 5JpTEj/8VFAN8TMGWuQ/RAE785bD3SayilyfrBqNOsIxLpJzdh5XwZi/fQCOHgLdbpB7 AcYJMf2IVTZFTLe3L0EvB8vC+PgFKAdHMoQIoIQWs7hxTRa0yDw0xCOvmLVMWqnQE44p wrOhJyBFHfUwDFBGdo4b4HNka6Sv4xkjHIvX+KHDKeHgyA7bzUOlInZkJ22aWzk2JbsL dKbSo0ir77FUwZLG6czZTniPiDZY6pANiUTyztn49wH6XuOrWWCCBRl45XJgsTNkS79c +f0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=XMfXwWwx; 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 x14-20020a170902ec8e00b001992451fe9csi4443222plg.297.2023.02.10.01.03.00; Fri, 10 Feb 2023 01:03:12 -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=XMfXwWwx; 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 S231846AbjBJJAc (ORCPT + 99 others); Fri, 10 Feb 2023 04:00:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231745AbjBJI7x (ORCPT ); Fri, 10 Feb 2023 03:59:53 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB2EE5AB21; Fri, 10 Feb 2023 00:59:44 -0800 (PST) X-UUID: 3db18310a92111ed945fc101203acc17-20230210 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=atQWRcSek6PWJlT7aE+2JjkFkwP8wvCtOypkshFnQlU=; b=XMfXwWwxopOZXxBO3S1/K1WDriu9rWs0LQFVfYAGrA/1YTqpjv+e/1CSOFhjIgw72eVD5myxs456s4i5KfTDWRoYipca7+kfwsJlhvPwhRe/3257wUbcBOEyA3ackfXQWchbHPqNcnSr+N5th9TuFkTtlaoqMvOSaIDYacVP23M=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:f9706bfb-5b3a-43aa-9c54-0e4ca894a52b,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:46f8e556-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: 3db18310a92111ed945fc101203acc17-20230210 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 605451654; Fri, 10 Feb 2023 16:59:35 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 10 Feb 2023 16:59:33 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:33 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 03/12] dt-bindings: remoteproc: mediatek: Support MT8195 dual-core SCP Date: Fri, 10 Feb 2023 16:59:22 +0800 Message-ID: <20230210085931.8941-4-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-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?1757434130542195424?= X-GMAIL-MSGID: =?utf-8?q?1757434130542195424?= 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 Fri Feb 10 08:59:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55329 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp840133wrn; Fri, 10 Feb 2023 01:01:45 -0800 (PST) X-Google-Smtp-Source: AK7set8ZZW82QeYUUoWQTEQG4tirjrWydLuvr8El/GNL1LnGijG5oVDz84IvqK8uJMOrATDpUivu X-Received: by 2002:a05:6a20:3d8e:b0:c0:5c7:73b5 with SMTP id s14-20020a056a203d8e00b000c005c773b5mr16955445pzi.9.1676019705016; Fri, 10 Feb 2023 01:01:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019705; cv=none; d=google.com; s=arc-20160816; b=G+8maTxyhMvR4kL67ga61d9xptu0IShQe4Uzz5WXCVCHJqfCzecJQP4sewnCppfyLw slptBYAVJnWust4K1X4JBk5awgDI/c70TwtxYgOK7rcKjKVM+Rrx1qOHGswf3ZzcExhz ecJkX75QL8kZXqGnb9qYusSAsfNms0hlpx7i4fNEciD6dQ7hL8xQ7o7igIxkLgdhduLc baUmzcky4crhIbp2c80/g6A7CYg29FOoIJJFytXmSx8PD/lh32VBvB5E7fsS2vN8Xw4z 6BF6DJTYxgXgGsWqfFdAlLI0bAV3SolYdfU+Wi+Jw4dR/w9+fmFGAYgKzGOmmkIBAQc5 isVQ== 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=vd6vHKQUgnqVE7qwUoCvCkDVe4/NSAWlXeBiZVvVTjahGyAUcCX1B9i8/4QHsKYYzm NV8nLy1cHNlWYfMvPesorZ1FIkrLNoPOvRZRrGQ7cvlgIkyQxu1nF8lxXvVhTlG0SsUs G2PQq3BbQFDLGBBSVUB/JrrBzlbxMU8w1d0jS2saveb5Wi0cdqmENMDUkI+rW2n64SDp 6sDgE+H3QBtUTfbhC+EPKAJxcLQrYz319xg/zQSU1zNx1tENEoXopkF/1wQkriPFwEcH 6YvrAIKC9RMVgZciZZFXr7DJbjdOR0vj2p0pflqmUC7fUOjN8XhuMC326A1w7erf4i24 4rNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=tytu3w6v; 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 y187-20020a638ac4000000b004e55e26a97bsi4297985pgd.19.2023.02.10.01.01.30; Fri, 10 Feb 2023 01:01:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=tytu3w6v; 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 S231732AbjBJJAC (ORCPT + 99 others); Fri, 10 Feb 2023 04:00:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231488AbjBJI7n (ORCPT ); Fri, 10 Feb 2023 03:59:43 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD8D755E64; Fri, 10 Feb 2023 00:59:39 -0800 (PST) X-UUID: 3dbab8e0a92111eda06fc9ecc4dadd91-20230210 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=tytu3w6v3mv/Ojr7fO2DnKtdAys/JYCQ7905FDYsVkOIc8wl0+qKqiwFo+dMWqWTuun4ydYQw0EIGCiXv9r2bvLgvW8l59JZm8hH4ATWaeq16hDM5JRN0h9mexdt2JM11QQgVegh+EQxvVLNVQLV614IlERdfgLllhI0G1gvmYM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:3489b9f0-ce9a-42ee-bfe0-081fdd7f0fc5,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.19,REQID:3489b9f0-ce9a-42ee-bfe0-081fdd7f0fc5,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:885ddb2,CLOUDID:0ff8e556-dd49-462e-a4be-2143a3ddc739,B ulkID:2302091540508PDLCMUG,BulkQuantity:8,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:41,QS:nil,BEC:nil,COL:0, OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 3dbab8e0a92111eda06fc9ecc4dadd91-20230210 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 1879244574; Fri, 10 Feb 2023 16:59:35 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Fri, 10 Feb 2023 16:59:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 04/12] remoteproc: mediatek: Add SCP core 1 register definitions Date: Fri, 10 Feb 2023 16:59:23 +0800 Message-ID: <20230210085931.8941-5-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-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?1757434038328127212?= X-GMAIL-MSGID: =?utf-8?q?1757434038328127212?= 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 Fri Feb 10 08:59:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55334 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp840711wrn; Fri, 10 Feb 2023 01:02:46 -0800 (PST) X-Google-Smtp-Source: AK7set/kUOMomgFBjsmyPoidp6at0qjTBEpI3IuSebf0SZXnnfiC75uhe4oT/2eipcSsL5Lec4X9 X-Received: by 2002:a17:902:ec89:b0:196:1c45:6fc8 with SMTP id x9-20020a170902ec8900b001961c456fc8mr16916992plg.60.1676019766047; Fri, 10 Feb 2023 01:02:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019766; cv=none; d=google.com; s=arc-20160816; b=yLLlBZZSyDlTQs5F0kZaIsrmLo/CS5kbybsTp9JDNOBvyE8OFDVBpkEM0/PlQyENeF Z+tJO1vYYS4EzvBmrtdjXtil6vc+55TAzvdKeSzUKP2058EbDP2r+Ln5RJ5qycqwYfaR 0aPWKwISpurOaoHh7C+gdEcKosW7dvo6eQogAymA/xsl/EAMO/B4qndwtZhWqTvjScJ+ WNB+NiGvbrTNUsW3fDzH3TwEZvE7bYd2mLGgEXm7ZkixWWqfrA8si27UzYb/BgiJaKCY /5tkd/3UoYV+bRsPcnb/nrS92TqBu9JbqGXYxu6cbOI2EagJk1KPzgE/zUHA2mUZrBAi o3iA== 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=wUYyX0V0QPQszWBd/a1KeFlUCf36gvpgVElwRet7fLqGf+1dB0oKUcBR73JKUhAmPU UMcGxEkWdLKwp2PV4yLQIg4oFx5lv5KurPutpAcyY3yM/3oHDuUUCqH9O/MpoZvW+JNT UypNJINJHLM7jqji0g/oblB1kZaR4QjKuMhQGi3XvBBIFvjryOvp2i7ag1pWzxTpkVbE 1OKmqhqvrRsf41613jVlfoKcNl3OBP/T7biUMJ0hdaYNq/JKqH4EgFHQXef6bFnbxIi/ h8LB+jGj6FNpMtPYa0kVs1db3TUBA9osmdjgQn5GrJh3pG0fdG8+wCf+bvK/MRPWpkC5 Abtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=opJi3yYI; 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 s16-20020a170902a51000b00198e6389b13si3722079plq.408.2023.02.10.01.02.33; Fri, 10 Feb 2023 01:02:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=opJi3yYI; 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 S231840AbjBJJAX (ORCPT + 99 others); Fri, 10 Feb 2023 04:00:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231727AbjBJI7r (ORCPT ); Fri, 10 Feb 2023 03:59:47 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D18644A1D2; Fri, 10 Feb 2023 00:59:42 -0800 (PST) X-UUID: 3d984314a92111eda06fc9ecc4dadd91-20230210 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=opJi3yYIiuC9zNec1WMhSTnMKuUfvwHbcw4FsXXTC22hAyTUydasOpipcFIeocN2HPyntpwT4ohVGKpsZN4FojFBeVgNsXB0W8CRhaifJ9zUQ4YgyszfOSP6N4IWm25Cidtoqe627pKf5dbfQkTPGI5W7t0vnDAY4nixDtoObQ0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:81c063e3-f2c7-408c-a1db-b26fdb79a106,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:90a6808e-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: 3d984314a92111eda06fc9ecc4dadd91-20230210 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1089328123; Fri, 10 Feb 2023 16:59:35 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 10 Feb 2023 16:59:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 05/12] remoteproc: mediatek: Add MT8195 SCP core 1 operations Date: Fri, 10 Feb 2023 16:59:24 +0800 Message-ID: <20230210085931.8941-6-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-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?1757434102349639929?= X-GMAIL-MSGID: =?utf-8?q?1757434102349639929?= 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 --- 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 Fri Feb 10 08:59:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55337 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp840951wrn; Fri, 10 Feb 2023 01:03:17 -0800 (PST) X-Google-Smtp-Source: AK7set8dIyfxLV9VKPOyo/ajBOqZFt/4GS7WsskEJNqSdqlT7eoxamVM1wHV6FAY2hWp2cENOPxB X-Received: by 2002:a17:90b:3904:b0:22c:b2bf:e462 with SMTP id ob4-20020a17090b390400b0022cb2bfe462mr16437550pjb.34.1676019796886; Fri, 10 Feb 2023 01:03:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019796; cv=none; d=google.com; s=arc-20160816; b=LmGCqzrriG8DIblMc6a54QUIWL2VT7+magbJG55kXWD0uKZd7ZR0pLGOY8jBW2hTIp GBxFK7cHJetxr4mqI7guuDuzPDwEKKXx4uWRriZrOs9a+sMgTA7q0ebckvBlmOuyK4kT nEWqErWVXGM4A1CLFUSJ1dklZwFZR6mU+rRWnzC1IB0USrSZw+OgSbQOWt5XCq/D5RBP FQMNQ/2opFZmgoRYcBjISm5b0d4AYmMKgRgpwvp3XqSAh2bhBvqZKc0IIztlB4+OwIVX udRHHKi/Qx4NlbwZafQPIbK+GArRYcaGDDkSrRUQ5JaWij9UeqtOua7/gdbK85bxOUoq aNVg== 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=H68qhvncPP+HdKEnCKvBBC0ghvXSNegsYN2bO0sXAqU=; b=mfyNWKVO2ucQ7jFmnBNGt0CcpWWsivex/vKKPDwsC52d3uk4CPFg/PzlgIk4PmGIh/ PJljekSPR+N7om5cCs+Hq1G4xROa9sro7DP8Xf/t42Yepbkvqbyv+OKI06idmtQVYbJ6 xxnTOdH/bm8l9vA6sVm4y7gEH3CzLLJ2ZCH54L9xAfcOlJB/rpBbFrY0scNEXIiGe/d2 Kr6O7n4rUxwiiVZnlGgT0vDsOyAP4BovKb1+Nc/QN7Cdt2u8P25ZMqdUvwyb3ICdma8p B12lBUZPvSyFCWWHO2Vy8Wppng73k04wU4vwpNEhOWZvfWgwKuqsa3ztwEJPBEPlnTty RgHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=jV3XI9j6; 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 n29-20020a638f1d000000b004f23305262bsi4355243pgd.14.2023.02.10.01.03.04; Fri, 10 Feb 2023 01:03:16 -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=jV3XI9j6; 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 S231864AbjBJJAg (ORCPT + 99 others); Fri, 10 Feb 2023 04:00:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231736AbjBJI7u (ORCPT ); Fri, 10 Feb 2023 03:59:50 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF3FA1556B; Fri, 10 Feb 2023 00:59:43 -0800 (PST) X-UUID: 3db3fb7ca92111ed945fc101203acc17-20230210 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=H68qhvncPP+HdKEnCKvBBC0ghvXSNegsYN2bO0sXAqU=; b=jV3XI9j6mWzOuOcB90wclW0OcTnHld6GuDRetU4YAjFWxLOElhxjdUpYTGSdPxS0w1nI7cPtegjBo4cHSQMHIHje0OZtkQ+5zfCHLmMLLbKHLcuuE/bRecZwTZPfyGqX/Fk+RlVX3HeyOA70C2L8VAzQA7h+Ylk5hz24d7YV8S0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:e638d8c7-a7f0-4a60-9d28-86f5b0c01d10,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:c5a6808e-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: 3db3fb7ca92111ed945fc101203acc17-20230210 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 2102634611; Fri, 10 Feb 2023 16:59:35 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 10 Feb 2023 16:59:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 06/12] remoteproc: mediatek: Extract remoteproc initialization flow Date: Fri, 10 Feb 2023 16:59:25 +0800 Message-ID: <20230210085931.8941-7-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-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?1757434134308459810?= X-GMAIL-MSGID: =?utf-8?q?1757434134308459810?= 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 --- drivers/remoteproc/mtk_common.h | 7 +++++ drivers/remoteproc/mtk_scp.c | 55 +++++++++++++++++++++------------ 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index 3778894c96f3..20c1a90be77d 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -112,6 +112,13 @@ struct mtk_scp_of_data { size_t ipi_buf_offset; }; +struct mtk_scp_of_regs { + void __iomem *reg_base; + void __iomem *l1tcm_base; + size_t l1tcm_size; + phys_addr_t l1tcm_phys; +}; + struct mtk_scp { struct device *dev; struct rproc *rproc; diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index b92274067522..898039879142 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -854,7 +854,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 +879,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 +893,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 +920,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 +943,34 @@ static int scp_probe(struct platform_device *pdev) return ret; } +static int scp_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct resource *res; + struct mtk_scp_of_regs scp_regs; + int ret; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg"); + scp_regs.reg_base = devm_ioremap_resource(dev, res); + if (IS_ERR(scp_regs.reg_base)) + return dev_err_probe(dev, PTR_ERR(scp_regs.reg_base), + "Failed to parse and map cfg memory\n"); + + /* l1tcm is an optional memory region */ + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm"); + scp_regs.l1tcm_base = devm_ioremap_resource(dev, res); + if (IS_ERR(scp_regs.l1tcm_base)) { + ret = PTR_ERR(scp_regs.l1tcm_base); + if (ret != -EINVAL) + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n"); + } else { + scp_regs.l1tcm_size = resource_size(res); + scp_regs.l1tcm_phys = res->start; + } + + return scp_rproc_init(pdev, &scp_regs); +} + static int scp_remove(struct platform_device *pdev) { struct mtk_scp *scp = platform_get_drvdata(pdev); From patchwork Fri Feb 10 08:59:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp841088wrn; Fri, 10 Feb 2023 01:03:30 -0800 (PST) X-Google-Smtp-Source: AK7set+de7uN27JRbRMthReFz1Tz4AXdT/xyv3rjzDufIboH6TILQugY6L7q1MmWxDRFmEOO3oW2 X-Received: by 2002:a17:90a:195e:b0:22c:169b:ec4c with SMTP id 30-20020a17090a195e00b0022c169bec4cmr16739903pjh.26.1676019809741; Fri, 10 Feb 2023 01:03:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019809; cv=none; d=google.com; s=arc-20160816; b=JFNQGBLHaL6LJ/U71OlpfvC440le7jE5zc6DT7K17uH3YAjRRZJlWipiF9M98LIVh4 d67yw5sXdffadszGzhDVMpmpUQoV8Uu6vaEuLdzf22nVBS6tPszPbpS45kk6qPvRqM0b M3BSN7TZxXDM6KUh6WHuZVgtjLpONicBHxwS0WRJcavuxxKZ4ZFkHLNXeES23FHEEsSw gxgjwrW43dkbW4Lp8oDc6fIPt3UjxHvH/IQuCIp8I/OSYYqxfe1gaH9pxKfIOigCoyHY 3JNviMdjDqw/6ehyMoJCJpIoU5IhMzVVjswowMqGe1rL4w/jrputKJvRHQdVqf8NXlLJ 8T/Q== 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=I/t7o9vxSUmLvyMzMiYdz9MBzb9a1EFalr74Qs+fjQ4=; b=ZOSQ9n4Ebt3bBssx6nxh3zcBY9GpbnASW2B3/W9riZgpD5aF21NIkIp/VdxK5w4AMy ttsOAx6bIxxSUEBQDER9ec73lbnhUPOGTcZVKU6Zl+XNCc5tNCvQT71ed2R2gk6ci2ro /rFqgmRSNEYyo2vI34QwLgGiMM5uJP9FaXSNojEnhfoKFXyrEWjf69jHMi9ZGWit20Dr afORrYyqQMC5bGDj81Qp+I2K8AQEnLJGfU6Zyp4P1B+Q85On+bGIvI568KXI/2qA8Lp5 HR4dLlbHAN6wXj/oOAGtv2fp58nW5ByW7wlpvmBTEcGtwKKN3a4vkGw0MCQJjWc+S0Dn sBGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=s2tygVlU; 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 fz15-20020a17090b024f00b002299b3cd7acsi7330325pjb.83.2023.02.10.01.03.17; Fri, 10 Feb 2023 01:03:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=s2tygVlU; 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 S231736AbjBJJAk (ORCPT + 99 others); Fri, 10 Feb 2023 04:00:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231723AbjBJI7r (ORCPT ); Fri, 10 Feb 2023 03:59:47 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B67CAAD08; Fri, 10 Feb 2023 00:59:42 -0800 (PST) X-UUID: 3d816964a92111eda06fc9ecc4dadd91-20230210 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=I/t7o9vxSUmLvyMzMiYdz9MBzb9a1EFalr74Qs+fjQ4=; b=s2tygVlU76kBvpp4byAsj/e9t2wJYPDHgoPU+U5tJ+4l1fs9GJ4YpqBsrMwXWTsp2DGMzDQmR63v/MEdFjlUARGSn0VDoeabfQY8H3tnYrN22B4BvczEctD+AoCiIgoA7CJKPfui5Yj4m7kjSekMMC9+sMew2zLLUD3lwJP45Kw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:c148a871-bcc4-4ff7-bc1f-9033a24b8bd0,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:b5bc0ff8-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: 3d816964a92111eda06fc9ecc4dadd91-20230210 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 373856477; Fri, 10 Feb 2023 16:59:34 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 10 Feb 2023 16:59:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 07/12] remoteproc: mediatek: Probe multi-core SCP Date: Fri, 10 Feb 2023 16:59:26 +0800 Message-ID: <20230210085931.8941-8-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-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?1757434147559789457?= X-GMAIL-MSGID: =?utf-8?q?1757434147559789457?= The difference of single-core SCP and multi-core SCP device tree is the presence of child device nodes described SCP cores. The SCP driver populates the platform device and checks the child nodes to identify whether it's a single-core SCP or a multi-core SCP. The resource structure of the multi-core SCP is a list of remoteproc instances which is different to the single-core SCP. The corresponding resource releasing action is based on the type of SCP. Signed-off-by: Tinghan Shen --- drivers/remoteproc/mtk_common.h | 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 20c1a90be77d..0b2c4bbb55f0 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -119,6 +119,10 @@ struct mtk_scp_of_regs { phys_addr_t l1tcm_phys; }; +struct mtk_scp_cluster { + struct list_head cores; +}; + struct mtk_scp { struct device *dev; struct rproc *rproc; @@ -147,6 +151,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 898039879142..8e2a82174e5f 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -855,7 +855,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; @@ -876,7 +878,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; @@ -925,9 +928,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; @@ -943,11 +950,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"); @@ -968,21 +1079,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 init 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; } @@ -1061,12 +1201,19 @@ static const struct mtk_scp_of_data mt8195_of_data_c1 = { .host_to_scp_int_bit = MT8195_CORE1_HOST_IPC_INT_BIT, }; +static const struct mtk_scp_of_data *mt8195_of_data_cores[] = { + &mt8195_of_data, + &mt8195_of_data_c1, + NULL +}; + static const struct of_device_id mtk_scp_of_match[] = { { .compatible = "mediatek,mt8183-scp", .data = &mt8183_of_data }, { .compatible = "mediatek,mt8186-scp", .data = &mt8186_of_data }, { .compatible = "mediatek,mt8188-scp", .data = &mt8188_of_data }, { .compatible = "mediatek,mt8192-scp", .data = &mt8192_of_data }, { .compatible = "mediatek,mt8195-scp", .data = &mt8195_of_data }, + { .compatible = "mediatek,mt8195-scp-dual", .data = &mt8195_of_data_cores }, {}, }; MODULE_DEVICE_TABLE(of, mtk_scp_of_match); From patchwork Fri Feb 10 08:59:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55332 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp840434wrn; Fri, 10 Feb 2023 01:02:15 -0800 (PST) X-Google-Smtp-Source: AK7set/TCAu0S2fGu+JBNG4zn/JAKE3HRO2pbccI/P2XXL+wer6oaT5P3EAdCDtmLzNlWIJTJbI8 X-Received: by 2002:a17:90a:190f:b0:233:4454:4c81 with SMTP id 15-20020a17090a190f00b0023344544c81mr3964513pjg.16.1676019735240; Fri, 10 Feb 2023 01:02:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019735; cv=none; d=google.com; s=arc-20160816; b=iQVZUlocJkh35D5BoCBBaVSxclJeR1W6EAocS4uOxCMtY58zN7ahZhmTrB2LyBNvYf ZeOnTd1ESB1lgTv6rwc+sHTCwye8vwaeiMTcughofI5MPXl1TMQuBTxqjlxpIz0pXU/u py4cKPH3c1uPiIuP5ZkuhHBKfwa1Jk1mDi8MP08xpieQW5hwSs1SKkHvfK38j0mFJK2+ GytMaFG+ld6rnB/AGmar3OmecLoM89Dr/FFdu7Z9J5RnFRBRtpIV4RSWcnToH37beMR0 qNhAE4rc2jO0wrVDnDLXP8VbpQRggjgPV/3t7P/XNoPwq8SNyTIONc9+puE+VJRcHzXZ 20PQ== 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=SUD3fqkoCLZDULBrwrDENF0iMnUmbMM9p2CAPvcnOzM=; b=WFJsPosmVFKkLYaDjQhRjtyRXcX3hDswwbqRD/aIuDcEFIfrsUlX4yjBsbR0Hj1b4+ rF68OD2msQw856LZZXHYsH4zOwB6tnjotpDiMmqg9sGH7lRdMuyib1EYcVAfTCNwvn6q LrY6tHZJMy4c52RNUVw4ZDUugQ2xxXeMMIgT0KwjA6tM8mLK7O0GtLToK/0pujZACEoT pwGxqwlSUOF8qnTfnIsYqrATu8Pd/u6c3gurEmBk4lutM3W5tU04osbg9GMav978eIpF dC8rIWGvk4disQG3cJMzLpxv+4emyecl2SVBeLhiQBrAIeQYzmawWg4tMlZ92OKbPZB/ TCRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=NK+FwcCg; 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 fz15-20020a17090b024f00b002299b3cd7acsi7330325pjb.83.2023.02.10.01.02.02; Fri, 10 Feb 2023 01:02:15 -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=NK+FwcCg; 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 S231819AbjBJJAR (ORCPT + 99 others); Fri, 10 Feb 2023 04:00:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231720AbjBJI7o (ORCPT ); Fri, 10 Feb 2023 03:59:44 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 194C2458A5; Fri, 10 Feb 2023 00:59:41 -0800 (PST) X-UUID: 3dbd0d3ea92111eda06fc9ecc4dadd91-20230210 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=SUD3fqkoCLZDULBrwrDENF0iMnUmbMM9p2CAPvcnOzM=; b=NK+FwcCgqGTLrpwy7UlKS0bjg6sgSL0/Z7kzVpIKh4JSNCBCqKePTgnvxHj0AzLemcv42EXZR6mb7LKpDJy3V7tyen1PKQy5bztLRbzuLJSnAgWEhlrkJak3N+5RBN1JmFiK1upl0ttm40vs2TDOCBCluKSY0y1Trk9VksC6wYg=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:cdd7737a-038a-4154-8113-d733bebd5265,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:cdd7737a-038a-4154-8113-d733bebd5265,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:b2bc0ff8-ff42-4fb0-b929-626456a83c14,B ulkID:2302101659363AUZ531H,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-UUID: 3dbd0d3ea92111eda06fc9ecc4dadd91-20230210 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 2062458772; Fri, 10 Feb 2023 16:59:35 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Fri, 10 Feb 2023 16:59:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 08/12] remoteproc: mediatek: Control SCP core 1 by rproc subdevice Date: Fri, 10 Feb 2023 16:59:27 +0800 Message-ID: <20230210085931.8941-9-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-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?1757434069808220737?= X-GMAIL-MSGID: =?utf-8?q?1757434069808220737?= 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 --- 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 0b2c4bbb55f0..e4ef97f2d3a1 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -123,6 +123,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; @@ -154,6 +161,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 8e2a82174e5f..f1dfe610dfb1 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -854,6 +854,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, @@ -954,6 +1008,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); @@ -1018,6 +1073,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 Fri Feb 10 08:59:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55335 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp840829wrn; Fri, 10 Feb 2023 01:03:00 -0800 (PST) X-Google-Smtp-Source: AK7set/iip6j44rd5Xb4zLJgNpjKcFa162OkZK+brMpiUaXdBA4gZcRNAqqj9nquXYFN6QeChHwT X-Received: by 2002:a05:6a20:8e06:b0:be:a3e4:8426 with SMTP id y6-20020a056a208e0600b000bea3e48426mr19594508pzj.40.1676019779932; Fri, 10 Feb 2023 01:02:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019779; cv=none; d=google.com; s=arc-20160816; b=HHyypbjR8Tw8s800iVgiIm+Vd5csEu79Vmrg18pgE2bN2BtsqdKg6BLfn09H1m5F+J +L2a1eB6FMQcx+lKGwEAdfbg/xS5sCycM2D1As2mQwiDCgrUg9k5m1EXaCHE/RDimnnG 8PJHtcaTA7SgryoMHlMlrck35cdjcKzKYGUbPEFZGlzFGqUkhsw3W42fQyrDRKU9DpSN A8E4bm7Sw4HiuzozB9Cj9n5aYAFAyqpQF8z4xbgLZdutkeKyZdW6VtW1xAMDEvdxiqCj l5Olg9QfE2tUAisyzhEcbi6BKpI3BpccSSysbD1aZD/M0Kdo7EUKu71dFbZSGKIdMQvk 6yzA== 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=700dFM0xBya4gDvivRWURd2IJ5qIAFFZK66uwVFjox0=; b=ES0NPTII7X9UvwqVkHb0c2q1xwhOfPHSqtV0AO3v17IbBqYoJRq15F6+TOKqhDDkXu LdL4hjT2GisFGTW7LX4ny1LtaoyOj3gfRuOvlKil8bupQotp2qUWjxtTii1c/bfFyRjL DQgsG+M5o7BZd7q9WJG0Jdjd/mh5EL25fz1d+E2KOuKSbYLHCzP72wibTHTBXydz92k6 nVGkDVxbY5rnnQH3iFy6ULbvzcvn6lRnLJTVQSH39UUhdjIuRR8MPvhKdrW9Jk0tf/Gy Aq/h3jUrnnt0k4IyMcg9CWWp1HgAYFlz+bdfR8r2NsUtxGvOHhGIrL00lgS3Y6QU50SG f0Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=IN+kMtJc; 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 g10-20020a63be4a000000b004fb375e8dbdsi4066562pgo.819.2023.02.10.01.02.48; Fri, 10 Feb 2023 01:02:59 -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=IN+kMtJc; 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 S231436AbjBJJA1 (ORCPT + 99 others); Fri, 10 Feb 2023 04:00:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231747AbjBJI7x (ORCPT ); Fri, 10 Feb 2023 03:59:53 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 548425AB23; Fri, 10 Feb 2023 00:59:45 -0800 (PST) X-UUID: 3db6b3d0a92111ed945fc101203acc17-20230210 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=700dFM0xBya4gDvivRWURd2IJ5qIAFFZK66uwVFjox0=; b=IN+kMtJce1Fn330vn4qOStzUdpKJ7TyHq05Uk1/JZkIcypAQh8Rp/r+SZHF9sBzAEq4KVx7lhD5nMD8VUckIMBiEhUWJkmBmVngN/qnBRCtdCFLMy6u33xDmXUW1GbknRZaY0TCwqox1Zt5ZDNigd4m/nEyex9QSZ7PQ4czBuvk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:743d1c8d-8dd7-4bb4-a30d-dcd738b23099,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:45f8e556-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: 3db6b3d0a92111ed945fc101203acc17-20230210 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 1280376781; Fri, 10 Feb 2023 16:59:35 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 10 Feb 2023 16:59:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 09/12] remoteproc: mediatek: Setup MT8195 SCP core 1 SRAM offset Date: Fri, 10 Feb 2023 16:59:28 +0800 Message-ID: <20230210085931.8941-10-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-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?1757434116817287303?= X-GMAIL-MSGID: =?utf-8?q?1757434116817287303?= 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 --- 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 f1dfe610dfb1..569e915dfa0f 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -477,6 +477,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. */ @@ -485,6 +488,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 Fri Feb 10 08:59:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55331 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp840319wrn; Fri, 10 Feb 2023 01:02:04 -0800 (PST) X-Google-Smtp-Source: AK7set/9+4Q+8Qa9Qt/X6nM0c1hi74+Uxamxb87jmI69m5WqPR5ABkT0H0SqEFkUWLDwSP0hSnL/ X-Received: by 2002:a17:90b:3a8b:b0:230:96f7:443d with SMTP id om11-20020a17090b3a8b00b0023096f7443dmr16636340pjb.22.1676019724640; Fri, 10 Feb 2023 01:02:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019724; cv=none; d=google.com; s=arc-20160816; b=SFj11dXk3Cv6a0LjVNAi3Oh4hH9HchsxWjy1+nIad0eLQ5a2HPP52zEKegS5OQuEm5 T/BMbuOm70zRXpU5bXBDw2hpKMxsg3PycrbRlH5z7Z9CcVQhQAAErwwx0GmIHLgQw+Nj QnnG/uu/z7bnKkBszTQNJnq3vr12KZPMlrR97HZMGsY7TiLK9rjCAIWHStcv56kzSXrT zRDSjdXbp1RaBiPoVYdMe6PlHaGatJ8rnROhZu24Wtmeg8KgoX5UCiFVsynczFGbyoXe L9kGQNYlMgVWZ/aEztsEg5GpWpaeI0bsPZ4uLCm2xc10/idpXvGMAcvavKx0N5QoZzPt yr3Q== 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=N1GRvMdgWHjes1U/8i84hO5LS0vKzH78vNx/oJKWdA0=; b=kPaOR7E9j5vipWBx/ZtDR+vzqgkK6xDROM/LoeSQ4SlWpJCi99V8P8PAe8xXcAowRW 4wKcbmHHSlOT12LvAqBjcqxhvYdTPT9GBDsodC30Q58fB+2dwzUtltLg3hftmCdBwCnT 12+uBPbDKoSLxsNSKDf6PxAZyb1B/MYDInvR4ox0P8zfYW3+z3S0qruDoPAgDjgEdsaY jVmAbiHRID9L/H7ZkAuk1HwFb+hIGnmW+pqsFuyLtXqu5Raop7/juw4nhJyLuT+z8D+Q +uoN6zbUVXXr3JwN0LKwNug4CUcH5nxzkWM2/qD15XOzrSKNqjFtjQ/MmW4+hHz+sR/Q dGvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Ue7dDebG; 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 fw4-20020a17090b128400b00229661af23fsi4274399pjb.110.2023.02.10.01.01.52; Fri, 10 Feb 2023 01:02:04 -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=Ue7dDebG; 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 S231806AbjBJJAN (ORCPT + 99 others); Fri, 10 Feb 2023 04:00:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231707AbjBJI7o (ORCPT ); Fri, 10 Feb 2023 03:59:44 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A32864C0D4; Fri, 10 Feb 2023 00:59:41 -0800 (PST) X-UUID: 3dbf36a4a92111eda06fc9ecc4dadd91-20230210 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=N1GRvMdgWHjes1U/8i84hO5LS0vKzH78vNx/oJKWdA0=; b=Ue7dDebGzRId6kNmyd9a93by/R3eGFiP4dcXIAb+gWMOszHvI4T66GTqw74/mJROuBC/Mq7SyKP49Cl/5G2ZqUBc0UJXp4e1xBZ5i8tFN+a5dPj9evjpYQ6Rm1zmPn5Aeyc4nCGDs7kBh28eH0qTlOFhorpp3Df3/SvgbKORI/k=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:49b31ff2-82b0-40f6-b028-5f0215194da4,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:49b31ff2-82b0-40f6-b028-5f0215194da4,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:b1bc0ff8-ff42-4fb0-b929-626456a83c14,B ulkID:2302101659363JI45V3W,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-UUID: 3dbf36a4a92111eda06fc9ecc4dadd91-20230210 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 2043132446; Fri, 10 Feb 2023 16:59:35 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Fri, 10 Feb 2023 16:59:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:34 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 10/12] remoteproc: mediatek: Handle MT8195 SCP core 1 watchdog timeout Date: Fri, 10 Feb 2023 16:59:29 +0800 Message-ID: <20230210085931.8941-11-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-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?1757434058718166426?= X-GMAIL-MSGID: =?utf-8?q?1757434058718166426?= 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 e4ef97f2d3a1..ca2395b98d27 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 569e915dfa0f..2b43e23f6de7 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -222,6 +222,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; @@ -1273,7 +1296,7 @@ static const struct mtk_scp_of_data mt8192_of_data = { static const struct mtk_scp_of_data mt8195_of_data = { .scp_clk_get = mt8195_scp_clk_get, .scp_before_load = mt8195_scp_before_load, - .scp_irq_handler = mt8192_scp_irq_handler, + .scp_irq_handler = mt8195_scp_irq_handler, .scp_reset_assert = mt8192_scp_reset_assert, .scp_reset_deassert = mt8192_scp_reset_deassert, .scp_stop = mt8195_scp_stop, From patchwork Fri Feb 10 08:59:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp840458wrn; Fri, 10 Feb 2023 01:02:18 -0800 (PST) X-Google-Smtp-Source: AK7set+o/rpxQ7wjKgIeVxcIH+NwMssdNn864bVrbO63wwAC8h02vm5OqQiUkkWe5TSbr5e6bp5R X-Received: by 2002:a05:6a21:3881:b0:c0:af73:be4d with SMTP id yj1-20020a056a21388100b000c0af73be4dmr11311194pzb.54.1676019738267; Fri, 10 Feb 2023 01:02:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019738; cv=none; d=google.com; s=arc-20160816; b=0y6vSWfVYwBAhsBEpM0Ubp5K9eVDqxeGfrleAIMhuN0yHDx8uCfRd6DHfydRrirrjc d24zNFPLxzQsGogu+wsHyFh6w6STXDbp/97K8ZcYAxbFeOEuZcNzgxrksJDe8EK+iLMe tSlQGzFAVfYvRygHadvxt2TrFxQpd35I2j+MVw9K2rvyhCOXoXS/CQrHd1OJeAqpT9rs Qu8bRbfgZcNPrzC7wi9vortZsOEAreztXZMghYUKtPYR+K7QBfcCRomsS1G/2tRJSguN 9A953RlqxtAHodCNZJA4R67rVLcHNU9U+fwRK4CnyK+fm7fi6up1DD7v2R2pQnStAkFv df2A== 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=91rhX4HHGQAcfv7LRmG26yrEQlQ4OgIKr4+ayCCVh9w=; b=vHiDOsD/RTWrz69xnCJjcUERrJfKsvWwM9Ql2YLrCa2ghgZaEA8EbOEY7M09UHf+Xk oFDV2clr74YdIeM4Pur1bffKQ27JoauVvl2trny8AuJecFs8iXaLIUWBxJkV0LDjGemx 5mrh3IJ/F4SVaw8F7ZKPKSZ532kFo/zeEL3FUsHb9HDeQjmlHErTUKpnDt+WhOt88bIV gK9f+mp/vRMkKPuIRrm60vCWnaNuNDWOgPik/psM2NBLFbDRjsQPKbuLMYH5M6Nwg9If +azXGqUEhKF2PUhKV+Mz8wYpVV8C5MWzuS7EYRefsqqyWzu/zWILE9rbH3h9C8KaadHU p1Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=E52uUr8O; 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 g10-20020a63be4a000000b004fb375e8dbdsi4066562pgo.819.2023.02.10.01.02.05; Fri, 10 Feb 2023 01:02:18 -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=E52uUr8O; 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 S231829AbjBJJAT (ORCPT + 99 others); Fri, 10 Feb 2023 04:00:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231722AbjBJI7p (ORCPT ); Fri, 10 Feb 2023 03:59:45 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 190D83EFC5; Fri, 10 Feb 2023 00:59:41 -0800 (PST) X-UUID: 3e64bcfaa92111ed945fc101203acc17-20230210 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=91rhX4HHGQAcfv7LRmG26yrEQlQ4OgIKr4+ayCCVh9w=; b=E52uUr8O1T4h4heu0GP9LCSWeBwNWnCXqHuuVsGk7xN8w5xw5hG0fxPLGUON48LlaCQym0RnGo/T45HX4rfhat7VyDttsHui/itNDvkgfF2Iotff67rzwadaD92+tKJw9yBOxOZ34DjD2GquyH5TTxZjyhdsJzVuj51cFdARSa8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:708f0e31-313b-44d5-9f7f-4dd2334a1001,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:41f8e556-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: 3e64bcfaa92111ed945fc101203acc17-20230210 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 550413556; Fri, 10 Feb 2023 16:59:36 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 10 Feb 2023 16:59:35 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:35 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 11/12] remoteproc: mediatek: Refine ipi handler error message Date: Fri, 10 Feb 2023 16:59:30 +0800 Message-ID: <20230210085931.8941-12-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-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?1757434073417268182?= X-GMAIL-MSGID: =?utf-8?q?1757434073417268182?= 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 2b43e23f6de7..c8a964c30181 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -106,7 +106,7 @@ static void scp_ipi_handler(struct mtk_scp *scp) scp_ipi_lock(scp, id); handler = ipi_desc[id].handler; if (!handler) { - dev_err(scp->dev, "No such ipi id = %d\n", id); + dev_err(scp->dev, "No handler for ipi id = %d\n", id); scp_ipi_unlock(scp, id); return; } From patchwork Fri Feb 10 08:59:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 55339 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp841434wrn; Fri, 10 Feb 2023 01:04:18 -0800 (PST) X-Google-Smtp-Source: AK7set9W1Q9QjFjFgcvY6kHStam41RQuyXAaXYsmjW95eQ55C933VP9rzBQg8w07yanE4CAe5tZy X-Received: by 2002:a62:16ce:0:b0:59f:6211:e4b0 with SMTP id 197-20020a6216ce000000b0059f6211e4b0mr12468367pfw.32.1676019858551; Fri, 10 Feb 2023 01:04:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676019858; cv=none; d=google.com; s=arc-20160816; b=XaOdwaIFMm9aYzfO2ZKciFHjPVT/yj2XTZLwMZDuIoNjlTD0qa/KnlMhUdWEGTDwkp i4+8JDMTFM7p39swYJMjXyHMQsntVKSP2Tvb22lKxcK9C2xsWC1hbI6ztzgoIE5h8pli +fD/yZsoy4wcc3MWKk0BEz19+DDclvyTZDfzILdh3LVutHYVtHTHFG6BT5MU0+qUvWpC vNr8xvkWiibZUiyH8WI7naoAt4uBg388SzLNA0QC7eouWetf0h+0CWq4j7bLez7RFCN7 wcgya67SVCmsvzWmer+XeN7bHwhr0m9HsfOw16K+7l8BpqCza+0QQqelwdddsA9WPcic dPWQ== 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=SOGG31q+O+/Pz6GrWiIsoHSd9f46vLgfVPDNWGwhamI=; b=Q6Y9fzaD8cJSsCP7C1lZ1Ak9vyQHqTxFSFP1g0bVX6VjpYYyJuDs0kwYyC8wk4U0q4 afNaJDO694L67b1OyOfgeEDov3exJQ9bzpnH9eoBRwf7QDuJcDY0GOLwPbPRrk5g7TbT EV/UMovkIGpV48Bgusntt86tljWYQwwN/NIyCKvwKb6O9F0P6jSwBY82i+xEQEaudFxn Cxn7mblWKMOKy+Em6OeWkiDJX0mUH1WaTkE/C/fAxsJO4/vJzFakAvvoQc0ZSE5yO/N5 iHEg3gGvopNTWWnd9ZTqUvxyb24mgEJyqYG8PBJFfJjWVb+oEfsaVidzeGMEXmnRpmpI cDBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=hOT0Uu0k; 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 a29-20020aa795bd000000b0059d1764718dsi4023593pfk.133.2023.02.10.01.04.06; Fri, 10 Feb 2023 01:04:18 -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=hOT0Uu0k; 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 S231874AbjBJJAv (ORCPT + 99 others); Fri, 10 Feb 2023 04:00:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231730AbjBJI7z (ORCPT ); Fri, 10 Feb 2023 03:59:55 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E35718076B; Fri, 10 Feb 2023 00:59:46 -0800 (PST) X-UUID: 3e45070ca92111ed945fc101203acc17-20230210 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=SOGG31q+O+/Pz6GrWiIsoHSd9f46vLgfVPDNWGwhamI=; b=hOT0Uu0kQQjJfGBl/1vZcaMOzDi1RzmfZ96MsIExlU0xBps6OneMErnOPMswP7oXr5KYsc9Mx6ntUcEha+qWPa17jMGDZcXg98su3n6F5fjrrB+P1PgUCd6kTKDKa/W0h534G2Dsg0zJWd6vqipkljzPlfh4k+5JfjuM+pmprVM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:ff5eeef1-74cb-40a8-889a-b742e48c4960,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:ddbc0ff8-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: 3e45070ca92111ed945fc101203acc17-20230210 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 1710802388; Fri, 10 Feb 2023 16:59:36 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 10 Feb 2023 16:59:35 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 10 Feb 2023 16:59:35 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v5 12/12] arm64: dts: mediatek: mt8195: Add SCP 2nd core Date: Fri, 10 Feb 2023 16:59:31 +0800 Message-ID: <20230210085931.8941-13-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230210085931.8941-1-tinghan.shen@mediatek.com> References: <20230210085931.8941-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?1757434199083747227?= X-GMAIL-MSGID: =?utf-8?q?1757434199083747227?= 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 | 4 +++ arch/arm64/boot/dts/mediatek/mt8195.dtsi | 30 ++++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi index 56749cfe7c33..4f9bc7581adb 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi @@ -933,6 +933,10 @@ interrupts-extended = <&pio 222 IRQ_TYPE_LEVEL_HIGH>; }; +&scp_cluster { + status = "okay"; +}; + &scp { status = "okay"; diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi index 8f1264d5290b..87e49f5fb7b3 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: 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 {