[PATCH v3 07/11] remoteproc: mediatek: Probe MT8195 SCP core 1
Tinghan Shen
tinghan.shen at mediatek.com
Mon Sep 26 19:56:02 PDT 2022
The MT8195 SCP configuration registers for core 0 and core 1 is the same.
Let SCP core 1 to reuse the mapped address requested by SCP core 0.
Signed-off-by: Tinghan Shen <tinghan.shen at mediatek.com>
---
drivers/remoteproc/mtk_common.h | 2 ++
drivers/remoteproc/mtk_scp.c | 27 +++++++++++++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h
index 3778894c96f3..54265c515315 100644
--- a/drivers/remoteproc/mtk_common.h
+++ b/drivers/remoteproc/mtk_common.h
@@ -140,6 +140,8 @@ struct mtk_scp {
size_t dram_size;
struct rproc_subdev *rpmsg_subdev;
+
+ struct mtk_scp *main_scp;
};
/**
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 1d17d77b8a14..f7b738743ba9 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -917,10 +917,29 @@ static int scp_probe(struct platform_device *pdev)
scp->l1tcm_phys = res->start;
}
- scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
- if (IS_ERR(scp->reg_base))
- return dev_err_probe(dev, PTR_ERR(scp->reg_base),
- "Failed to parse and map cfg memory\n");
+ if (of_device_is_compatible(np, "mediatek,mt8195-scp-core")) {
+ struct device_node *pnp;
+ struct platform_device *scp_pdev;
+
+ pnp = of_get_parent(np);
+ if (!pnp)
+ return dev_err_probe(dev, -ENODEV, "Failed to get parent core 0\n");
+
+ scp_pdev = of_find_device_by_node(pnp);
+ of_node_put(pnp);
+ if (!scp_pdev)
+ return dev_err_probe(dev, -ENODEV, "Failed to get scp core 0 pdev\n");
+
+ scp->main_scp = platform_get_drvdata(scp_pdev);
+ scp->reg_base = scp->main_scp->reg_base;
+ } else {
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
+ scp->reg_base = devm_ioremap_resource(dev, res);
+
+ if (IS_ERR(scp->reg_base))
+ return dev_err_probe(dev, PTR_ERR(scp->reg_base),
+ "Failed to parse and map cfg memory\n");
+ }
ret = scp->data->scp_clk_get(scp);
if (ret)
--
2.18.0
More information about the linux-arm-kernel
mailing list