Re: [PATCH] remoteproc: mediatek: Detect single/multi core SCP with rpmsg-name property

2023-09-19 Thread Chen-Yu Tsai
On Tue, Sep 19, 2023 at 5:26 PM AngeloGioacchino Del Regno
 wrote:
>
> Il 19/09/23 07:03, Chen-Yu Tsai ha scritto:
> > In the just landed multi-core SCP work, detection of single/multi core
> > SCP is done by checking the immediate child node of the SCP complex
> > device node. In the original work this was done by matching the child
> > node's name. However the name wasn't previously standardized. This
> > resulted in breakage on MT8183 and MT8192 Chromebooks while the driver
> > side changes were picked up and the device tree changes were not picked
> > up.
> >
> > Instead, match against the "mediatek,rpmsg-name" property, which is
> > required to be present in the rpmsg sub-node. This makes the
> > aforementioned devices running old device trees working again.
> >
> > Reported-by: Laura Nao 
> > Fixes: 1fdbf0cdde98 ("remoteproc: mediatek: Probe SCP cluster on multi-core 
> > SCP")
> > Signed-off-by: Chen-Yu Tsai 
> > ---
> > The patch is based on next-20230918 with a whole bunch of local patches
> > stacked on top. None of my local patches are related to remoteproc, so
> > it should be fine.
> >
> > I tested on both MT8183 Juniper and MT8192 Hayato and on both systems
> > the SCP successfully probed again.
>
> Instead of checking "mediatek,rpmsg-name", I think that a better way of 
> checking if
> this is single or multi core is to count the number of cores...
>
> I've sent my own version of this, please check [1].

My version checks the structure of the device node, much like the original
code, just against a different property/node name. If it's multi-core,
there would be sub-nodes for each core, and the rpmsg property would be
under those.

Either way works. What we need right now is a quick fix to get things
working again. We can discuss how to make things better later.

Honestly I think it should just be based on the compatible string. However
the current design seems quite fragile. The driver probably can't handle
the core device nodes being out of order.


ChenYu


Re: [PATCH] remoteproc: mediatek: Detect single/multi core SCP with rpmsg-name property

2023-09-19 Thread AngeloGioacchino Del Regno

Il 19/09/23 07:03, Chen-Yu Tsai ha scritto:

In the just landed multi-core SCP work, detection of single/multi core
SCP is done by checking the immediate child node of the SCP complex
device node. In the original work this was done by matching the child
node's name. However the name wasn't previously standardized. This
resulted in breakage on MT8183 and MT8192 Chromebooks while the driver
side changes were picked up and the device tree changes were not picked
up.

Instead, match against the "mediatek,rpmsg-name" property, which is
required to be present in the rpmsg sub-node. This makes the
aforementioned devices running old device trees working again.

Reported-by: Laura Nao 
Fixes: 1fdbf0cdde98 ("remoteproc: mediatek: Probe SCP cluster on multi-core 
SCP")
Signed-off-by: Chen-Yu Tsai 
---
The patch is based on next-20230918 with a whole bunch of local patches
stacked on top. None of my local patches are related to remoteproc, so
it should be fine.

I tested on both MT8183 Juniper and MT8192 Hayato and on both systems
the SCP successfully probed again.


Instead of checking "mediatek,rpmsg-name", I think that a better way of 
checking if
this is single or multi core is to count the number of cores...

I've sent my own version of this, please check [1].

[1]: 
https://lore.kernel.org/linux-remoteproc/20230919092336.51007-1-angelogioacchino.delre...@collabora.com/


Cheers,
Angelo



[PATCH] remoteproc: mediatek: Detect single/multi core SCP with rpmsg-name property

2023-09-18 Thread Chen-Yu Tsai
In the just landed multi-core SCP work, detection of single/multi core
SCP is done by checking the immediate child node of the SCP complex
device node. In the original work this was done by matching the child
node's name. However the name wasn't previously standardized. This
resulted in breakage on MT8183 and MT8192 Chromebooks while the driver
side changes were picked up and the device tree changes were not picked
up.

Instead, match against the "mediatek,rpmsg-name" property, which is
required to be present in the rpmsg sub-node. This makes the
aforementioned devices running old device trees working again.

Reported-by: Laura Nao 
Fixes: 1fdbf0cdde98 ("remoteproc: mediatek: Probe SCP cluster on multi-core 
SCP")
Signed-off-by: Chen-Yu Tsai 
---
The patch is based on next-20230918 with a whole bunch of local patches
stacked on top. None of my local patches are related to remoteproc, so
it should be fine.

I tested on both MT8183 Juniper and MT8192 Hayato and on both systems
the SCP successfully probed again.

 drivers/remoteproc/mtk_scp.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index ea227b566c54..ca15d9f382a1 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -1149,13 +1149,23 @@ static int scp_is_single_core(struct platform_device 
*pdev)
struct device *dev = >dev;
struct device_node *np = dev_of_node(dev);
struct device_node *child;
+   bool has_rpmsg;
 
child = of_get_next_available_child(np, NULL);
if (!child)
return dev_err_probe(dev, -ENODEV, "No child node\n");
 
+   /*
+* On single core SCP systems, the immediate child of the SCP device
+* is the rpmsg node; on multi core systems, there's an intermediate
+* level node, one describing each core. Instead of matching on the
+* node name, which was recently changed in the DT binding in a
+* backward incompatible way, match against the "mediatek,rpmsg-name"
+* property, which is required in all rpmsg sub-nodes.
+*/
+   has_rpmsg = of_property_present(child, "mediatek,rpmsg-name");
of_node_put(child);
-   return of_node_name_eq(child, "cros-ec-rpmsg");
+   return has_rpmsg;
 }
 
 static int scp_cluster_init(struct platform_device *pdev, struct 
mtk_scp_of_cluster *scp_cluster)
-- 
2.42.0.459.ge4e396fd5e-goog