summaryrefslogtreecommitdiff
path: root/drivers/remoteproc/mtk_scp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/remoteproc/mtk_scp.c')
-rw-r--r--drivers/remoteproc/mtk_scp.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index ea227b566c54..a35409eda0cf 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -1144,29 +1144,25 @@ init_fail:
return ret;
}
-static int scp_is_single_core(struct platform_device *pdev)
+static bool scp_is_single_core(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *np = dev_of_node(dev);
struct device_node *child;
+ int num_cores = 0;
- child = of_get_next_available_child(np, NULL);
- if (!child)
- return dev_err_probe(dev, -ENODEV, "No child node\n");
+ for_each_child_of_node(np, child)
+ if (of_device_is_compatible(child, "mediatek,scp-core"))
+ num_cores++;
- of_node_put(child);
- return of_node_name_eq(child, "cros-ec-rpmsg");
+ return num_cores < 2;
}
static int scp_cluster_init(struct platform_device *pdev, struct mtk_scp_of_cluster *scp_cluster)
{
int ret;
- ret = scp_is_single_core(pdev);
- if (ret < 0)
- return ret;
-
- if (ret)
+ if (scp_is_single_core(pdev))
ret = scp_add_single_core(pdev, scp_cluster);
else
ret = scp_add_multi_core(pdev, scp_cluster);