@@ -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
@@ -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)
@@ -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);
Reuse the SCP core 0 reserved memory API on SCP core 1. Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.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(-)