[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220601112201.15510-8-tinghan.shen@mediatek.com>
Date: Wed, 1 Jun 2022 19:21:53 +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 07/15] remoteproc: mediatek: Add SCP core 1 reserved memory support
Reuse the SCP core 0 reserved memory API on SCP core 1.
Signed-off-by: Tinghan Shen <tinghan.shen@...iatek.com>
---
drivers/remoteproc/mtk_common.h | 2 ++
drivers/remoteproc/mtk_scp.c | 6 ++++--
drivers/remoteproc/mtk_scp_dual.c | 5 +++++
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h
index 2e46be605687..da3ea2243678 100644
--- a/drivers/remoteproc/mtk_common.h
+++ b/drivers/remoteproc/mtk_common.h
@@ -168,4 +168,6 @@ int scp_stop(struct rproc *rproc);
int scp_load(struct rproc *rproc, const struct firmware *fw);
void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem);
int scp_parse_fw(struct rproc *rproc, const struct firmware *fw);
+int scp_map_memory_region(struct mtk_scp *scp);
+void scp_unmap_memory_region(struct mtk_scp *scp);
#endif
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 7b9d12ec2d4f..75d161da0f59 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -747,7 +747,7 @@ void *scp_mapping_dm_addr(struct mtk_scp *scp, u32 mem_addr)
}
EXPORT_SYMBOL_GPL(scp_mapping_dm_addr);
-static int scp_map_memory_region(struct mtk_scp *scp)
+int scp_map_memory_region(struct mtk_scp *scp)
{
int ret;
@@ -773,8 +773,9 @@ static int scp_map_memory_region(struct mtk_scp *scp)
return 0;
}
+EXPORT_SYMBOL_GPL(scp_map_memory_region);
-static void scp_unmap_memory_region(struct mtk_scp *scp)
+void scp_unmap_memory_region(struct mtk_scp *scp)
{
if (scp->dram_size == 0)
return;
@@ -783,6 +784,7 @@ static void scp_unmap_memory_region(struct mtk_scp *scp)
scp->dma_addr);
of_reserved_mem_device_release(scp->dev);
}
+EXPORT_SYMBOL_GPL(scp_unmap_memory_region);
static int scp_register_ipi(struct platform_device *pdev, u32 id,
ipi_handler_t handler, void *priv)
diff --git a/drivers/remoteproc/mtk_scp_dual.c b/drivers/remoteproc/mtk_scp_dual.c
index e4ada5696bd7..0f932d26f864 100644
--- a/drivers/remoteproc/mtk_scp_dual.c
+++ b/drivers/remoteproc/mtk_scp_dual.c
@@ -60,6 +60,10 @@ static int scp_dual_probe(struct platform_device *pdev)
return dev_err_probe(dev, PTR_ERR(scp->reg_base),
"Failed to parse and map cfg memory\n");
+ ret = scp_map_memory_region(scp);
+ if (ret)
+ return ret;
+
mutex_init(&scp->send_lock);
for (i = 0; i < SCP_IPI_MAX; i++)
mutex_init(&scp->ipi_desc[i].lock);
@@ -75,6 +79,7 @@ static int scp_dual_remove(struct platform_device *pdev)
struct mtk_scp *scp = platform_get_drvdata(pdev);
int i;
+ 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);
--
2.18.0
Powered by blists - more mailing lists