[PATCH v1 06/15] remoteproc: mediatek: Add SCP core 1 rproc operations
Tinghan Shen
tinghan.shen at mediatek.com
Wed Jun 1 04:21:52 PDT 2022
The firmware load and boot flow of SCP core 1 is almost the same as the
SCP core 0 except the accessed registers. Reuse the core 0 rproc operations
to load and boot SCP core 1.
Signed-off-by: Tinghan Shen <tinghan.shen at mediatek.com>
---
drivers/remoteproc/mtk_common.h | 5 +++++
drivers/remoteproc/mtk_scp.c | 15 ++++++++++-----
drivers/remoteproc/mtk_scp_dual.c | 8 +++++++-
3 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h
index 2eadb0e696a1..2e46be605687 100644
--- a/drivers/remoteproc/mtk_common.h
+++ b/drivers/remoteproc/mtk_common.h
@@ -163,4 +163,9 @@ void scp_memcpy_aligned(void __iomem *dst, const void *src, unsigned int len);
void scp_ipi_lock(struct mtk_scp *scp, u32 id);
void scp_ipi_unlock(struct mtk_scp *scp, u32 id);
+int scp_start(struct rproc *rproc);
+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);
#endif
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 3510c6d0bbc8..7b9d12ec2d4f 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -470,7 +470,7 @@ static int mt8195_scp_before_load(struct mtk_scp *scp)
return 0;
}
-static int scp_load(struct rproc *rproc, const struct firmware *fw)
+int scp_load(struct rproc *rproc, const struct firmware *fw)
{
struct mtk_scp *scp = rproc->priv;
struct device *dev = scp->dev;
@@ -495,8 +495,9 @@ static int scp_load(struct rproc *rproc, const struct firmware *fw)
return ret;
}
+EXPORT_SYMBOL_GPL(scp_load);
-static int scp_parse_fw(struct rproc *rproc, const struct firmware *fw)
+int scp_parse_fw(struct rproc *rproc, const struct firmware *fw)
{
struct mtk_scp *scp = rproc->priv;
struct device *dev = scp->dev;
@@ -512,8 +513,9 @@ static int scp_parse_fw(struct rproc *rproc, const struct firmware *fw)
clk_disable_unprepare(scp->clk);
return ret;
}
+EXPORT_SYMBOL_GPL(scp_parse_fw);
-static int scp_start(struct rproc *rproc)
+int scp_start(struct rproc *rproc)
{
struct mtk_scp *scp = (struct mtk_scp *)rproc->priv;
struct device *dev = scp->dev;
@@ -555,6 +557,7 @@ static int scp_start(struct rproc *rproc)
clk_disable_unprepare(scp->clk);
return ret;
}
+EXPORT_SYMBOL_GPL(scp_start);
static void *mt8183_scp_da_to_va(struct mtk_scp *scp, u64 da, size_t len)
{
@@ -602,12 +605,13 @@ static void *mt8192_scp_da_to_va(struct mtk_scp *scp, u64 da, size_t len)
return NULL;
}
-static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem)
+void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem)
{
struct mtk_scp *scp = (struct mtk_scp *)rproc->priv;
return scp->data->scp_da_to_va(scp, da, len);
}
+EXPORT_SYMBOL_GPL(scp_da_to_va);
static void mt8183_scp_stop(struct mtk_scp *scp)
{
@@ -642,7 +646,7 @@ static void mt8195_scp_stop(struct mtk_scp *scp)
writel(0, scp->reg_base + MT8192_CORE0_WDT_CFG);
}
-static int scp_stop(struct rproc *rproc)
+int scp_stop(struct rproc *rproc)
{
struct mtk_scp *scp = (struct mtk_scp *)rproc->priv;
int ret;
@@ -659,6 +663,7 @@ static int scp_stop(struct rproc *rproc)
return 0;
}
+EXPORT_SYMBOL_GPL(scp_stop);
static const struct rproc_ops scp_ops = {
.start = scp_start,
diff --git a/drivers/remoteproc/mtk_scp_dual.c b/drivers/remoteproc/mtk_scp_dual.c
index 7bc08d26f208..e4ada5696bd7 100644
--- a/drivers/remoteproc/mtk_scp_dual.c
+++ b/drivers/remoteproc/mtk_scp_dual.c
@@ -12,7 +12,13 @@
#include "mtk_common.h"
#include "remoteproc_internal.h"
-static const struct rproc_ops scp_ops;
+static const struct rproc_ops scp_ops = {
+ .start = scp_start,
+ .stop = scp_stop,
+ .load = scp_load,
+ .da_to_va = scp_da_to_va,
+ .parse_fw = scp_parse_fw,
+};
static int scp_dual_probe(struct platform_device *pdev)
{
--
2.18.0
More information about the Linux-mediatek
mailing list