[V2,2/3] dt-bindings: tegra: pmc: Update scratch as an optional aperture

Message ID 20240117202504.943476-2-petlozup@nvidia.com
State New
Headers
Series [V2,1/3] soc/tegra: pmc: Update address mapping sequence for PMC apertures |

Commit Message

Petlozu Pravareshwar Jan. 17, 2024, 8:25 p.m. UTC
  Scratch address space register is used to store reboot reason. For
some Tegra234 systems, the scratch space is not available to store
the reboot reason. This is because scratch region on these systems
is not accessible by the kernel as restricted by the Hypervisor.
Such systems would delist scratch aperture from PMC DT node.

Accordingly, this change makes "scratch" as an optional aperture for
Tegra234 in PMC dt-binding document.

Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
---
Changes in v2:
- Fix dt_binding_check indentation warning.
- Update 'reg-names' property items list.

 .../arm/tegra/nvidia,tegra186-pmc.yaml        | 78 ++++++++++++++-----
 1 file changed, 58 insertions(+), 20 deletions(-)
  

Comments

Rob Herring Jan. 30, 2024, 5:19 p.m. UTC | #1
On Wed, Jan 17, 2024 at 08:25:03PM +0000, Petlozu Pravareshwar wrote:
> Scratch address space register is used to store reboot reason. For
> some Tegra234 systems, the scratch space is not available to store
> the reboot reason. This is because scratch region on these systems
> is not accessible by the kernel as restricted by the Hypervisor.
> Such systems would delist scratch aperture from PMC DT node.
> 
> Accordingly, this change makes "scratch" as an optional aperture for
> Tegra234 in PMC dt-binding document.
> 
> Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
> ---
> Changes in v2:
> - Fix dt_binding_check indentation warning.
> - Update 'reg-names' property items list.
> 
>  .../arm/tegra/nvidia,tegra186-pmc.yaml        | 78 ++++++++++++++-----
>  1 file changed, 58 insertions(+), 20 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml
> index 0faa403f68c8..79928824005d 100644
> --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml
> +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml
> @@ -27,7 +27,7 @@ properties:
>        - const: pmc
>        - const: wake
>        - const: aotag
> -      - const: scratch
> +      - enum: [ scratch, misc ]
>        - const: misc
>  
>    interrupt-controller: true
> @@ -41,25 +41,63 @@ properties:
>      description: If present, inverts the PMU interrupt signal.
>      $ref: /schemas/types.yaml#/definitions/flag
>  
> -if:
> -  properties:
> -    compatible:
> -      contains:
> -        const: nvidia,tegra186-pmc
> -then:
> -  properties:
> -    reg:
> -      maxItems: 4
> -
> -    reg-names:
> -      maxItems: 4
> -else:
> -  properties:
> -    reg:
> -      minItems: 5
> -
> -    reg-names:
> -      minItems: 5
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nvidia,tegra186-pmc
> +    then:
> +      properties:
> +        reg:
> +          maxItems: 4
> +        reg-names:
> +          items:
> +            - const: pmc
> +            - const: wake
> +            - const: aotag
> +            - const: scratch

There is no need to define the names and order again. Just this is 
sufficient:

maxItems: 4
contains:
  const: scratch

> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nvidia,tegra194-pmc
> +    then:
> +      properties:
> +        reg:
> +          minItems: 5
> +        reg-names:
> +          items:
> +            - const: pmc
> +            - const: wake
> +            - const: aotag
> +            - const: scratch
> +            - const: misc

Just 'minItems: 5' is sufficient here.

> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nvidia,tegra234-pmc
> +    then:
> +      properties:
> +        reg:
> +          minItems: 4
> +          maxItems: 5

That should already be the top-level constraint.

> +        reg-names:
> +          anyOf:
> +            - items:
> +                - const: pmc
> +                - const: wake
> +                - const: aotag
> +                - const: misc
> +            - items:
> +                - const: pmc
> +                - const: wake
> +                - const: aotag
> +                - const: scratch
> +                - const: misc

Only need:

contains:
  const: misc
  
Petlozu Pravareshwar Feb. 11, 2024, 5:07 p.m. UTC | #2
> On Wed, Jan 17, 2024 at 08:25:03PM +0000, Petlozu Pravareshwar wrote:
> > Scratch address space register is used to store reboot reason. For
> > some Tegra234 systems, the scratch space is not available to store the
> > reboot reason. This is because scratch region on these systems is not
> > accessible by the kernel as restricted by the Hypervisor.
> > Such systems would delist scratch aperture from PMC DT node.
> >
> > Accordingly, this change makes "scratch" as an optional aperture for
> > Tegra234 in PMC dt-binding document.
> >
> > Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
> > ---
> > Changes in v2:
> > - Fix dt_binding_check indentation warning.
> > - Update 'reg-names' property items list.
> >
> >  .../arm/tegra/nvidia,tegra186-pmc.yaml        | 78 ++++++++++++++-----
> >  1 file changed, 58 insertions(+), 20 deletions(-)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-
> pmc.yaml
> > b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-
> pmc.yaml
> > index 0faa403f68c8..79928824005d 100644
> > ---
> > a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-
> pmc.yaml
> > +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-
> pmc.
> > +++ yaml
> > @@ -27,7 +27,7 @@ properties:
> >        - const: pmc
> >        - const: wake
> >        - const: aotag
> > -      - const: scratch
> > +      - enum: [ scratch, misc ]
> >        - const: misc
> >
> >    interrupt-controller: true
> > @@ -41,25 +41,63 @@ properties:
> >      description: If present, inverts the PMU interrupt signal.
> >      $ref: /schemas/types.yaml#/definitions/flag
> >
> > -if:
> > -  properties:
> > -    compatible:
> > -      contains:
> > -        const: nvidia,tegra186-pmc
> > -then:
> > -  properties:
> > -    reg:
> > -      maxItems: 4
> > -
> > -    reg-names:
> > -      maxItems: 4
> > -else:
> > -  properties:
> > -    reg:
> > -      minItems: 5
> > -
> > -    reg-names:
> > -      minItems: 5
> > +allOf:
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: nvidia,tegra186-pmc
> > +    then:
> > +      properties:
> > +        reg:
> > +          maxItems: 4
> > +        reg-names:
> > +          items:
> > +            - const: pmc
> > +            - const: wake
> > +            - const: aotag
> > +            - const: scratch
> 
> There is no need to define the names and order again. Just this is
> sufficient:
> 
> maxItems: 4
> contains:
>   const: scratch
> 
Agree. Will address this in the next patch.

> > +
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: nvidia,tegra194-pmc
> > +    then:
> > +      properties:
> > +        reg:
> > +          minItems: 5
> > +        reg-names:
> > +          items:
> > +            - const: pmc
> > +            - const: wake
> > +            - const: aotag
> > +            - const: scratch
> > +            - const: misc
> 
> Just 'minItems: 5' is sufficient here.
> 
Will address this in the next patch.

> > +
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: nvidia,tegra234-pmc
> > +    then:
> > +      properties:
> > +        reg:
> > +          minItems: 4
> > +          maxItems: 5
> 
> That should already be the top-level constraint.
>
Will address this in the next patch.
 
> > +        reg-names:
> > +          anyOf:
> > +            - items:
> > +                - const: pmc
> > +                - const: wake
> > +                - const: aotag
> > +                - const: misc
> > +            - items:
> > +                - const: pmc
> > +                - const: wake
> > +                - const: aotag
> > +                - const: scratch
> > +                - const: misc
> 
> Only need:
> 
> contains:
>   const: misc
Will address this in the next patch.

Thanks.
  

Patch

diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml
index 0faa403f68c8..79928824005d 100644
--- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml
+++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml
@@ -27,7 +27,7 @@  properties:
       - const: pmc
       - const: wake
       - const: aotag
-      - const: scratch
+      - enum: [ scratch, misc ]
       - const: misc
 
   interrupt-controller: true
@@ -41,25 +41,63 @@  properties:
     description: If present, inverts the PMU interrupt signal.
     $ref: /schemas/types.yaml#/definitions/flag
 
-if:
-  properties:
-    compatible:
-      contains:
-        const: nvidia,tegra186-pmc
-then:
-  properties:
-    reg:
-      maxItems: 4
-
-    reg-names:
-      maxItems: 4
-else:
-  properties:
-    reg:
-      minItems: 5
-
-    reg-names:
-      minItems: 5
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nvidia,tegra186-pmc
+    then:
+      properties:
+        reg:
+          maxItems: 4
+        reg-names:
+          items:
+            - const: pmc
+            - const: wake
+            - const: aotag
+            - const: scratch
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nvidia,tegra194-pmc
+    then:
+      properties:
+        reg:
+          minItems: 5
+        reg-names:
+          items:
+            - const: pmc
+            - const: wake
+            - const: aotag
+            - const: scratch
+            - const: misc
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nvidia,tegra234-pmc
+    then:
+      properties:
+        reg:
+          minItems: 4
+          maxItems: 5
+        reg-names:
+          anyOf:
+            - items:
+                - const: pmc
+                - const: wake
+                - const: aotag
+                - const: misc
+            - items:
+                - const: pmc
+                - const: wake
+                - const: aotag
+                - const: scratch
+                - const: misc
 
 patternProperties:
   "^[a-z0-9]+-[a-z0-9]+$":