@@ -140,6 +140,8 @@ struct mtk_scp {
size_t dram_size;
struct rproc_subdev *rpmsg_subdev;
+
+ struct mtk_scp *main_scp;
};
/**
@@ -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)
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@mediatek.com> --- drivers/remoteproc/mtk_common.h | 2 ++ drivers/remoteproc/mtk_scp.c | 27 +++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-)