From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33CAEC77B73 for ; Tue, 2 May 2023 08:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:In-Reply-To: References:Message-ID:Date:Subject:CC:To:From:Reply-To:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=umu5HohJFpufgl1gCOeIOKaJZS6kdm7RXy8h6KdwP48=; b=g+sIst9M6H5jMZ 9yhY9Dh+cYAUjA1lfEZ3rd+w03MorFAQBLDtkcdr86mg8rfD4lcZgLTYCCLKic0kjgNLTKD9JJo2d /i+G4K3ApmuT3dnexzH6YDnhfik8Z+BQ61Z1dJnMWEcRQRzKLuXlO3wMfC6ECGdfyUXXdosQtNb03 1wClfF25zRhDJfm/GpnpdaC4l9lfs1ocNjkk6Z+oWQNuE5u8etpSj/rmfwYBBvmr7COOlvKvnD3qo E9hiYwplCwVAcfa3pkSyEVG05Byl3aXzIRD4KjkA5KjYHGHlGRXIwa7Ui8FSZQaJ7qbyl18S81i+O AkxCEM0t9axmFmBuxpDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ptlpc-000hZ4-2W; Tue, 02 May 2023 08:57:56 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ptlpY-000hWs-1X; Tue, 02 May 2023 08:57:54 +0000 X-UUID: 66af0d7ee8c711ed83ed1395ce914268-20230502 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=MIME-Version:Content-Transfer-Encoding:Content-ID:Content-Type:In-Reply-To:References:Message-ID:Date:Subject:CC:To:From; bh=BCfpHz/wR4u/e4rxd1pFYevBPB3LGYgYrOLlOFZH1u4=; b=ZLuxnZbysp1wqgNm+wBF248zQA16OmFJiwllRg7McqLZv1vCRuhMPezCtu47pclLaXr9D/Zym2x9io6cBw3at1mXrBueJioN0eNXxJj/ia0d+rR7+Tm2OTHeJ9iOl1F+XVjYLLhMezVFCmB1+fF4e8wg9qhP2bOF+XejWHbqLs8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:1367bd0a-9e22-44d2-b58d-4d2aac12239c,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:120426c,CLOUDID:36b0826a-2f20-4998-991c-3b78627e4938,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-CID-BAS: 0,_,0,_ X-UUID: 66af0d7ee8c711ed83ed1395ce914268-20230502 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1001039948; Tue, 02 May 2023 01:57:43 -0700 Received: from mtkmbs10n2.mediatek.inc (172.21.101.183) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 2 May 2023 16:57:41 +0800 Received: from APC01-SG2-obe.outbound.protection.outlook.com (172.21.101.237) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 2 May 2023 16:57:41 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GIH4gwWJd54QBeJKnqIQINFGRIMht1tJZ92W5etpE716gjQzQ3N+66r1d4/qeyrzGHnAsIVW+oq0M+B+TXBtYQ3euNTIaaFQ6ckT2jsu64hQpEvUW7DV57uhLWoDIhxoeSZOvjMMAmHDIE0WrcsmqkW734rkD4DVHxIE/9cqZZIqeXxO+msZAuvnxuePN3hqwF6bS5XIlNa5X1jcX3mglkJe2FkMZkzBOF9HuD6CKbKMQbnOlpgFfTfex6+h8fk9C9SW9hLe3Nc0Fu5ZvOiygsGXPrXYzmRX6kgde2w7JwNlgzG7wESG23EWsDTJOXmNcUzYCObioj+ja33VjB6v0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BCfpHz/wR4u/e4rxd1pFYevBPB3LGYgYrOLlOFZH1u4=; b=Uwa+TF2t/7eYGe8p1IsJXwHoebOk93TGx8dwNPP58k+I3/lmM4igBG8iKKqQJX0eq8T5amYLAhuEXEv4X1RpHdIB6OjBcEgp9KR3mlLNvAgUM+PjPaAi0xWghW4i1aAYP0Jyj3DA0BBv6mmP3rFGyULSPjGqXTshyOAOTmjQusELH3lgloagy8SQ409t73CEQeL/FkQqYTxL46ojlr836sdJZQ1nYRIVwjIr/U582QFX6bU9N8rjV5QEDOHf4O2rREtVzMfe3bIl6R72mcY+Lfv1IwfMxjxFUorYbXEgIUXiF+/hYIJ6/PGgUQnvWRP2FH0KsNy8YDT7S/5m63W/CQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mediatek.com; dmarc=pass action=none header.from=mediatek.com; dkim=pass header.d=mediatek.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mediateko365.onmicrosoft.com; s=selector2-mediateko365-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BCfpHz/wR4u/e4rxd1pFYevBPB3LGYgYrOLlOFZH1u4=; b=Al5HtM1TBNn6JMNXaKZ2tvQ4BzNUQLlZ1qsrjEzWRRSNuwkYDtIdknNzddDPIr2P5NAMNH8I40uDPEowyj2BfDkRDeT2M5gFpC6+70Ltfck8qoUNH4aOxaQn1UxkqXx1zPBsI6hZ84fDq3lUa7dZgeURcS4QnWlOLz+zVdBDUaA= Received: from SL2PR03MB4204.apcprd03.prod.outlook.com (2603:1096:100:53::15) by SEZPR03MB6524.apcprd03.prod.outlook.com (2603:1096:101:73::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.31; Tue, 2 May 2023 08:57:37 +0000 Received: from SL2PR03MB4204.apcprd03.prod.outlook.com ([fe80::d9b0:e117:9f08:3475]) by SL2PR03MB4204.apcprd03.prod.outlook.com ([fe80::d9b0:e117:9f08:3475%3]) with mapi id 15.20.6340.031; Tue, 2 May 2023 08:57:37 +0000 From: =?utf-8?B?VGluZ0hhbiBTaGVuICjmsojlu7fnv7Ap?= To: "mathieu.poirier@linaro.org" CC: "linux-kernel@vger.kernel.org" , "robh+dt@kernel.org" , "linux-remoteproc@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-mediatek@lists.infradead.org" , Project_Global_Chrome_Upstream_Group , "linux-arm-kernel@lists.infradead.org" , "krzysztof.kozlowski+dt@linaro.org" , "matthias.bgg@gmail.com" , "andersson@kernel.org" , "angelogioacchino.delregno@collabora.com" Subject: Re: [PATCH v10 06/11] remoteproc: mediatek: Probe multi-core SCP Thread-Topic: [PATCH v10 06/11] remoteproc: mediatek: Probe multi-core SCP Thread-Index: AQHZeB9FDz0C7eaAxky1XpGlyjqGd69GCPqAgACvDYA= Date: Tue, 2 May 2023 08:57:37 +0000 Message-ID: References: <20230426091211.21557-1-tinghan.shen@mediatek.com> <20230426091211.21557-7-tinghan.shen@mediatek.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mediatek.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SL2PR03MB4204:EE_|SEZPR03MB6524:EE_ x-ms-office365-filtering-correlation-id: d7a503b6-0313-48f1-71ba-08db4aeb471c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Cqvn+YwmPkHHqEI7UpQD8Fr8v3jkRjjwKm3Z0MkGNOMWeDrUvFrnve7mpVx7akjspxeFQUsxK/tLuahKpfBtxnmUWEzNK8fjRNBCYVZNGx4XApuCVJWQqO0ZCtNIzjnhYKV9A/AdrTVH7Iv843W82z8ZPAsIHdQ50FROs3plN8om/pvpw2VJGRyiTQ/yun1U0yZqXTKX4WhICrVzfO8B36v3uQzITFaGfJJL2cZH3gKotyIm9R6TO+8tog0feos/3+aLZvX8hGvJh1A4I52k+RCdOVpNt90r+u2Z/PpFSqUrx/RM5Kz3vY/VdKxH+qqH0zFTtmsBVf5kf3YiwjDiRW9MFMwjR6EkpI18900YanNgNVVzvr2xypfSOtKL2Hk73mVgUkxwKDDANajlC9diwvnbMNgU4P3MfIcF8vp/tDB0xNMuWUn3G4TqWflHGaroYaReNBBcnqkZiMW8sfsVVwf0X2+8CdrF4pKNR27Qf6DwBtBczhvOsDENw6yonXH4IONA2nmqHoisQcSwpHRULI87WF2zR2Npfnv2+DI3fGMp9xZzVQR2b77TkYWCJkhzAFF3TLrkXKmEXeUWX7YvDaDdGlsYmrvVQ0S45jkyFjUFQ/WwKP0YwD99GSdUVVYYmCpgO8IiB4uC7n7T3LYAVqwkOXr1WvMpp9ZRSGoReD4= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SL2PR03MB4204.apcprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(136003)(376002)(396003)(39860400002)(346002)(451199021)(54906003)(2616005)(83380400001)(478600001)(6512007)(6486002)(71200400001)(26005)(6506007)(91956017)(316002)(66476007)(186003)(76116006)(4326008)(66446008)(66556008)(6916009)(64756008)(66946007)(8936002)(122000001)(41300700001)(8676002)(5660300002)(7416002)(30864003)(2906002)(38100700002)(38070700005)(86362001)(36756003)(85182001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?aVBZcXd4V0xFUmx3NnNFaEFUTi95c0I5Y0hZWWNidFRjb0lpNnlxNzBFdUNy?= =?utf-8?B?M1l4QldEZjdFcjNPRXNhM3VzK0h0Wno0OXlzQjM3TVFFd2tqNndRWHhtemZM?= =?utf-8?B?cmt5eTB4dnMzcGhKbkxMMGpyQkJmaU9DSHZvTUg1MDI1SG1rS1RiUmhZaWZM?= =?utf-8?B?Q1g5VzBseVFvaXZFVndCdWpqUGZrbE1MSnlBdzQ4ZFU3ak5jVFpPZU1aTXdt?= =?utf-8?B?UEQ5TnNLREgwTENJYXVsTGxhOEFXV1liYk9UVWtWMUpyLzRMbXJiMXllRStt?= =?utf-8?B?WHFPTEtidU9XcWlKYW9yU3FNaEc4R1pwdVh4RDBDdVN0YVgrNlAyNElQdmY4?= =?utf-8?B?cWpIalNXSXNsbzlLenZDd0wwTzlFSDByRGo2S1B6RUNpY3RiSmw1VkQwamVz?= =?utf-8?B?NVo1e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: Internal X-MS-Exchange-CrossTenant-AuthSource: SL2PR03MB4204.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7a503b6-0313-48f1-71ba-08db4aeb471c X-MS-Exchange-CrossTenant-originalarrivaltime: 02 May 2023 08:57:37.3724 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a7687ede-7a6b-4ef6-bace-642f677fbe31 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 53UWQu8LJWfPU84PJMfIfnTXSYpCkZs+q1DqT1cmSBKVVXRyA/02vHk6u4zzHoPqENUugabsHTMDuk0y0gY3lHEV97EtYlx5loTOlQGDKmg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR03MB6524 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230502_015752_578472_92428C30 X-CRM114-Status: GOOD ( 26.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 2023-05-01 at 16:31 -0600, Mathieu Poirier wrote: > External email : Please do not click links or open attachments until you have verified the sender or the content. > > > On Wed, Apr 26, 2023 at 05:12:06PM +0800, Tinghan Shen wrote: > > 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. > > > > Add the remoteproc instances for single-core SCP and multi-core SCP to > > the new added SCP cluster list. When the SCP driver is removed, it > > cleanup resources by walking through the cluster list. > > > > Signed-off-by: Tinghan Shen > > --- > > drivers/remoteproc/mtk_common.h | 3 + > > drivers/remoteproc/mtk_scp.c | 188 ++++++++++++++++++++++++++++---- > > 2 files changed, 172 insertions(+), 19 deletions(-) > > > > diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h > > index c0905aec3b4b..b73b60c22ea1 100644 > > --- a/drivers/remoteproc/mtk_common.h > > +++ b/drivers/remoteproc/mtk_common.h > > @@ -128,6 +128,9 @@ struct mtk_scp { > > size_t dram_size; > > > > struct rproc_subdev *rpmsg_subdev; > > + > > + struct list_head elem; > > + struct list_head *cluster; > > }; > > > > /** > > diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c > > index 5e4982f4d5dc..0b052b0acf2e 100644 > > --- a/drivers/remoteproc/mtk_scp.c > > +++ b/drivers/remoteproc/mtk_scp.c > > @@ -28,6 +28,7 @@ struct mtk_scp_of_cluster { > > void __iomem *l1tcm_base; > > size_t l1tcm_size; > > phys_addr_t l1tcm_phys; > > + struct list_head mtk_scp_cluster; > > }; > > > > /** > > @@ -862,21 +863,31 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) > > } > > } > > > > -static int scp_rproc_init(struct platform_device *pdev) > > +static int scp_rproc_init(struct platform_device *cluster_pdev, > > + struct platform_device *core_pdev, > > + const struct mtk_scp_of_data *of_data) > > { > > - struct device *dev = &pdev->dev; > > - struct device_node *np = dev->of_node; > > - struct mtk_scp_of_cluster *of_cluster = platform_get_drvdata(pdev); > > + struct platform_device *pdev; > > + struct device *dev; > > + struct device_node *np; > > + struct mtk_scp_of_cluster *of_cluster = platform_get_drvdata(cluster_pdev); > > struct mtk_scp *scp; > > struct rproc *rproc; > > struct resource *res; > > const char *fw_name = "scp.img"; > > int ret, i; > > > > + if (core_pdev) > > + pdev = core_pdev; > > + else > > + pdev = cluster_pdev; > > After following my comment from the previous patch, there won't be a need to do > this. > > > + > > + dev = &pdev->dev; > > ret = rproc_of_parse_firmware(dev, 0, &fw_name); > > if (ret < 0 && ret != -EINVAL) > > return ret; > > > > + np = dev->of_node; > > rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp)); > > if (!rproc) > > return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n"); > > @@ -884,7 +895,7 @@ static int scp_rproc_init(struct platform_device *pdev) > > scp = rproc->priv; > > scp->rproc = rproc; > > scp->dev = dev; > > - scp->data = of_device_get_match_data(dev); > > + scp->data = of_data; > > platform_set_drvdata(pdev, scp); > > > > scp->reg_base = of_cluster->reg_base; > > @@ -934,10 +945,6 @@ static int scp_rproc_init(struct platform_device *pdev) > > goto remove_subdev; > > } > > > > - ret = rproc_add(rproc); > > - if (ret) > > - goto remove_subdev; > > - > > return 0; > > > > remove_subdev: > > @@ -952,6 +959,121 @@ 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 int scp_is_single_core(struct platform_device *pdev) > > +{ > > + struct device *dev = &pdev->dev; > > + struct device_node *np = dev_of_node(dev); > > + struct device_node *child; > > + > > + child = of_get_next_available_child(np, NULL); > > + if (!child) > > + return dev_err_probe(dev, -ENODEV, "No child node\n"); > > + > > + of_node_put(child); > > + return of_node_name_eq(child, "cros-ec-rpmsg"); > > +} > > + > > +static int scp_cluster_init(struct platform_device *pdev) > > +{ > > + struct device *dev = &pdev->dev; > > + struct device_node *np = dev_of_node(dev); > > + struct platform_device *cpdev; > > + struct device_node *child; > > + struct mtk_scp_of_cluster *of_cluster = platform_get_drvdata(pdev); > > + const struct mtk_scp_of_data **cluster_of_data; > > + struct list_head *cluster = &of_cluster->mtk_scp_cluster; > > + struct mtk_scp *scp, *temp; > > + int core_id = 0; > > + int ret; > > + > > + ret = scp_is_single_core(pdev); > > + if (ret < 0) > > + return ret; > > + > > + if (ret) { > > + dev_dbg(dev, "single-core scp\n"); > > + > > + /* When using the SCP node phandle on exported SCP APIs, the drvdata > > + * is expected to be the mtk_scp object, and as a result, it is intended > > + * to be overwritten for single-core SCP usage. > > + */ > > + ret = scp_rproc_init(pdev, NULL, of_device_get_match_data(dev)); > > + if (ret) > > + return dev_err_probe(dev, ret, "Failed to initialize single-core scp\n"); > > + > > + scp = platform_get_drvdata(pdev); > > + list_add_tail(&scp->elem, cluster); > > + scp->cluster = cluster; > > + } else { > > + dev_dbg(dev, "multi-core scp\n"); > > + > > + cluster_of_data = (const struct mtk_scp_of_data **)of_device_get_match_data(dev); > > + > > + for_each_available_child_of_node(np, child) { > > + if (!cluster_of_data[core_id]) { > > + 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(pdev, cpdev, cluster_of_data[core_id]); > > + if (ret) { > > + dev_err(dev, "Failed to initialize core %d rproc\n", core_id); > > + put_device(&cpdev->dev); > > + of_node_put(child); > > + goto init_fail; > > + } > > + scp = platform_get_drvdata(cpdev); > > + list_add_tail(&scp->elem, cluster); > > + scp->cluster = cluster; > > + put_device(&cpdev->dev); > > + > > + core_id++; > > + } > > + } > > + > > + list_for_each_entry_safe_reverse(scp, temp, cluster, elem) { > > + ret = rproc_add(scp->rproc); > > + if (ret) > > + goto add_fail; > > + } > > + > > + return 0; > > + > > +add_fail: > > + list_for_each_entry_continue(scp, cluster, elem) { > > + rproc_del(scp->rproc); > > + } > > +init_fail: > > + list_for_each_entry_safe_reverse(scp, temp, cluster, elem) { > > + list_del(&scp->elem); > > + scp_rproc_free(scp); > > + } > > + > > + return ret; > > +} > > + > > static int scp_probe(struct platform_device *pdev) > > { > > struct device *dev = &pdev->dev; > > @@ -983,23 +1105,44 @@ static int scp_probe(struct platform_device *pdev) > > of_cluster->l1tcm_phys = res->start; > > } > > > > + INIT_LIST_HEAD(&of_cluster->mtk_scp_cluster); > > platform_set_drvdata(pdev, of_cluster); > > > > - return scp_rproc_init(pdev); > > + ret = devm_of_platform_populate(dev); > > + if (ret) > > + return dev_err_probe(dev, ret, "Failed to populate platform devices\n"); > > + > > + ret = scp_cluster_init(pdev); > > + if (ret) > > + return dev_err_probe(dev, ret, "Failed to initialize scp cluster\n"); > > + > > + return 0; > > } > > > > static int scp_remove(struct platform_device *pdev) > > { > > - struct mtk_scp *scp = platform_get_drvdata(pdev); > > - int i; > > + struct mtk_scp *scp, *temp; > > + struct mtk_scp_of_cluster *of_cluster; > > + struct list_head *cluster; > > + int ret; > > > > - 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); > > + ret = scp_is_single_core(pdev); > > + if (ret < 0) > > + return ret; > > + > > + if (ret) { > > + scp = platform_get_drvdata(pdev); > > + cluster = scp->cluster; > > + } else { > > + of_cluster = platform_get_drvdata(pdev); > > + cluster = &of_cluster->mtk_scp_cluster; > > + } > > If single and multi core systems were presented the same way, i.e with a cluster > and a list of SCPs, you wouldn't have to do this. I will stop here for this > revision. > > Thanks, > Mathieu I've been hesitant as to whether I can present the single and multi core systems in the same way since version 1 of this series. I was mad aware that the upstream kernel driver must retain compatibility with the current device trees when introducing a new device tree format. If it's acceptable, I'll adjust all the single-core SCP dts file and dt-bindings conform to this format in the next version. Best regards, TingHan > > > + > > + list_for_each_entry_safe_reverse(scp, temp, cluster, elem) { > > + list_del(&scp->elem); > > + rproc_del(scp->rproc); > > + scp_rproc_free(scp); > > + } > > > > return 0; > > } > > @@ -1078,12 +1221,19 @@ static const struct mtk_scp_of_data mt8195_of_data_c1 = { > > .host_to_scp_int_bit = MT8195_CORE1_HOST_IPC_INT_BIT, > > }; > > > > +static const struct mtk_scp_of_data *mt8195_of_data_cores[] = { > > + &mt8195_of_data, > > + &mt8195_of_data_c1, > > + NULL > > +}; > > + > > static const struct of_device_id mtk_scp_of_match[] = { > > { .compatible = "mediatek,mt8183-scp", .data = &mt8183_of_data }, > > { .compatible = "mediatek,mt8186-scp", .data = &mt8186_of_data }, > > { .compatible = "mediatek,mt8188-scp", .data = &mt8188_of_data }, > > { .compatible = "mediatek,mt8192-scp", .data = &mt8192_of_data }, > > { .compatible = "mediatek,mt8195-scp", .data = &mt8195_of_data }, > > + { .compatible = "mediatek,mt8195-scp-dual", .data = &mt8195_of_data_cores }, > > {}, > > }; > > MODULE_DEVICE_TABLE(of, mtk_scp_of_match); > > -- > > 2.18.0 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel