[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220601112201.15510-15-tinghan.shen@mediatek.com>
Date: Wed, 1 Jun 2022 19:22:00 +0800
From: Tinghan Shen <tinghan.shen@...iatek.com>
To: Bjorn Andersson <bjorn.andersson@...aro.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Lee Jones <lee.jones@...aro.org>,
Benson Leung <bleung@...omium.org>,
Guenter Roeck <groeck@...omium.org>,
Daisuke Nojiri <dnojiri@...omium.org>,
Sebastian Reichel <sebastian.reichel@...labora.com>,
"Dustin L. Howett" <dustin@...ett.net>,
Tzung-Bi Shih <tzungbi@...nel.org>,
Tinghan Shen <tinghan.shen@...iatek.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Prashant Malani <pmalani@...omium.org>,
Enric Balletbo i Serra <enric.balletbo@...labora.com>,
Brian Norris <briannorris@...omium.org>
CC: <linux-remoteproc@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <chrome-platform@...ts.linux.dev>,
<Project_Global_Chrome_Upstream_Group@...iatek.com>,
<weishunc@...gle.com>
Subject: [PATCH v1 14/15] remoteproc: mediatek: Support rpmsg for SCP core 1
Reuse the rpmsg subdevice flow of SCP core 0 on SCP core 1.
Signed-off-by: Tinghan Shen <tinghan.shen@...iatek.com>
---
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++)
--
2.18.0
Powered by blists - more mailing lists