diff mbox series

[DO,NOT,MERGE,v6,09/37] dt-bindings: timer: renesas,tmu: add renesas,tmu-sh7750

Message ID 183bc01316cab97a7ae96df525a5a450c477210d.1704788539.git.ysato@users.sourceforge.jp (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series Device Tree support for SH7751 based board | expand

Commit Message

Yoshinori Sato Jan. 9, 2024, 8:23 a.m. UTC
Add SH7750 TMU entry.

I wanted to replace interrupts and interrupt-names in the if compatible is
"renesas,tmu-7750", but it seems that I can't rewrite it as expected.
This resulted in a redundant conditional statement.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
---
 .../bindings/timer/renesas,tmu.yaml           | 67 ++++++++++++++-----
 1 file changed, 51 insertions(+), 16 deletions(-)

Comments

Geert Uytterhoeven Jan. 15, 2024, 1:59 p.m. UTC | #1
Hi Sato-san,

On Tue, Jan 9, 2024 at 9:23 AM Yoshinori Sato
<ysato@users.sourceforge.jp> wrote:
> Add SH7750 TMU entry.
>
> I wanted to replace interrupts and interrupt-names in the if compatible is
> "renesas,tmu-7750", but it seems that I can't rewrite it as expected.
> This resulted in a redundant conditional statement.
>
> Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>

Thanks for your patch!

> --- a/Documentation/devicetree/bindings/timer/renesas,tmu.yaml
> +++ b/Documentation/devicetree/bindings/timer/renesas,tmu.yaml
> @@ -39,14 +39,15 @@ properties:
>            - renesas,tmu-r8a779a0 # R-Car V3U
>            - renesas,tmu-r8a779f0 # R-Car S4-8
>            - renesas,tmu-r8a779g0 # R-Car V4H
> +          - renesas,tmu-sh7750   # SH7750

OK

>        - const: renesas,tmu
>
>    reg:
>      maxItems: 1
>
> -  interrupts:
> -    minItems: 2
> -    maxItems: 3
> +  interrupts: true
> +
> +  interrupt-names: true

I would drop this change (see below).

>
>    clocks:
>      maxItems: 1
> @@ -75,21 +76,55 @@ required:
>    - clock-names
>    - power-domains
>
> -if:
> -  not:
> -    properties:
> -      compatible:
> -        contains:
> -          enum:
> -            - renesas,tmu-r8a7740
> -            - renesas,tmu-r8a7778
> -            - renesas,tmu-r8a7779
> -then:
> -  required:
> -    - resets
> -
>  additionalProperties: false
>
> +allOf:
> +  - if:
> +      not:
> +        properties:
> +          compatible:
> +            contains:
> +              enum:
> +                - renesas,tmu-r8a7740
> +                - renesas,tmu-r8a7778
> +                - renesas,tmu-r8a7779
> +                - renesas,tmu-sh7750

Adding renesas,tmu-sh7750 to this list is OK.

> +
> +    then:
> +      required:
> +        - resets
> +
> +  - if:
> +      not:
> +        properties:
> +          compatible:
> +            contains:
> +              enum:
> +                - renesas,tmu-sh7750
> +
> +    then:
> +      properties:
> +        interrupts:
> +          minItems: 2
> +          maxItems: 3
> +        interrupt-names:
> +          items:
> +            - const: tuni0
> +            - const: tuni1
> +            - const: tuni2
> +
> +    else:
> +      properties:
> +        interrupts:
> +          minItems: 2
> +          maxItems: 4
> +        interrupt-names:
> +          items:
> +            - const: tuni0
> +            - const: tuni1
> +            - const: tuni2
> +            - const: ticpi2
> +
>  examples:
>    - |
>      #include <dt-bindings/clock/r8a7779-clock.h>

The new interrupt logic is not really correct: several TMU instances
on other SoCs do support the fourth interrupt.  It just was not
documented before, or supported by the driver.

I have sent a patch to document the fourth interrupt[1].  Once that
patch has been applied, adding support for sh7751 involves adding just
two new lines.

[1] "PATCH] dt-bindings: timer: renesas,tmu: Document input capture
     interrupt"
    https://lore.kernel.org/r/fb1e38c93e62221f94304edd980a2fb79c1f2995.1705325608.git.geert+renesas@glider.be

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/timer/renesas,tmu.yaml b/Documentation/devicetree/bindings/timer/renesas,tmu.yaml
index a67e427a9e7e..bcdd40a13ea4 100644
--- a/Documentation/devicetree/bindings/timer/renesas,tmu.yaml
+++ b/Documentation/devicetree/bindings/timer/renesas,tmu.yaml
@@ -39,14 +39,15 @@  properties:
           - renesas,tmu-r8a779a0 # R-Car V3U
           - renesas,tmu-r8a779f0 # R-Car S4-8
           - renesas,tmu-r8a779g0 # R-Car V4H
+          - renesas,tmu-sh7750   # SH7750
       - const: renesas,tmu
 
   reg:
     maxItems: 1
 
-  interrupts:
-    minItems: 2
-    maxItems: 3
+  interrupts: true
+
+  interrupt-names: true
 
   clocks:
     maxItems: 1
@@ -75,21 +76,55 @@  required:
   - clock-names
   - power-domains
 
-if:
-  not:
-    properties:
-      compatible:
-        contains:
-          enum:
-            - renesas,tmu-r8a7740
-            - renesas,tmu-r8a7778
-            - renesas,tmu-r8a7779
-then:
-  required:
-    - resets
-
 additionalProperties: false
 
+allOf:
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - renesas,tmu-r8a7740
+                - renesas,tmu-r8a7778
+                - renesas,tmu-r8a7779
+                - renesas,tmu-sh7750
+
+    then:
+      required:
+        - resets
+
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - renesas,tmu-sh7750
+
+    then:
+      properties:
+        interrupts:
+          minItems: 2
+          maxItems: 3
+        interrupt-names:
+          items:
+            - const: tuni0
+            - const: tuni1
+            - const: tuni2
+
+    else:
+      properties:
+        interrupts:
+          minItems: 2
+          maxItems: 4
+        interrupt-names:
+          items:
+            - const: tuni0
+            - const: tuni1
+            - const: tuni2
+            - const: ticpi2
+
 examples:
   - |
     #include <dt-bindings/clock/r8a7779-clock.h>