[v1] arm64: dts: meson: a1: place pwrc and secure-monitor under /firmware

Message ID 20230323185548.13731-1-ddrokosov@sberdevices.ru
State New
Headers
Series [v1] arm64: dts: meson: a1: place pwrc and secure-monitor under /firmware |

Commit Message

Dmitry Rokosov March 23, 2023, 6:55 p.m. UTC
  Before, meson power secure controller was a child of secure monitor node.
But secure monitor isn't the bus in terms of device tree subsystem, so
of_platform initialization code doesn't populate its children
(of_platform_default_populate() API).

Therefore in the current device tree meson power secure controller isn't
probed at all.

If we place meson power secure controller and secure monitor nodes under
'/firmware', they will be populated automatically from of_platform
initialization.

Fixes: 04dd0b6584cd ("arm64: dts: meson: a1: add secure power domain controller")
Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
---
 arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Neil Armstrong March 24, 2023, 10:11 a.m. UTC | #1
Hi,

On 23/03/2023 19:55, Dmitry Rokosov wrote:
> Before, meson power secure controller was a child of secure monitor node.
> But secure monitor isn't the bus in terms of device tree subsystem, so
> of_platform initialization code doesn't populate its children
> (of_platform_default_populate() API).
> 
> Therefore in the current device tree meson power secure controller isn't
> probed at all.
> 
> If we place meson power secure controller and secure monitor nodes under
> '/firmware', they will be populated automatically from of_platform
> initialization.
> 
> Fixes: 04dd0b6584cd ("arm64: dts: meson: a1: add secure power domain controller")
> Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
> ---
>   arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
> index 77023a29b6e7..44c651254dc5 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
> @@ -72,8 +72,10 @@ linux,cma {
>   		};
>   	};
>   
> -	sm: secure-monitor {
> -		compatible = "amlogic,meson-gxbb-sm";
> +	firmware {
> +		sm: secure-monitor {
> +			compatible = "amlogic,meson-gxbb-sm";
> +		};
>   
>   		pwrc: power-controller {
>   			compatible = "amlogic,meson-a1-pwrc";

The amlogic,meson-gxbb-sm bindings says the power-controller node should be
a subnode of secure-monitor, so instead please fix the sm driver by calling:

of_platform_populate(dev->of_node, NULL, NULL, dev);

Neil
  
Dmitry Rokosov March 24, 2023, 12:06 p.m. UTC | #2
Hello Neil,

On Fri, Mar 24, 2023 at 11:11:02AM +0100, neil.armstrong@linaro.org wrote:
> Hi,
> 
> On 23/03/2023 19:55, Dmitry Rokosov wrote:
> > Before, meson power secure controller was a child of secure monitor node.
> > But secure monitor isn't the bus in terms of device tree subsystem, so
> > of_platform initialization code doesn't populate its children
> > (of_platform_default_populate() API).
> > 
> > Therefore in the current device tree meson power secure controller isn't
> > probed at all.
> > 
> > If we place meson power secure controller and secure monitor nodes under
> > '/firmware', they will be populated automatically from of_platform
> > initialization.
> > 
> > Fixes: 04dd0b6584cd ("arm64: dts: meson: a1: add secure power domain controller")
> > Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
> > ---
> >   arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 6 ++++--
> >   1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
> > index 77023a29b6e7..44c651254dc5 100644
> > --- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
> > +++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
> > @@ -72,8 +72,10 @@ linux,cma {
> >   		};
> >   	};
> > -	sm: secure-monitor {
> > -		compatible = "amlogic,meson-gxbb-sm";
> > +	firmware {
> > +		sm: secure-monitor {
> > +			compatible = "amlogic,meson-gxbb-sm";
> > +		};
> >   		pwrc: power-controller {
> >   			compatible = "amlogic,meson-a1-pwrc";
> 
> The amlogic,meson-gxbb-sm bindings says the power-controller node should be
> a subnode of secure-monitor, so instead please fix the sm driver by calling:
> 
> of_platform_populate(dev->of_node, NULL, NULL, dev);

This is second option which I was thinking of. I supposing this API is
used from SoC platform drivers and bus drivers only.
But if this approach is okay, I will rework the patch to
of_platform_populate().

Thank you for pointing out it.
  

Patch

diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
index 77023a29b6e7..44c651254dc5 100644
--- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
@@ -72,8 +72,10 @@  linux,cma {
 		};
 	};
 
-	sm: secure-monitor {
-		compatible = "amlogic,meson-gxbb-sm";
+	firmware {
+		sm: secure-monitor {
+			compatible = "amlogic,meson-gxbb-sm";
+		};
 
 		pwrc: power-controller {
 			compatible = "amlogic,meson-a1-pwrc";