From patchwork Wed Jun 1 11:22:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tinghan Shen X-Patchwork-Id: 12866772 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72CB0646 for ; Wed, 1 Jun 2022 11:22:20 +0000 (UTC) X-UUID: 62499072bd7446e88494232e49fc2887-20220601 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.5,REQID:3adaa018-0038-4699-a42d-4e4d54b3db1c,OB:0,LO B:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:2a19b09,CLOUDID:2f91268a-32d7-4fc0-b2ef-8776ac194f8f,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,QS:0,BEC:nil X-UUID: 62499072bd7446e88494232e49fc2887-20220601 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1861863262; Wed, 01 Jun 2022 19:22:08 +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.3; Wed, 1 Jun 2022 19:22:06 +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.3 via Frontend Transport; Wed, 1 Jun 2022 19:22:06 +0800 From: Tinghan Shen To: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Lee Jones , Benson Leung , Guenter Roeck , Daisuke Nojiri , Sebastian Reichel , "Dustin L. Howett" , Tzung-Bi Shih , Tinghan Shen , "Gustavo A. R. Silva" , Prashant Malani , Enric Balletbo i Serra , Brian Norris CC: , , , , , , , Subject: [PATCH v1 14/15] remoteproc: mediatek: Support rpmsg for SCP core 1 Date: Wed, 1 Jun 2022 19:22:00 +0800 Message-ID: <20220601112201.15510-15-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220601112201.15510-1-tinghan.shen@mediatek.com> References: <20220601112201.15510-1-tinghan.shen@mediatek.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MTK: N Reuse the rpmsg subdevice flow of SCP core 0 on SCP core 1. Signed-off-by: Tinghan Shen --- drivers/remoteproc/mtk_common.h | 3 +++ drivers/remoteproc/mtk_scp.c | 6 ++++-- drivers/remoteproc/mtk_scp_dual.c | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h index 464d013ed6b2..89e2bec0a087 100644 --- a/drivers/remoteproc/mtk_common.h +++ b/drivers/remoteproc/mtk_common.h @@ -185,4 +185,7 @@ void scp_ipi_handler(struct mtk_scp *scp); struct rproc_subdev *scp_dual_create_subdev(struct mtk_scp *scp); void scp_dual_destroy_subdev(struct rproc_subdev *subdev); + +void scp_add_rpmsg_subdev(struct mtk_scp *scp); +void scp_remove_rpmsg_subdev(struct mtk_scp *scp); #endif diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index c7bf0a44ba0d..fbeaa81e914d 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -825,7 +825,7 @@ static struct mtk_rpmsg_info mtk_scp_rpmsg_info = { .ns_ipi_id = SCP_IPI_NS_SERVICE, }; -static void scp_add_rpmsg_subdev(struct mtk_scp *scp) +void scp_add_rpmsg_subdev(struct mtk_scp *scp) { scp->rpmsg_subdev = mtk_rpmsg_create_rproc_subdev(to_platform_device(scp->dev), @@ -833,8 +833,9 @@ static void scp_add_rpmsg_subdev(struct mtk_scp *scp) if (scp->rpmsg_subdev) rproc_add_subdev(scp->rproc, scp->rpmsg_subdev); } +EXPORT_SYMBOL_GPL(scp_add_rpmsg_subdev); -static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) +void scp_remove_rpmsg_subdev(struct mtk_scp *scp) { if (scp->rpmsg_subdev) { rproc_remove_subdev(scp->rproc, scp->rpmsg_subdev); @@ -842,6 +843,7 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp) scp->rpmsg_subdev = NULL; } } +EXPORT_SYMBOL_GPL(scp_remove_rpmsg_subdev); static void scp_add_dual_subdev(struct mtk_scp *scp) { diff --git a/drivers/remoteproc/mtk_scp_dual.c b/drivers/remoteproc/mtk_scp_dual.c index ab62ab54175c..caa57516e083 100644 --- a/drivers/remoteproc/mtk_scp_dual.c +++ b/drivers/remoteproc/mtk_scp_dual.c @@ -249,6 +249,8 @@ static int scp_dual_probe(struct platform_device *pdev) init_waitqueue_head(&scp->run.wq); init_waitqueue_head(&scp->ack_wq); + scp_add_rpmsg_subdev(scp); + ret = devm_request_threaded_irq(dev, platform_get_irq(pdev, 0), NULL, scp_irq_handler, IRQF_ONESHOT, pdev->name, scp); @@ -271,6 +273,7 @@ static int scp_dual_probe(struct platform_device *pdev) return 0; remove_ipi: + scp_remove_rpmsg_subdev(scp); scp_ipi_unregister(scp, SCP_IPI_INIT); release_dev_mem: scp_unmap_memory_region(scp); @@ -286,6 +289,7 @@ static int scp_dual_remove(struct platform_device *pdev) struct mtk_scp *scp = platform_get_drvdata(pdev); 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++)