diff mbox series

[v1,14/15] remoteproc: mediatek: Support rpmsg for SCP core 1

Message ID 20220601112201.15510-15-tinghan.shen@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Add support for MT8195 SCP 2nd core | expand

Commit Message

Tinghan Shen June 1, 2022, 11:22 a.m. UTC
Reuse the rpmsg subdevice flow of SCP core 0 on SCP core 1.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.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 mbox series

Patch

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++)