* [PATCH v2] remoteproc: mtk_scp: Only populate devices for SCP cores
@ 2024-12-11 7:20 Chen-Yu Tsai
2024-12-16 16:51 ` Mathieu Poirier
0 siblings, 1 reply; 2+ messages in thread
From: Chen-Yu Tsai @ 2024-12-11 7:20 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Chen-Yu Tsai, linux-remoteproc, linux-kernel, linux-arm-kernel,
linux-mediatek, Tinghan Shen
When multi-core SCP support was added, the driver was made to populate
platform devices for all the sub-nodes. This ended up adding platform
devices for the rpmsg sub-nodes as well, which never actually get used,
since rpmsg devices are registered through the rpmsg interface.
Limit of_platform_populate() to just populating the SCP cores with a
compatible string match list.
Fixes: 1fdbf0cdde98 ("remoteproc: mediatek: Probe SCP cluster on multi-core SCP")
Cc: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
Changes since v1:
- Fix commit subject: populate devices *for* SCP cores
---
drivers/remoteproc/mtk_scp.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 0f4a7065d0bd..8206a1766481 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -1326,6 +1326,11 @@ static int scp_cluster_init(struct platform_device *pdev, struct mtk_scp_of_clus
return ret;
}
+static const struct of_device_id scp_core_match[] = {
+ { .compatible = "mediatek,scp-core" },
+ {}
+};
+
static int scp_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -1357,13 +1362,15 @@ static int scp_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&scp_cluster->mtk_scp_list);
mutex_init(&scp_cluster->cluster_lock);
- ret = devm_of_platform_populate(dev);
+ ret = of_platform_populate(dev_of_node(dev), scp_core_match, NULL, dev);
if (ret)
return dev_err_probe(dev, ret, "Failed to populate platform devices\n");
ret = scp_cluster_init(pdev, scp_cluster);
- if (ret)
+ if (ret) {
+ of_platform_depopulate(dev);
return ret;
+ }
return 0;
}
@@ -1379,6 +1386,7 @@ static void scp_remove(struct platform_device *pdev)
rproc_del(scp->rproc);
scp_free(scp);
}
+ of_platform_depopulate(&pdev->dev);
mutex_destroy(&scp_cluster->cluster_lock);
}
--
2.47.0.338.g60cca15819-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] remoteproc: mtk_scp: Only populate devices for SCP cores
2024-12-11 7:20 [PATCH v2] remoteproc: mtk_scp: Only populate devices for SCP cores Chen-Yu Tsai
@ 2024-12-16 16:51 ` Mathieu Poirier
0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Poirier @ 2024-12-16 16:51 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: Bjorn Andersson, Matthias Brugger, AngeloGioacchino Del Regno,
linux-remoteproc, linux-kernel, linux-arm-kernel, linux-mediatek,
Tinghan Shen
On Wed, Dec 11, 2024 at 03:20:07PM +0800, Chen-Yu Tsai wrote:
> When multi-core SCP support was added, the driver was made to populate
> platform devices for all the sub-nodes. This ended up adding platform
> devices for the rpmsg sub-nodes as well, which never actually get used,
> since rpmsg devices are registered through the rpmsg interface.
>
> Limit of_platform_populate() to just populating the SCP cores with a
> compatible string match list.
>
> Fixes: 1fdbf0cdde98 ("remoteproc: mediatek: Probe SCP cluster on multi-core SCP")
> Cc: Tinghan Shen <tinghan.shen@mediatek.com>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> Changes since v1:
> - Fix commit subject: populate devices *for* SCP cores
> ---
> drivers/remoteproc/mtk_scp.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
I have applied this patch.
Thanks,
Mathieu
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index 0f4a7065d0bd..8206a1766481 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -1326,6 +1326,11 @@ static int scp_cluster_init(struct platform_device *pdev, struct mtk_scp_of_clus
> return ret;
> }
>
> +static const struct of_device_id scp_core_match[] = {
> + { .compatible = "mediatek,scp-core" },
> + {}
> +};
> +
> static int scp_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -1357,13 +1362,15 @@ static int scp_probe(struct platform_device *pdev)
> INIT_LIST_HEAD(&scp_cluster->mtk_scp_list);
> mutex_init(&scp_cluster->cluster_lock);
>
> - ret = devm_of_platform_populate(dev);
> + ret = of_platform_populate(dev_of_node(dev), scp_core_match, NULL, dev);
> if (ret)
> return dev_err_probe(dev, ret, "Failed to populate platform devices\n");
>
> ret = scp_cluster_init(pdev, scp_cluster);
> - if (ret)
> + if (ret) {
> + of_platform_depopulate(dev);
> return ret;
> + }
>
> return 0;
> }
> @@ -1379,6 +1386,7 @@ static void scp_remove(struct platform_device *pdev)
> rproc_del(scp->rproc);
> scp_free(scp);
> }
> + of_platform_depopulate(&pdev->dev);
> mutex_destroy(&scp_cluster->cluster_lock);
> }
>
> --
> 2.47.0.338.g60cca15819-goog
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-16 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-11 7:20 [PATCH v2] remoteproc: mtk_scp: Only populate devices for SCP cores Chen-Yu Tsai
2024-12-16 16:51 ` Mathieu Poirier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).