Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp365317rwb; Mon, 26 Sep 2022 20:52:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gDs9x3VrJkdIcvWOHYEKFfQFw0gfTgdG8ep2qoTOp8uuARy+dDAKLnFgcmNdT32ItFzmb X-Received: by 2002:a05:6402:448c:b0:457:52eb:b57e with SMTP id er12-20020a056402448c00b0045752ebb57emr7381958edb.178.1664250736457; Mon, 26 Sep 2022 20:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664250736; cv=none; d=google.com; s=arc-20160816; b=rF/WpqfwHHrWaKYYqRkkRI1VmqCe2H3ObhOvTBm/zpgkmP6X0Vg2RaaaASR6fWnK++ 4nR82hPK8j/+42E72HF8J66Z98luwF4M1yN8JYyPVVY4BXiOz11G2zfxW6phszOHhJuF Z08hICbP93HMoSUloBbO/DB6kSnAARwWLtSBfii18OmUA4DF0tjilGjEzgskxgaMRIaj 8w5nkd3e0vnBHaaGUf88t+I6PpZgTchZq04ErKjAFkMC2nEoP+Rgwx5pu5m1eT72CT8i sLAw1rR/fSofClZlYD5CHxKgsyVAhbs14K5EBr+cKJVMf39CGdcyn47i5kr8ztaFQ+u8 9neg== 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=blmqKbkOqJ3bm+VIPRnf3ApIWn+jpGpeWx+PBPZNgSI=; b=V8jjbnVPaE/FGxhqpMH7tGhCga7cOkrJmF+jZ08ratONJOucjiz5UaKW/XSKnamIKH SAIlNV47sljEmPXa0Wmw00MpSy/k4yGFQyyOxJp+KLppESoTOXKvFBOH33SHRfHRD/xO qO9l9sYAzWTCbCbSo1DmdgldfFT8YAjV5ngzQ18xRGlaQURl+25K4Gsug2ugVkQtRPfJ Njg7+qko1sccyqr7EZL2QBe/bqAaPESzkr3ucwbh1DYrfJauTQTa14sizTAXWnzBrlsv JeA4UluCy/g09Fih0uX0+hj5ADZJT0L7548S5WdNKfZL5lTpP70sjQ8Zzso0f/tJ+1N8 vUwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=OWe1+Njg; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv13-20020a17090760cd00b00782650a2738si204073ejc.24.2022.09.26.20.51.49; Mon, 26 Sep 2022 20:52:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=OWe1+Njg; 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 S231181AbiI0DAg (ORCPT + 99 others); Mon, 26 Sep 2022 23:00:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230454AbiI0C7F (ORCPT ); Mon, 26 Sep 2022 22:59:05 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABE95A6C31; Mon, 26 Sep 2022 19:56:38 -0700 (PDT) X-UUID: 7beb1adeac91421b9d5875bd5dce1d9c-20220927 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=blmqKbkOqJ3bm+VIPRnf3ApIWn+jpGpeWx+PBPZNgSI=; b=OWe1+NjgTH7mgsHIJLASh4VKtrSZx5hcd4grVZdVSLjkEsmB2bw/qaz4XN9uXB7GrgRcZc4nBF/tnL+w4BW8/TeBFNiZojyzIGgqJtLkOn0EudtNZVbNW2on1hbFloUJffOSksbkYMMCOKcsNdp+FLoBiRrcMT1EIGWzgzpeusQ=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.11,REQID:e1347031-a263-46bb-b816-8384aef7365a,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.11,REQID:e1347031-a263-46bb-b816-8384aef7365a,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:39a5ff1,CLOUDID:ba2b51e4-87f9-4bb0-97b6-34957dc0fbbe,B ulkID:220927105630NCDUDJ40,BulkQuantity:0,Recheck:0,SF:38|28|17|19|48|823| 824,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil, COL:0 X-UUID: 7beb1adeac91421b9d5875bd5dce1d9c-20220927 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1581191988; Tue, 27 Sep 2022 10:56:27 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Tue, 27 Sep 2022 10:56:26 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Tue, 27 Sep 2022 10:56:26 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Tiffany Lin , Andrew-CT Chen , Yunfei Dong , Mauro Carvalho Chehab , Tinghan Shen CC: , , , , , Subject: [PATCH v3 07/11] remoteproc: mediatek: Probe MT8195 SCP core 1 Date: Tue, 27 Sep 2022 10:56:02 +0800 Message-ID: <20220927025606.26673-8-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220927025606.26673-1-tinghan.shen@mediatek.com> References: <20220927025606.26673-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.0 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,URIBL_CSS 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 The MT8195 SCP configuration registers for core 0 and core 1 is the same. Let SCP core 1 to reuse the mapped address requested by SCP core 0. Signed-off-by: Tinghan Shen --- drivers/remoteproc/mtk_common.h | 2 ++ drivers/remoteproc/mtk_scp.c | 27 +++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index 3778894c96f3..54265c515315 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -140,6 +140,8 @@ struct mtk_scp { size_t dram_size; struct rproc_subdev *rpmsg_subdev; + + struct mtk_scp *main_scp; }; /** diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 1d17d77b8a14..f7b738743ba9 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -917,10 +917,29 @@ static int scp_probe(struct platform_device *pdev) 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"); + if (of_device_is_compatible(np, "mediatek,mt8195-scp-core")) { + struct device_node *pnp; + struct platform_device *scp_pdev; + + pnp = of_get_parent(np); + if (!pnp) + return dev_err_probe(dev, -ENODEV, "Failed to get parent core 0\n"); + + scp_pdev = of_find_device_by_node(pnp); + of_node_put(pnp); + if (!scp_pdev) + return dev_err_probe(dev, -ENODEV, "Failed to get scp core 0 pdev\n"); + + scp->main_scp = platform_get_drvdata(scp_pdev); + scp->reg_base = scp->main_scp->reg_base; + } else { + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg"); + scp->reg_base = devm_ioremap_resource(dev, res); + + 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) -- 2.18.0