linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] firmware: meson_sm: populate platform devices from sm device tree data
@ 2023-03-24 14:01 Dmitry Rokosov
  2023-03-24 14:05 ` neil.armstrong
  2023-03-24 14:08 ` Dmitry Rokosov
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Rokosov @ 2023-03-24 14:01 UTC (permalink / raw)
  To: krzysztof.kozlowski, robh, neil.armstrong, khilman, jbrunet,
	martin.blumenstingl, jianxin.pan
  Cc: kernel, linux-kernel, linux-arm-kernel, linux-amlogic,
	devicetree, rockosov, Dmitry Rokosov

In some meson boards, secure monitor device has children, for example,
power secure controller. By default, secure monitor isn't the bus in terms
of device tree subsystem, so the of_platform initialization code doesn't
populate its device tree data. As a result, secure monitor's children
aren't probed at all.

Run the 'of_platform_populate()' routine manually to resolve such issues.

Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
---
 drivers/firmware/meson/meson_sm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
index 77aa5c6398aa..b79d0e316cb1 100644
--- a/drivers/firmware/meson/meson_sm.c
+++ b/drivers/firmware/meson/meson_sm.c
@@ -316,7 +316,7 @@ static int __init meson_sm_probe(struct platform_device *pdev)
 	if (sysfs_create_group(&pdev->dev.kobj, &meson_sm_sysfs_attr_group))
 		goto out_in_base;
 
-	return 0;
+	return devm_of_platform_populate(dev);
 
 out_in_base:
 	iounmap(fw->sm_shmem_in_base);
-- 
2.36.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] firmware: meson_sm: populate platform devices from sm device tree data
  2023-03-24 14:01 [PATCH v2] firmware: meson_sm: populate platform devices from sm device tree data Dmitry Rokosov
@ 2023-03-24 14:05 ` neil.armstrong
  2023-03-24 14:13   ` Dmitry Rokosov
  2023-03-24 14:08 ` Dmitry Rokosov
  1 sibling, 1 reply; 4+ messages in thread
From: neil.armstrong @ 2023-03-24 14:05 UTC (permalink / raw)
  To: Dmitry Rokosov, krzysztof.kozlowski, robh, khilman, jbrunet,
	martin.blumenstingl, jianxin.pan
  Cc: kernel, linux-kernel, linux-arm-kernel, linux-amlogic,
	devicetree, rockosov

On 24/03/2023 15:01, Dmitry Rokosov wrote:
> In some meson boards, secure monitor device has children, for example,
> power secure controller. By default, secure monitor isn't the bus in terms
> of device tree subsystem, so the of_platform initialization code doesn't
> populate its device tree data. As a result, secure monitor's children
> aren't probed at all.
> 
> Run the 'of_platform_populate()' routine manually to resolve such issues.
> 
> Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
> ---
>   drivers/firmware/meson/meson_sm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
> index 77aa5c6398aa..b79d0e316cb1 100644
> --- a/drivers/firmware/meson/meson_sm.c
> +++ b/drivers/firmware/meson/meson_sm.c
> @@ -316,7 +316,7 @@ static int __init meson_sm_probe(struct platform_device *pdev)
>   	if (sysfs_create_group(&pdev->dev.kobj, &meson_sm_sysfs_attr_group))
>   		goto out_in_base;
>   
> -	return 0;
> +	return devm_of_platform_populate(dev);

You should check return and jump to out_in_base on error instead.

Neil

>   
>   out_in_base:
>   	iounmap(fw->sm_shmem_in_base);


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] firmware: meson_sm: populate platform devices from sm device tree data
  2023-03-24 14:01 [PATCH v2] firmware: meson_sm: populate platform devices from sm device tree data Dmitry Rokosov
  2023-03-24 14:05 ` neil.armstrong
@ 2023-03-24 14:08 ` Dmitry Rokosov
  1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Rokosov @ 2023-03-24 14:08 UTC (permalink / raw)
  To: krzysztof.kozlowski, robh, neil.armstrong, khilman, jbrunet,
	martin.blumenstingl, jianxin.pan
  Cc: kernel, linux-kernel, linux-arm-kernel, linux-amlogic,
	devicetree, rockosov

Sorry, I've missed the changelog. Please find it below if any.

On Fri, Mar 24, 2023 at 05:01:41PM +0300, Dmitry Rokosov wrote:
> In some meson boards, secure monitor device has children, for example,
> power secure controller. By default, secure monitor isn't the bus in terms
> of device tree subsystem, so the of_platform initialization code doesn't
> populate its device tree data. As a result, secure monitor's children
> aren't probed at all.
> 
> Run the 'of_platform_populate()' routine manually to resolve such issues.
> 
> Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
---

Changes v2 since v1 at [1]:
    - decline the device tree /firmware based solution
    - introduce devm_of_platform_populate() solution in the meson sm driver

Links:
    [1] https://lore.kernel.org/all/20230323185548.13731-1-ddrokosov@sberdevices.ru/

> ---
>  drivers/firmware/meson/meson_sm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
> index 77aa5c6398aa..b79d0e316cb1 100644
> --- a/drivers/firmware/meson/meson_sm.c
> +++ b/drivers/firmware/meson/meson_sm.c
> @@ -316,7 +316,7 @@ static int __init meson_sm_probe(struct platform_device *pdev)
>  	if (sysfs_create_group(&pdev->dev.kobj, &meson_sm_sysfs_attr_group))
>  		goto out_in_base;
>  
> -	return 0;
> +	return devm_of_platform_populate(dev);
>  
>  out_in_base:
>  	iounmap(fw->sm_shmem_in_base);
> -- 
> 2.36.0
> 

-- 
Thank you,
Dmitry

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] firmware: meson_sm: populate platform devices from sm device tree data
  2023-03-24 14:05 ` neil.armstrong
@ 2023-03-24 14:13   ` Dmitry Rokosov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Rokosov @ 2023-03-24 14:13 UTC (permalink / raw)
  To: neil.armstrong
  Cc: krzysztof.kozlowski, robh, khilman, jbrunet, martin.blumenstingl,
	jianxin.pan, kernel, linux-kernel, linux-arm-kernel,
	linux-amlogic, devicetree, rockosov

On Fri, Mar 24, 2023 at 03:05:53PM +0100, neil.armstrong@linaro.org wrote:
> On 24/03/2023 15:01, Dmitry Rokosov wrote:
> > In some meson boards, secure monitor device has children, for example,
> > power secure controller. By default, secure monitor isn't the bus in terms
> > of device tree subsystem, so the of_platform initialization code doesn't
> > populate its device tree data. As a result, secure monitor's children
> > aren't probed at all.
> > 
> > Run the 'of_platform_populate()' routine manually to resolve such issues.
> > 
> > Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
> > ---
> >   drivers/firmware/meson/meson_sm.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
> > index 77aa5c6398aa..b79d0e316cb1 100644
> > --- a/drivers/firmware/meson/meson_sm.c
> > +++ b/drivers/firmware/meson/meson_sm.c
> > @@ -316,7 +316,7 @@ static int __init meson_sm_probe(struct platform_device *pdev)
> >   	if (sysfs_create_group(&pdev->dev.kobj, &meson_sm_sysfs_attr_group))
> >   		goto out_in_base;
> > -	return 0;
> > +	return devm_of_platform_populate(dev);
> 
> You should check return and jump to out_in_base on error instead.
> 
> Neil
> 

Ah, exactly. There is one direct non-devm ioremap above. I hurried up,
sorry.

> >   out_in_base:
> >   	iounmap(fw->sm_shmem_in_base);
> 

-- 
Thank you,
Dmitry

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-24 14:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 14:01 [PATCH v2] firmware: meson_sm: populate platform devices from sm device tree data Dmitry Rokosov
2023-03-24 14:05 ` neil.armstrong
2023-03-24 14:13   ` Dmitry Rokosov
2023-03-24 14:08 ` Dmitry Rokosov

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).