From patchwork Thu Feb 9 07:40:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 54786 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp192984wrn; Wed, 8 Feb 2023 23:43:50 -0800 (PST) X-Google-Smtp-Source: AK7set/QJx+EM3DUFbiJuqbMS4QdvbybNh3k71TTSFhf08i2txqMAxAf9/1RzCvqItORosgYF0o6 X-Received: by 2002:a17:906:5a60:b0:879:9bf4:b88a with SMTP id my32-20020a1709065a6000b008799bf4b88amr10877698ejc.77.1675928630035; Wed, 08 Feb 2023 23:43:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675928630; cv=none; d=google.com; s=arc-20160816; b=PfxEyONwFodEgaBAOa79KN7dqsXi4DIYW7XJVCYy26WKgjFsHcbY423OkxcuA8dAAL KuKl6rEfw4WYg3d8gfF6HNiAk4wU8CAXTIVOqOJ8+p5KQz/rZ38kjLW+L6xExfaFi61Q JlhWbxUmA0OzZa9T2jtLFA2Gcwi4fnFzcUweM6EwbBSEeHq+jwdMv/Fp4+sbdbibto8E seYw0acVJBIIgaFRxXecP7q59ZP7rAi0sCezXIIk3x8jGUKw8VmykwQWcq1ewT+2JnMp /6hTSVO4EomFudR0Z959sThEEUxvWv2EtnYRcAh5lKC6oSP4j4MFPE+/7m5eQutjP8dP L6uw== 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=MJgCF0EEQ8Ku8dYsNa5MNogDo4G3GltNYIKj8Kh/rT4=; b=bbdnkD0yfat50ol0sVE5soI1bPuMQbddPi27PM3h1kFCUG7oCk4P7HTp3ePPs0V/WW Yv8dGuswh5XXi0rkpIDWSR9/buP33C2AGwMr5dTgDdDW29t6yJ0VQ9sQtnjDjPOO6qkq LJTLvoolnplHrtMRvloAmM7w8U8o0h/YZPjYsZGnYF0FHLabM9YQmgq9csBhjKeAZ0ik NDOyi0RrUNDpa1YwmRl0Yz99q1b04Lnw4Qz9tR2fEIOoj6V75cAgnsfc/GO5BC6lMxpn Pxx44W1ihWbKS6YsGNB6izsijzHlZlAu6mYj3vMOGq6cXL1NqP+knayus2YgDuRYXebF Q/9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=YY7QsoDT; 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 fd22-20020a1709072a1600b008af42f9e762si244747ejc.457.2023.02.08.23.43.27; Wed, 08 Feb 2023 23:43:50 -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=YY7QsoDT; 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 S229993AbjBIHlW (ORCPT + 99 others); Thu, 9 Feb 2023 02:41:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229930AbjBIHlL (ORCPT ); Thu, 9 Feb 2023 02:41:11 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D19C5402DA; Wed, 8 Feb 2023 23:40:56 -0800 (PST) X-UUID: 12cb2158a84d11ed945fc101203acc17-20230209 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=MJgCF0EEQ8Ku8dYsNa5MNogDo4G3GltNYIKj8Kh/rT4=; b=YY7QsoDT70Yk9Gz5ewcpmEte/WnXIzSMgDxspoBBo9Mekv9de/r4E2/RNDgup7TZ+y6n1y1me3atAPzcMCG6ZEfU0ZVo9tOaLkFWr6kET7iqWGdZU+geFWqdNMFPCJRMNZ61Aerk9yU/wixCnJzuLpq2OMrxqDXPajwXEGYWT+U=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:90415415-376d-474d-8d9d-5d53df547c18,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:0955c556-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: 12cb2158a84d11ed945fc101203acc17-20230209 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 1827483182; Thu, 09 Feb 2023 15:40:49 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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; Thu, 9 Feb 2023 15:40:48 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 9 Feb 2023 15:40:48 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v4 01/12] dt-bindings: remoteproc: mediatek: Improve the rpmsg subnode definition Date: Thu, 9 Feb 2023 15:40:10 +0800 Message-ID: <20230209074021.13936-2-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230209074021.13936-1-tinghan.shen@mediatek.com> References: <20230209074021.13936-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?1757338539087172189?= X-GMAIL-MSGID: =?utf-8?q?1757338539087172189?= 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 Thu Feb 9 07:40:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 54783 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp192907wrn; Wed, 8 Feb 2023 23:43:28 -0800 (PST) X-Google-Smtp-Source: AK7set8pEiBXMMjEJwXS5G3PlOeD0BcB3WbuT3PkMJnEHJIaCN4DJgtQXw8fT3O8JxhaaWYpIEB0 X-Received: by 2002:a17:906:7159:b0:82d:e2a6:4b0d with SMTP id z25-20020a170906715900b0082de2a64b0dmr9618259ejj.18.1675928608283; Wed, 08 Feb 2023 23:43:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675928608; cv=none; d=google.com; s=arc-20160816; b=rXsI3OcLJy+TcTL2oeCTzW2IcaNf2VXtISVJkTiG1OAq6gx0E+9nZsAsMUs974m3FH 7dCZR1Xit07aLmyEdosg8F/VaM747WVfaY8DtIbsWMELwKWNVkpnKdNWE//gMDAvVUa5 nmrrG0wa2apUBVFlro38I6Nvs6IFvK2RqFDPO00dftdoa+FLR+59fXtS5Ebc9Z8DbUpL TP7NrVKVadb/D5PtV89Mw0nC48aQ68ZbVbQGv92UwTbCIN7koxP7GDcT5j23kl+A+G6w 9Kz1MhELzBns6PPFcj9tj8lkOt/07uwhgeu5gDJbcVRRxgjdT60lU81ScJuktwn9Ilr9 fodQ== 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=t20iNtN97mgCmzurk2odzrpU/E2cwKOqO4Yjy2jXY+thMAufD7SDnBO6R7VjRmnXHc T+O96Ea+dgXp6r5lQn5Fz6SggSbWTius69aqj/lm4QL3hzv4QFfY8vyc+yzJhBDmxxyC BfnzdMo7Xum/wj/YdEk84YtG3giE6kxktAEIEnoyMMHsho3nYgXDRLxWALgDWmMFxL9l Q+Ir4Hpjh2Tli/vvi8HtQxw7HKLDQD1FsEj+w67lNqUpQlVwP4Xj3S6zmxZtVYfaNMIO 9XvPABi8c2lBvKK/ybQvpVHzueFbqeq9PHw1oYMm1Z++o/nq0uzJQ2r6R1Kwwjc/tUvI 9ebA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=d+YTq5ut; 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 cm6-20020a170907938600b008aac362ab89si488160ejc.581.2023.02.08.23.43.05; Wed, 08 Feb 2023 23:43:28 -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=d+YTq5ut; 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 S229862AbjBIHlK (ORCPT + 99 others); Thu, 9 Feb 2023 02:41:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229899AbjBIHlH (ORCPT ); Thu, 9 Feb 2023 02:41:07 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08D652917D; Wed, 8 Feb 2023 23:40:54 -0800 (PST) X-UUID: 12e0f848a84d11ed945fc101203acc17-20230209 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=d+YTq5utcx+3a8KVmG1T/G0huO3tO1GTY8nQ17Up3plt1tPtO8JBpdUSqYUj6JMmKCYoZr1Pl6spK9rXCoFnq7nBZIn1Hnt2Sd5Q6eB0IwkL+aK3R+8ICNKUi7pzY3tS8T85wNDkzfWOuzpyFGkpc2M/Vy2Q67ClWhtMZCL08vw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:60cd9e84-da72-4ef9-8bd7-40dd9b87c14c,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:60cd9e84-da72-4ef9-8bd7-40dd9b87c14c,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:5e05608e-8530-4eff-9f77-222cf6e2895b,B ulkID:230209154050N0N4T4B4,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: 12e0f848a84d11ed945fc101203acc17-20230209 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 137373546; Thu, 09 Feb 2023 15:40:50 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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; Thu, 9 Feb 2023 15:40:48 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 9 Feb 2023 15:40:48 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v4 02/12] arm64: dts: mediatek: mt8183-kukui: Update the node name of SCP rpmsg subnode Date: Thu, 9 Feb 2023 15:40:11 +0800 Message-ID: <20230209074021.13936-3-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230209074021.13936-1-tinghan.shen@mediatek.com> References: <20230209074021.13936-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?1757338516779006239?= X-GMAIL-MSGID: =?utf-8?q?1757338516779006239?= Align the node name with the definition in SCP bindings. Signed-off-by: Tinghan Shen --- 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 Thu Feb 9 07:40:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 54793 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp193327wrn; Wed, 8 Feb 2023 23:44:50 -0800 (PST) X-Google-Smtp-Source: AK7set88x929ovrgPdgJrYLw8RbosL/TA8wo/Txjse+ob38es8NaKXj4iP4/XwoQ01WCgePxJDc7 X-Received: by 2002:a50:d704:0:b0:46f:a6ea:202 with SMTP id t4-20020a50d704000000b0046fa6ea0202mr11955986edi.37.1675928689858; Wed, 08 Feb 2023 23:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675928689; cv=none; d=google.com; s=arc-20160816; b=Mdr8Tv0vbtvSoU6iADd6hPSEFrxrYJnaFZmxNHTd6uCRN2f/bqweUxkMyTb/RjVyUR 8pphtnuxeIF+zEuzdrnM/+Izj5Yenj1TdCVlUSvHuUL8CC7qJmGnrqNE8IWTHjjfePKM uerTyD0bIvXLqWcISHMQ+/pqS8XCqowTpyTvqxkqAwQmKW7gLale6LpJsdAy0ykjlIYq ZYFlbKLzXCfzAT0++rCxsXWvUQkrO2SFcVm1EkaNHO+15ARsLAnvL9tSzRnHOwgBqvzH M1bmJ2uxjd2NQgddC1tmDlQy8SJ3ScIZO4iqJL3FFK3ZrSNjnA+HVug2GX8mzsPsk8pg GCKg== 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=Lh5SYPTqE9jYhlsHkh+sxo+NL1aq5lBS0/1RYvOVAl8=; b=asIrT/KbuDEmm6nwd7+OMRfUEj1jUbTujNa9+Q5h/EH2NZwZidWR/9DuhM4Ly0HYLX 3A4CQSs8GLcR9xN7McA6XjJLZHSpR38td8B34kV+WQgIktaDrUnrbV5sMPcZJOnVgcbc d7LiAFdTWzPV6FNO1vtBHZ5hqTxDbsWmSr9vgxEImOZcwa/PQdLoSXDDAXVOLsJO8vXX RqWnPRwkug9aCB4Ium9KsfbvCJHFsc2ek8EL4MdfUN5ohY0XYNeC4tG6E/Wd4ePuhoSu hu6Jq/TPOJCBF80wPpj10Cz8xECHAr+w54pr4VvYwmzlPmQFCc65bOj9gP7BaAKPerg7 mljQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=PKEoDVaW; 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 d1-20020a50ea81000000b004ab15e55edesi1563841edo.161.2023.02.08.23.44.27; Wed, 08 Feb 2023 23:44:49 -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=PKEoDVaW; 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 S230104AbjBIHlk (ORCPT + 99 others); Thu, 9 Feb 2023 02:41:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbjBIHlV (ORCPT ); Thu, 9 Feb 2023 02:41:21 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F04294956F; Wed, 8 Feb 2023 23:40:58 -0800 (PST) X-UUID: 12fd2ae0a84d11ed945fc101203acc17-20230209 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=Lh5SYPTqE9jYhlsHkh+sxo+NL1aq5lBS0/1RYvOVAl8=; b=PKEoDVaW3rsPZ5db6RMOp0jLplPP9sbUluNUFz0GXMfdz4yD211krMIfukf962IHghJCafXuolhjSm3BVmCgpRF2sQ/pFntABNEmUELSQco1xfdIVjPJZcOQYP4UAQYS/Ma8Ak1GB87oFs30xM0Oxn0BO3OOt2NUbkJjKMg5NI8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:8142392d-33ed-4f9c-8394-483c084ecb7b,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:8142392d-33ed-4f9c-8394-483c084ecb7b,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:0a55c556-dd49-462e-a4be-2143a3ddc739,B ulkID:230209154050SXBJR5ZN,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 12fd2ae0a84d11ed945fc101203acc17-20230209 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1852867400; Thu, 09 Feb 2023 15:40:50 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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; Thu, 9 Feb 2023 15:40:48 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 9 Feb 2023 15:40:48 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v4 03/12] dt-bindings: remoteproc: mediatek: Support MT8195 dual-core SCP Date: Thu, 9 Feb 2023 15:40:12 +0800 Message-ID: <20230209074021.13936-4-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230209074021.13936-1-tinghan.shen@mediatek.com> References: <20230209074021.13936-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?1757338602160332886?= X-GMAIL-MSGID: =?utf-8?q?1757338602160332886?= 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 --- .../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 Thu Feb 9 07:40:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 54784 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp192931wrn; Wed, 8 Feb 2023 23:43:35 -0800 (PST) X-Google-Smtp-Source: AK7set8sMiHDtOqXn8u33SpKkLx+Cbb7ccgY6RB5n+0bVGGu/up2GH5BVFj2PmH2auFrIK9YNmt+ X-Received: by 2002:a50:9b43:0:b0:4ab:1d33:69ba with SMTP id a3-20020a509b43000000b004ab1d3369bamr971419edj.16.1675928615805; Wed, 08 Feb 2023 23:43:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675928615; cv=none; d=google.com; s=arc-20160816; b=NfvlmV7Jxra4V1cNos+tYfk1cJnl3eon6kKAbHxYPPkkCls3WpKzpXEwP8RDzn/xE4 KawRvE/li7DhNhdSIfPlmZSSFHnB6m+9M1qLpZEAhs4Hld36QMWUFu25vSCByHG71d6O HGgN3s1oKxRepuk1SYClfyof+3l8JltJSIokSxAJhXD+WfsDwxkU/WIhUohkcV7VnQNo 0I3YAZ/jpLGuAdeMbEdeKYRtjgQcLWKi2/R+Yc7lQI+/vPR0klYH3d3wLRHCV5OE2bqB ls+5+fmyR5sljpWKh6jgJkAEyJUIradjvWhRsoa/7QEwGiG5KFvNPxsxNQdEZyfMqoZt KOkA== 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=q84pOg92UkbnoSahTIs5l5oXF8bfsV6Bxxy6R1zTNuf1OmTf3ExhKdzKKjVmvseolq eKUKsv3JhmkPEX+gV8ZPkUqF29okfM+5iJrbiP+yw0XudBZSB4+nmrv1eAHSZfG/tr9B ovWJTEO7Ub2hq8s5Ws3wwPP8FTgPyVhQeu3wjEVF6NxI+7WDrMvBthESJ4vC7DuW5reA NFbICaDXH6hifxKdxpVPEl8TrdFv0ocm5C17rCAi+0MHL7pxkJqEDg/h1oLEjgdD03w3 cR7BXCJpZyGgm6lb9Ft5D2+eL4fgkBn3RKH1I+8mHzkVCHcAKsyzOsdLPvPhfWfryZZw cZTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=C+ZrLNfn; 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 w3-20020aa7d283000000b00483bcf2ab07si1638301edq.325.2023.02.08.23.43.12; Wed, 08 Feb 2023 23:43:35 -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=C+ZrLNfn; 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 S229923AbjBIHlN (ORCPT + 99 others); Thu, 9 Feb 2023 02:41:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229879AbjBIHlI (ORCPT ); Thu, 9 Feb 2023 02:41:08 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8943C25960; Wed, 8 Feb 2023 23:40:55 -0800 (PST) X-UUID: 130441eaa84d11ed945fc101203acc17-20230209 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=C+ZrLNfnl8DyfNA9CsdbntYggt4HH2TYxkYYJBA2Vs39hqd/OnhACwja63njK6uFCqxuw6UvPMwE8QZK/3qt9KlBrB6Zj+yADRrnAZySKByDevbdUZbSsK953sSF8Zf/cVTA9pENBtdGSjR29Ii0DLRyTaV+umF58v0MbAGgrf0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:11889287-6a86-4cc4-9e17-b3edb1b36cbe,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:11889287-6a86-4cc4-9e17-b3edb1b36cbe,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:4519eff7-ff42-4fb0-b929-626456a83c14,B ulkID:2302091540508PDLCMUG,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 130441eaa84d11ed945fc101203acc17-20230209 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 192033030; Thu, 09 Feb 2023 15:40:50 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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; Thu, 9 Feb 2023 15:40:49 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 9 Feb 2023 15:40:49 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v4 04/12] remoteproc: mediatek: Add SCP core 1 register definitions Date: Thu, 9 Feb 2023 15:40:13 +0800 Message-ID: <20230209074021.13936-5-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230209074021.13936-1-tinghan.shen@mediatek.com> References: <20230209074021.13936-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?1757338524163288141?= X-GMAIL-MSGID: =?utf-8?q?1757338524163288141?= 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 Thu Feb 9 07:40:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 54789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp193180wrn; Wed, 8 Feb 2023 23:44:22 -0800 (PST) X-Google-Smtp-Source: AK7set/z+F3e59EyU1BGClRBTY/rODOLsZobciQEzjb2DTdFjRPmvd9pm53QOTxf5V0GaDAYPfTT X-Received: by 2002:a17:906:3582:b0:888:1f21:4429 with SMTP id o2-20020a170906358200b008881f214429mr8872892ejb.19.1675928662499; Wed, 08 Feb 2023 23:44:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675928662; cv=none; d=google.com; s=arc-20160816; b=HLMAdTZmoYGC/FvCJ7q+5M+quph/pE3FPpMte+Wg9wgErFRhazMvZgRayQrtZEucnR G20tbnFYPjz4YUnTmvrU7Y9blhFGO7O5yWmuvY7NboNpfqtFi9mbMv+kceYs08/eq4cn CiBp38hSVTnMCY1L18QZggXHXLCqHOJFXjUyAd5iGNOPbIR64LFYgbp8GSBvKeMs96JA EQ8oGXs6Q8DYXnPV+XjiJHEbSFB4Nch8umWxHtx5rE3V1Z9SI9DkIgMNDUu6H3O8E7iK iSrNJMsb+08N9fPXA+TwJ5eFKTORIS2U4kN72g3zgoxVvLcoO48b1WXi5NC4i1mAm0HH +rfQ== 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=L6Ud6BE3fYRJkPiOrrdpa83JWlNT2YuaNp3LJ3kAVRffuyxgnpHcXQV/AVkZ+C5x4d Tm5CNvNk2nDtz62iUHikcdlWQUIHsoBWRJHXPnrClfaOFLlkDAQi2UVoSUeQ0WEjPeAA GrEkGHbBP5RBwl+VmXXTkguYhqKMqacgNyKDEcl4vEo/JnDQiwig4pfKKsC9kuiJujuz x5tHn0bpZ69US7ZHY5CTqXSdm04f5wMbfXZ5b3t0Bd6OcNAqGMtLGNHiGMZ1j7ATjasb 9SI+ACMGIHOThfgtO1+3F8+R/0aTHqMFr96mjfowTJl/0AkegvyMNMlOIyyn0vu4gFGQ uA7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=AvPb9jYr; 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 f27-20020a1709063f5b00b008af2aa18bf3si1880104ejj.547.2023.02.08.23.43.58; Wed, 08 Feb 2023 23:44:22 -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=AvPb9jYr; 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 S229768AbjBIHlg (ORCPT + 99 others); Thu, 9 Feb 2023 02:41:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229987AbjBIHlV (ORCPT ); Thu, 9 Feb 2023 02:41:21 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADDAF4A21C; Wed, 8 Feb 2023 23:40:59 -0800 (PST) X-UUID: 132ac248a84d11eda06fc9ecc4dadd91-20230209 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=AvPb9jYr7weU93UBvMPpHGo17SEW0KiJyAhGolL6HzCTC++JkH+I7nGMoALinx7Vc+i1nJEXrAhaNyn7VcD7ddGiG+Z8OI900LLQk9c6IzHOuYbSXekl+9imm8xVZ4OAJsguBTl2KR+abTqHaje77aRYmXfholE45EEM/trjEp0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:cb597adb-0b15-4975-b868-f5aa4a2f1443,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:cb597adb-0b15-4975-b868-f5aa4a2f1443,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:9b19eff7-ff42-4fb0-b929-626456a83c14,B ulkID:230209154053PLK6CW3B,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 132ac248a84d11eda06fc9ecc4dadd91-20230209 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1090714823; Thu, 09 Feb 2023 15:40:50 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Thu, 9 Feb 2023 15:40:49 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 9 Feb 2023 15:40:49 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v4 05/12] remoteproc: mediatek: Add MT8195 SCP core 1 operations Date: Thu, 9 Feb 2023 15:40:14 +0800 Message-ID: <20230209074021.13936-6-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230209074021.13936-1-tinghan.shen@mediatek.com> References: <20230209074021.13936-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?1757338572783321831?= X-GMAIL-MSGID: =?utf-8?q?1757338572783321831?= 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 Thu Feb 9 07:40:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 54791 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp193237wrn; Wed, 8 Feb 2023 23:44:34 -0800 (PST) X-Google-Smtp-Source: AK7set9vFncAX/ufYGWHdL7DwCZIS5Q7mq9oJ3r3VziFqohPlV+kIep3t9JGXACw9T8JTCZuhqoK X-Received: by 2002:a17:906:d156:b0:84d:3403:f4f2 with SMTP id br22-20020a170906d15600b0084d3403f4f2mr10705500ejb.62.1675928674409; Wed, 08 Feb 2023 23:44:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675928674; cv=none; d=google.com; s=arc-20160816; b=bkil9ucDHOPEkCcnwTmNpoVN8AuVYG+pHLP7RBeIsoP1WFFY+1G4TtfskT4wml89BC KmIBlaX04C7K+Gv5sE2sRLAxWRywDz2mUGyLOhQFt4pLWvjxW9FkZNOsUWDh6UIVmf8f 6fDkW6r8KnKP1xGjD7cY7crL1QfECxbzPgJHIlJNiOWBJiiJJNvgPGyG06sIE4sXz2kA iAY5KFhKptvrzqw1vuxAg6XlDzHJOuMxZauE5xgaJtCsHAsoHeB64coagHwyON5+g1wm 8AhIQVW+/J5PgD2vTD6TUpVsiBZaovbqGxTzOlpJ182ZSGwPwxtUzvfSs2WlP/l2wiPz q2fg== 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=xda0JVIXh8C9Mjuim9UwdcizVvNQcJThjFmpczizUw8=; b=JYvMeqwfGTimy3pFLHyznhn2ByHFNl2uhuhAzzdeyfN1RxMO+QjkN56gYxHTQh68DY VpifB2owp10ihyu82jTwCJyaiLqcCPohNdkuGpebK+hF1crWn69lBXH+3u+LXKfFXrcd eFkTW/tipPMELRy2U3yETsSJs9cCpA/PbJCKGjtTs5RJpFlz94LTItUuuULpFOSp3U1z JX73U45M/fjIGsi/Nq70jIoFcPshsovqnZmD0Aqju+OEnnle37ThXn8a7NAaOxxBzZjG 7Ua1hLccFhv8Q2zYmdXWEBuH/05pOdVM4rod9mz3BWckWPYmAwgPDWMS531uTrhoji0n K8RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=BjsXsBwU; 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 ms24-20020a170907621800b0087bd4039179si1591776ejc.92.2023.02.08.23.44.11; Wed, 08 Feb 2023 23:44:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=BjsXsBwU; 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 S230108AbjBIHlr (ORCPT + 99 others); Thu, 9 Feb 2023 02:41:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229960AbjBIHlY (ORCPT ); Thu, 9 Feb 2023 02:41:24 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADE5E442F4; Wed, 8 Feb 2023 23:41:00 -0800 (PST) X-UUID: 12e6bcbaa84d11eda06fc9ecc4dadd91-20230209 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=xda0JVIXh8C9Mjuim9UwdcizVvNQcJThjFmpczizUw8=; b=BjsXsBwUyzi9mmEszCsboI3mLnI9oQRfF9egANU8MiT/rIlLu0gL/XdE9534/YeY9jp2lcfnMUIggRtO5WBnl6T/NprVZ/ZLmyoMUqI6eGjVDKTZhEmlL+PC2UTe9qJbj+hAG+QKp+TGdczMVbglSw7pTYQEFJG8bTqQozdtQe0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:b569114f-9869-49b6-8191-8d765bfd7011,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:4955c556-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: 12e6bcbaa84d11eda06fc9ecc4dadd91-20230209 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 547922252; Thu, 09 Feb 2023 15:40:50 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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; Thu, 9 Feb 2023 15:40:49 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 9 Feb 2023 15:40:49 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v4 06/12] remoteproc: mediatek: Extract remoteproc initialization flow Date: Thu, 9 Feb 2023 15:40:15 +0800 Message-ID: <20230209074021.13936-7-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230209074021.13936-1-tinghan.shen@mediatek.com> References: <20230209074021.13936-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?1757338585825130840?= X-GMAIL-MSGID: =?utf-8?q?1757338585825130840?= 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..feebcadd56cd 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, of_device_get_match_data(dev), &scp_regs); +} + static int scp_remove(struct platform_device *pdev) { struct mtk_scp *scp = platform_get_drvdata(pdev); From patchwork Thu Feb 9 07:40:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 54794 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp193356wrn; Wed, 8 Feb 2023 23:44:55 -0800 (PST) X-Google-Smtp-Source: AK7set+NTMEJLqvE4eldK2Vw2IEyfDhsbRNyHLxYQ/QF6q59HOEqAqxsxrObfznU9CJAPtJtEVYh X-Received: by 2002:a17:907:217c:b0:87b:7c1d:e02b with SMTP id rl28-20020a170907217c00b0087b7c1de02bmr10491965ejb.36.1675928695502; Wed, 08 Feb 2023 23:44:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675928695; cv=none; d=google.com; s=arc-20160816; b=vYwq1phtrvLCvaNfCxphcKeVgzep2EeaGQEyFGFL9jzMxvzO9YnNA42PnlSDEPLzLz gxgi0uxJU5XztySBPPq1SfIQZWMq45wlQZwgVtYbqhwTTFMxCAnbPmeiQhlUZPwuXOoK 013jOk6yV4R4IeP5y9qphXFjh+Mnn58dy/onSsqvF0A/1y+q/ML4GREMfuolyDOu6jQZ qL5zlrQkRW2JUhSGZgG8wvuHgkmEMczMiKJQ2LeUrmEMHs0pIYDyiiqOlYAkJWM4FROF WHzyjz1j4SHBVQn2pLQeqpLpMGyTVc62oDY5MS9CELyEFSZLZDfEho7H9/W64utZueC5 dszg== 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=ZSZ9etepUZrIqGGqnSYSy8UphY2tXSDIALwyklLT/8s=; b=CCXuKt1ZSRI/S6Bd4XIyXfzzjLgDVWd3RCCX4cVnJ5Xy1q6ntgmGGHq8WK1JJBkGJo BQtMUNxP92zhurgEAkWenphXkpSfd+LPl6TWKzUF+QZWGA1ONJ8Qxmx/y4jaL0PaKmWc ICefhQB/IutnLrHg4xwoixeOCj4wvE36Z1B/DyjeXPGafPbkAf1V0UisPXXhcmgguD2u mkViO0Rsg/f64lRf+WZinE3LLTYgXnMGPA50mAqyDrZLQKTXRMv0ZY/Z8v6rHZJax1Hu IwLUNk5VHlOQAR0A3P5+Vy6L4U9VBWA6bSUBT6yOa6YXsfrJsPC5PRYfMb4d00NhKrO9 3DYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ajU4lC5D; 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 22-20020a170906101600b0084d302afcc3si2183726ejm.79.2023.02.08.23.44.32; Wed, 08 Feb 2023 23:44:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ajU4lC5D; 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 S230084AbjBIHmD (ORCPT + 99 others); Thu, 9 Feb 2023 02:42:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbjBIHl0 (ORCPT ); Thu, 9 Feb 2023 02:41:26 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97333442F9; Wed, 8 Feb 2023 23:41:02 -0800 (PST) X-UUID: 12eaa8dea84d11eda06fc9ecc4dadd91-20230209 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=ZSZ9etepUZrIqGGqnSYSy8UphY2tXSDIALwyklLT/8s=; b=ajU4lC5DvgUW+CvtySE6u33CJ137AiaSOS7tVEXjSS9UbVLmfRktbAOl5T8kMz4/doZ4ThEvQ/yUftN7vPcoqvV8dDbYgYMClMwcV6Nivyb4JYPXA+BoPaOzgUOLUuMbQnwuMt5+UI/57HBGuIJtdeUHruUDV46KWaePglbMLf0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:14df8ebf-1415-44fd-a8b0-a0928e04537d,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:9e19eff7-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: 12eaa8dea84d11eda06fc9ecc4dadd91-20230209 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 766768140; Thu, 09 Feb 2023 15:40:50 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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; Thu, 9 Feb 2023 15:40:49 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 9 Feb 2023 15:40:49 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v4 07/12] remoteproc: mediatek: Probe multi-core SCP Date: Thu, 9 Feb 2023 15:40:16 +0800 Message-ID: <20230209074021.13936-8-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230209074021.13936-1-tinghan.shen@mediatek.com> References: <20230209074021.13936-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?1757338607954730450?= X-GMAIL-MSGID: =?utf-8?q?1757338607954730450?= 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 added based on the type of SCP. Signed-off-by: Tinghan Shen --- drivers/remoteproc/mtk_common.h | 7 ++ drivers/remoteproc/mtk_scp.c | 173 ++++++++++++++++++++++++++++---- 2 files changed, 160 insertions(+), 20 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 feebcadd56cd..a25141c6c4cb 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(void *data) +{ + struct mtk_scp *scp = platform_get_drvdata(data); + + 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(void *data) +{ + struct mtk_scp_cluster *cluster = platform_get_drvdata(data); + 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,23 +1079,39 @@ static int scp_probe(struct platform_device *pdev) scp_regs.l1tcm_phys = res->start; } - return scp_rproc_init(pdev, of_device_get_match_data(dev), &scp_regs); -} + ret = devm_of_platform_populate(dev); + if (ret) + return dev_err_probe(dev, ret, "Failed to populate platform devices\n"); -static int scp_remove(struct platform_device *pdev) -{ - struct mtk_scp *scp = platform_get_drvdata(pdev); - int i; + core_node = of_get_child_by_name(np, "scp"); + of_node_put(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); + if (!core_node) { + dev_info(dev, "single-core scp\n"); - return 0; + 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"); + + ret = devm_add_action_or_reset(dev, scp_rproc_exit, pdev); + } 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"); + + ret = devm_add_action_or_reset(dev, scp_cluster_exit, pdev); + } + + return ret; } static const struct mtk_scp_of_data mt8183_of_data = { @@ -1061,19 +1188,25 @@ 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); static struct platform_driver mtk_scp_driver = { .probe = scp_probe, - .remove = scp_remove, .driver = { .name = "mtk-scp", .of_match_table = mtk_scp_of_match, From patchwork Thu Feb 9 07:40:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 54792 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp193313wrn; Wed, 8 Feb 2023 23:44:47 -0800 (PST) X-Google-Smtp-Source: AK7set+MVkTd5C8vBc6DNExjCCimuOUQYp171cJ0+5Ido5C4cJ7juk2X7Sg4WuJ9OtdG05yRxJGf X-Received: by 2002:a17:907:6d29:b0:7c1:6e08:4c20 with SMTP id sa41-20020a1709076d2900b007c16e084c20mr13656115ejc.7.1675928687273; Wed, 08 Feb 2023 23:44:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675928687; cv=none; d=google.com; s=arc-20160816; b=TqLRlq0QfOR8Oyiv7R4mNvhvljquY7PAzhojSZJHuy20gkKV/lL54cOy3GYH6WoG0D Y7qqVOwMLRl521mPExbcVbCMfaTbACchRNr60NQjT854Ky8Lt5bVKoVgsO9tg2B5Yt7G kDNB+T8+Xtb5AM456ve4yGBoCMML7kM6wZ4e7IhwNsyrL+1It+XJ0EtOR1gZm0DAR+ot qqoV6E+fvibVFf4Oxv1Q8xWO1OQBUgh9eHiU45aQnmoeflvWYCjI+WFEBCFDQ756Cf6d U1Gv9SFGGbIosK+jGk+AwFJQP/daw7ejA1JhXQ5zT+TEDdsW/K7DGtaaAdWs01cbRfO3 4/rA== 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=zrNTlRrDxj+mZ5Ebzpphg4oxIPGjiy3Mfqo7hOFvYiI=; b=E7HHVHFgnwiM2JQ8GAE5lYaEW8BMXcObFWVJytMdt62NbIOLA7m65rIH78l5JZFmPj yaDb2MwMOGK0jx5TxutiKpigMpqsWvcbKv6qGlAgMGR109qI1Ma06eh98U/BDek2Y5Ji z0VVADCYSqrtiE2A0ZdNTsDGg7zOIjgDyfXFXWGJVdgOehVZ8KjWIh9gfb+buHIL/tpv iHELBEwIFvOS7cnIYueCa5Fcj55XtTIZgjbRh3q4Bzd3Fnjf2TzOeY5lf9b4Dx5KuhHR u6LQcbh67/Utu9lzwB8SmyopdUU0T83Aplq3Ipct59bLjUoIVB502hBqu9Xw90KX5jdE 93Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=EBDpYW+o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 17-20020a17090602d100b008aa1ddba701si2154543ejk.771.2023.02.08.23.44.24; Wed, 08 Feb 2023 23:44:47 -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=EBDpYW+o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230134AbjBIHmA (ORCPT + 99 others); Thu, 9 Feb 2023 02:42:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230011AbjBIHlZ (ORCPT ); Thu, 9 Feb 2023 02:41:25 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A510947407; Wed, 8 Feb 2023 23:41:01 -0800 (PST) X-UUID: 132d411ca84d11eda06fc9ecc4dadd91-20230209 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=zrNTlRrDxj+mZ5Ebzpphg4oxIPGjiy3Mfqo7hOFvYiI=; b=EBDpYW+okKhWx4t7phHmica08fXBsJ0EsfcQx906aXLU2cFTsN8W3xFkpnSLsPazqIMeE4a6QDvf6L8qfYe9tpAV+T8EvO8OXtMpc5njQrkd6bSL/ee834r+YiP58Q6l1/n/zP69UMS+I/WdaM5lWNVEx6JKHQFZqQ8PDwrM9wc=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:19a97786-cc04-402b-88bf-6626d766f361,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:19a97786-cc04-402b-88bf-6626d766f361,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:4c55c556-dd49-462e-a4be-2143a3ddc739,B ulkID:23020915405307XTWRGS,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: 132d411ca84d11eda06fc9ecc4dadd91-20230209 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 264008464; Thu, 09 Feb 2023 15:40:50 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Thu, 9 Feb 2023 15:40:49 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 9 Feb 2023 15:40:49 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v4 08/12] remoteproc: mediatek: Control SCP core 1 by rproc subdevice Date: Thu, 9 Feb 2023 15:40:17 +0800 Message-ID: <20230209074021.13936-9-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230209074021.13936-1-tinghan.shen@mediatek.com> References: <20230209074021.13936-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?1757338599110717466?= X-GMAIL-MSGID: =?utf-8?q?1757338599110717466?= 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 a25141c6c4cb..e7d4f279c55e 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 Thu Feb 9 07:40:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 54788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp193079wrn; Wed, 8 Feb 2023 23:44:08 -0800 (PST) X-Google-Smtp-Source: AK7set/RwxHptSVudpAVZ9akxST6paNQlPZcPVOpugSX4M+K4FtCzYaPGfgJw9pNzQlnlEUrdeWO X-Received: by 2002:a17:906:cb9b:b0:87e:9441:4c6c with SMTP id mf27-20020a170906cb9b00b0087e94414c6cmr10709882ejb.49.1675928648679; Wed, 08 Feb 2023 23:44:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675928648; cv=none; d=google.com; s=arc-20160816; b=dnFY3/YMfsoj1VpUMu+alR6JtNfyn2tEcUeGH1+M0qs9c2CMM3JDKR7OV9qRg04AYE JRCSHM9LuPGO/VKj/CmAggJbmPIifbVBFi+rKOrf+Qf/PQfmMdFKX88hA4IVGNO3OBhC SXXkNp+Sro051JSiXLWXXUWqBZflrGcARiAXA4ZF4T0+V7u0fqYJmKkjwYY0sye+GKjx cwE52U53U7Ghb1Cx09JVik6HyrZ/McgwJj7608kf8LJdbZakchVBdwmVmwE1wyDsUBiY zgcKxSGF6u7fnaKWREv2K6plyeHLvs6V0LisTHRDTDPku5JBHRB7ZJhIxs5H2OdCzmjo sJOw== 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=dVz6vc3eyai2hn+5fD9Ytby63sjqKarwLIkq8BPsPkM=; b=KdKof0yZkuARepFGR+oBrUYclIopNkWWuqWQgOG7YPlE8wUu6rjSRzhNmkm4sd3RER gG8BtELB81sDiTb4g8k1AkqThUTlBxdJ7+x8Kwi+Vu7XZYE/ybzWGMz+c5DwWhVuDLUl hbrErwsNcDwnZ2uQy+Qmqa30KYWnTdoR9jjOKdzJSaRzX/2E7Ok5XUeFEyHFuPBzbnfL iX4s8TnrGTNmlAGLsQGW9D1Z18YzOMgkuOU7PIXRuknkAxQZCTp69IcM0RSxFlP6IWhm k/Q+MFKsLGe6+avdIkmj0tiuQ+lplibIsiBJLm1/l8m30p7Rxxr1EwVJRIzOM5GMYRY/ l7Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=EE2LOh0Y; 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 ex15-20020a170907954f00b0087577d15839si1453903ejc.976.2023.02.08.23.43.45; Wed, 08 Feb 2023 23:44:08 -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=EE2LOh0Y; 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 S229890AbjBIHla (ORCPT + 99 others); Thu, 9 Feb 2023 02:41:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbjBIHlR (ORCPT ); Thu, 9 Feb 2023 02:41:17 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDE0F43470; Wed, 8 Feb 2023 23:40:57 -0800 (PST) X-UUID: 1306b3c6a84d11ed945fc101203acc17-20230209 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=dVz6vc3eyai2hn+5fD9Ytby63sjqKarwLIkq8BPsPkM=; b=EE2LOh0YbJAvSP6/d9A6UxSvrvLSx4IDri0gHqSY/7EIdZhj81kBR9z4RUSY2EaEFXlx8iRZxziUzivxuL6Zc5xbOi/f0K1DvEj1fFCyD9mgkopBcoGJMfZw/2hpzvEL2fjsIRCrJjnCkKEmsHGwpc44TJSk8ixSJltk9XXXHOA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:fe7891a0-21a9-4b63-8388-e25ffbdd9fa2,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:fe7891a0-21a9-4b63-8388-e25ffbdd9fa2,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:5f05608e-8530-4eff-9f77-222cf6e2895b,B ulkID:230209154050KQ4I27VN,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 1306b3c6a84d11ed945fc101203acc17-20230209 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2083672243; Thu, 09 Feb 2023 15:40:50 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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; Thu, 9 Feb 2023 15:40:49 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 9 Feb 2023 15:40:49 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v4 09/12] remoteproc: mediatek: Setup MT8195 SCP core 1 SRAM offset Date: Thu, 9 Feb 2023 15:40:18 +0800 Message-ID: <20230209074021.13936-10-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230209074021.13936-1-tinghan.shen@mediatek.com> References: <20230209074021.13936-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?1757338558481067943?= X-GMAIL-MSGID: =?utf-8?q?1757338558481067943?= 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 e7d4f279c55e..cfcb719ba50b 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 Thu Feb 9 07:40:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 54785 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp192944wrn; Wed, 8 Feb 2023 23:43:39 -0800 (PST) X-Google-Smtp-Source: AK7set9bN4uBX77lOqCouPSMxl7rdbXLBXcWqCyR/zZ2p0V0xRs0FAFLCYBPKBufTqX7sNSau3Yy X-Received: by 2002:a50:9f8e:0:b0:4ab:15e0:3a23 with SMTP id c14-20020a509f8e000000b004ab15e03a23mr3812709edf.27.1675928619372; Wed, 08 Feb 2023 23:43:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675928619; cv=none; d=google.com; s=arc-20160816; b=nUS1AnOEnNWjPh3QjceRRETY2kt6Zwvz0eFOrAnP7x+2aLJWVEjBzY55RUSu2P7An6 PBFUYhLbqexOXNx3w/mONKDQ1Jb4D9VZMy4TaZ72IUA7PXyoqqkzDxc+Q7l2K6hGlhRS n8Wku3iBTzv3m9md6kBc3voYrGwPEgdUqW8f/tybrZi1DoUD+36mO5trqYGxd+eQSNRK JwPb43sGL8zoLQIF83gqf17yRNgockzWiuMjujlCm0F2tuvb2aJHbPqbrzc8Oga2Se/l /vzlvsLJSefCq7nwLwIPJzokUrb5FFIAlZ1ZI6WqB5+1oBY1wHcwJ85+8QUnTYO1jYGt UY6w== 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=7xiAfnOqX4kPRWDvDDlNPFQWGek+/qyXH+pPVezKcA4=; b=T67/+sNPTjmYLk4msfLtKdjZS5mtLqQSBwT7L8YjO93kRNiQkZaEfjvBRpkFT86jcF JSnrxGHwOBILlrv1+Hc0uDl2LEKWulXWBd+96o+14p55GueyVl9BdyrvLCI8/WK068Wu rL7bmWjF8rNA4pHXivpEdWr6EI9EsHZ/4MNCwXv+uUdepribBYBIQRCYPd1jPve9+e3W nZgx9O5uyb+4YiMQ03DAzvR1FvzFchKegkXK1IIr6f3Ghw32LNLgCVUIm9NmrjyBTFkV DjphoMyLEP7SCeKGxUjfgiyWQ08xCwPF0+546fnuXZm5O5EEtK5PJMBuOf+9PiQzTZ0K piUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=PhQIITmo; 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 w1-20020a056402128100b004ab24e8041fsi18378edv.583.2023.02.08.23.43.16; Wed, 08 Feb 2023 23:43:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=PhQIITmo; 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 S229958AbjBIHlR (ORCPT + 99 others); Thu, 9 Feb 2023 02:41:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229718AbjBIHlL (ORCPT ); Thu, 9 Feb 2023 02:41:11 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4BB1442F1; Wed, 8 Feb 2023 23:40:56 -0800 (PST) X-UUID: 12ecfccea84d11eda06fc9ecc4dadd91-20230209 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=7xiAfnOqX4kPRWDvDDlNPFQWGek+/qyXH+pPVezKcA4=; b=PhQIITmo2GymqU1y9gNcO2LUWr0QXmQh16wsNI5XdYkubeO+CkSZ3FP3F41cC+MMeCbaMogkdqifDIz8+4wGwCePYWShIpywqsaFaKnfaXCDRNWIVI1bNHWEKiEYWx/ZH6JJcDDG/V/ngZX5gLU1EJvFfHfA2iKIyurd+69iV+E=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:08e3391a-8d36-415a-bc3b-ad13f65327a6,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:a205608e-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: 12ecfccea84d11eda06fc9ecc4dadd91-20230209 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 733348592; Thu, 09 Feb 2023 15:40:50 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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; Thu, 9 Feb 2023 15:40:49 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 9 Feb 2023 15:40:49 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v4 10/12] remoteproc: mediatek: Handle MT8195 SCP core 1 watchdog timeout Date: Thu, 9 Feb 2023 15:40:19 +0800 Message-ID: <20230209074021.13936-11-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230209074021.13936-1-tinghan.shen@mediatek.com> References: <20230209074021.13936-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?1757338528002580022?= X-GMAIL-MSGID: =?utf-8?q?1757338528002580022?= 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 --- drivers/remoteproc/mtk_common.h | 4 ++++ drivers/remoteproc/mtk_scp.c | 24 +++++++++++++++++++++++- 2 files changed, 27 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 cfcb719ba50b..9fbbc4751433 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -222,6 +222,28 @@ 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_CORE1_WDT) + writel(1, scp->reg_base + MT8195_CORE1_WDT_IRQ); + else + writel(1, scp->reg_base + MT8192_CORE0_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; @@ -1260,7 +1282,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 Thu Feb 9 07:40: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: 54787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp193019wrn; Wed, 8 Feb 2023 23:43:56 -0800 (PST) X-Google-Smtp-Source: AK7set8nAkOZLOOiBWq+cwEhmJW4XMI1uzOaWZPG7tYXQ/hWcpL+13Qmfw/xvVEtDA0K/GP8MbHl X-Received: by 2002:a50:cd4f:0:b0:4aa:aaf6:e6be with SMTP id d15-20020a50cd4f000000b004aaaaf6e6bemr10899252edj.7.1675928636720; Wed, 08 Feb 2023 23:43:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675928636; cv=none; d=google.com; s=arc-20160816; b=Nt7meVEzynZj6WFeEeqWqmVkPC7lneUiAIL4o1zU+g6fjRtBeb9pXlsi6BfUjRcGSq rs034i0T81u+VCYUAY0yrveyEOvOm9wEpiIJVrgaD/SFGY50keGBXi8GgQcvR9P516JZ 60nXLQXxn1nDlcRMLSkDA3I3JcvZW5Y+zvGsytdSF6txstfKYrVMCwhu2/wjAPCbXsRR IE0nMj1B3Holn8gZavoUb3M1QaGELjJ1FHU/gFd8aKFSNzk5gH380jqwj0v9XWXqC/cp WFg6fYIne9fapQnRysm+SlQ5kFbQXXUgVYRpe/+jCT1gEo3FYSxYPR2B7EOe6O33hRcT jmAw== 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=S6Mq9pK7uzND1xJ/3DSsEG33Y6Jr24ocdvtiHLbAez4=; b=FPjDSZd7+uQtyMaoJr33JxXRJG3fdzJUP4gnZ3s7gxB2ynD4jCc44ERgnlcIGg+6rN i2e7Yju1B0jLFzKua5qnk0mN8QyISQvGPlyF3EqL366rMO9WaGBZNTCPrRdr+eMVwAv2 4/GCkFdRJgeKf2so8vhv5UDeAP59y0YzgGn25o0L0GuRKlXubhZ8Jg+vx/EfudH+xItZ iwIHDMNBij1nYLGNyKiq8oF+W4NNnO30wllkzT7LjJGlfBFcNSVgyqtpRZe9Iejwgzgb 0UudiLq8fh5zE1H1X+ZC+/q8DehCvwxQ1ArNIjRKiNULAl3H1AZap7YvYoQHomynWHIm Gpmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=EpSHpAaM; 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 z2-20020a50eb42000000b004862741e037si1475952edp.96.2023.02.08.23.43.32; Wed, 08 Feb 2023 23:43:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=EpSHpAaM; 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 S229582AbjBIHlZ (ORCPT + 99 others); Thu, 9 Feb 2023 02:41:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbjBIHlP (ORCPT ); Thu, 9 Feb 2023 02:41:15 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F003042DC2; Wed, 8 Feb 2023 23:40:57 -0800 (PST) X-UUID: 132f9e3aa84d11eda06fc9ecc4dadd91-20230209 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=S6Mq9pK7uzND1xJ/3DSsEG33Y6Jr24ocdvtiHLbAez4=; b=EpSHpAaM0QRH26Wnk04HqOSyJHhIah9bjxBaCBmV7UoyhQg2zYbMUbWFuQXa2U/Chcco05o9zTJu4forvWUIN3hMwqGL1H6ZXVic8Kb+HmbFO9UD7EZNJWiiVYiOfBaZ52IZ4K2UUa1Sae5Vmig/rVCz8pZwYNQlb0ctd2J3xws=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:9fa1e89a-6f03-4b3c-a736-99fdc361218a,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:9fa1e89a-6f03-4b3c-a736-99fdc361218a,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:9919eff7-ff42-4fb0-b929-626456a83c14,B ulkID:230209154053KNHL0A2H,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: 132f9e3aa84d11eda06fc9ecc4dadd91-20230209 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1113630738; Thu, 09 Feb 2023 15:40:50 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Thu, 9 Feb 2023 15:40:50 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 9 Feb 2023 15:40:50 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v4 11/12] remoteproc: mediatek: Refine ipi handler error message Date: Thu, 9 Feb 2023 15:40:20 +0800 Message-ID: <20230209074021.13936-12-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230209074021.13936-1-tinghan.shen@mediatek.com> References: <20230209074021.13936-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?1757338546062084461?= X-GMAIL-MSGID: =?utf-8?q?1757338546062084461?= 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 9fbbc4751433..16b5de589d07 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 Thu Feb 9 07:40: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: 54790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp193216wrn; Wed, 8 Feb 2023 23:44:29 -0800 (PST) X-Google-Smtp-Source: AK7set/c9n1jmMudNf87Pmse5E+rAL8MQ5VAYFuCQRPjWkowQRQHkzj4IyV9kNZLQUoQEYUQIvUM X-Received: by 2002:a17:906:5952:b0:885:dd71:89b5 with SMTP id g18-20020a170906595200b00885dd7189b5mr10818061ejr.41.1675928669804; Wed, 08 Feb 2023 23:44:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675928669; cv=none; d=google.com; s=arc-20160816; b=SaO9wRnt29+ZddaHZSJG24KPpjDE3F0D1yVBlbncbpaCgt6fVDZDTr74mq+lHnxqbr 89zVKSqG+wc+a7/aOzFhrpNzxKVkSTWDu8TQ1hE/uYdap/qKRiql8kztKKWthVgPutF3 7wkVe3tEXFY/gT+6wBztMNV9DCtdqw8CzgYdZwoExPa6S+//H8LW80wQZsPYJmjMdW6c 6iYWZX8sg8tJD1rLOhnnOs7DdeQHEq9lqEG1evs99l1JMVUlNf4BoDOb7CQuLmOwwBbr nlSSKIhM1fdadOPy/UFao+HRi0BIF75pzmPlD9RQFL+tk195ic3+qbf/Sc2LJBJbRGEd PrwQ== 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=dYPWiDH4R92aN0AYpmQ/PyKucrq9WvbZ+OXPJvTjISKsbCirKj6qkNXdMgyctmEPj0 yea5MX25waL2IqM2V+VRDhzWZRY2m2MhEyO5/eq17Q5oAFRHWv88qNJM4teH2LWx8jIF tVbwnFA4Qg7REK8L7m3phnWSEAX1LPpuFA6D78ZqvUr44WckmH7dOr0mFVlpr47Nf7Xl m/9tzcBNSNL3//AncaYl9WYZ7PXBtU4oynxilv1vvpvgznqWi5AK8RD6bxxML66eW82K zlx86aShNLgtmsq6b4EPklXmTZds9eASDtslsJt+Z0+LY9t/FGFTWhVfvIe+c6SG8jCs iwbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=pudEEpO5; 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 d14-20020a05640208ce00b004ab066f6dfesi1431861edz.374.2023.02.08.23.44.06; Wed, 08 Feb 2023 23:44: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=pudEEpO5; 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 S230006AbjBIHlo (ORCPT + 99 others); Thu, 9 Feb 2023 02:41:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229990AbjBIHlW (ORCPT ); Thu, 9 Feb 2023 02:41:22 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 926EF2384B; Wed, 8 Feb 2023 23:40:59 -0800 (PST) X-UUID: 13bc13eca84d11ed945fc101203acc17-20230209 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=pudEEpO5cMjttMyipwJAWCSPj29GnQXjosMBNxvY1aujw5MAaipRvHuqmDiG07CRgzhSKclPD3jma3UQO8qlmr8B42nj90AEAeHTz2qXNdAJSs5sV+/OZRlTj1vfIjOF1qVpX3S4ZkJpaLWR34blh9So9uMpN0WnFED/tLbbNW0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:00705716-0ee7-46b5-95e5-0420e5b78545,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:b519eff7-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: 13bc13eca84d11ed945fc101203acc17-20230209 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 257639458; Thu, 09 Feb 2023 15:40:51 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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; Thu, 9 Feb 2023 15:40:50 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 9 Feb 2023 15:40:50 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Matthias Brugger , AngeloGioacchino Del Regno , Tinghan Shen CC: , , , , , Subject: [PATCH v4 12/12] arm64: dts: mediatek: mt8195: Add SCP 2nd core Date: Thu, 9 Feb 2023 15:40:21 +0800 Message-ID: <20230209074021.13936-13-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230209074021.13936-1-tinghan.shen@mediatek.com> References: <20230209074021.13936-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?1757338581203167091?= X-GMAIL-MSGID: =?utf-8?q?1757338581203167091?= 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 --- .../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 {