Skip to contentSkip to conversation

dt-bindings: renesas,tpu: Improve and json-schema conversion

PATCH Applied Geert Uytterhoeven 3 participants 7 messages May 10, 2021 – May 13, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover dt-bindings: renesas,tpu: Improve and json-schema conversion

Hi all,

There are two different device tree bindings defined for the Renesas Timer Pulse Unit:
- one for using the TPU as a PWM controller (used on ARM), already using json-schema, and
- a second one for using the TPU as a clock source (used on H8/300).
The first has already been converted to json-schema.

This series improves the former, and converts the latter to json-schema. As both bindings using "renesas,tpu", both bindings are marked with the appropriate "select" logic, to check for the presence respectively absence of the "#pwm-cells" property.

Changes compared to v1:
- Keep additionalProperties, as pwm.yaml doesn't add any other properties,
- Drop unneeded "'#pwm-cells': true" from "select" section in renesas,tpu-pwm.yaml,
- Add Reviewed-by.

Thanks for your comments!

Geert Uytterhoeven (2):
dt-bindings: pwm: renesas,tpu-pwm: Improve json-schema
dt-bindings: timer: renesas,tpu: Convert to json-schema

 .../bindings/pwm/renesas,tpu-pwm.yaml         | 26 +++++++++
 .../devicetree/bindings/timer/renesas,tpu.txt | 21 -------
 .../bindings/timer/renesas,tpu.yaml           | 56 +++++++++++++++++++
 3 files changed, 82 insertions(+), 21 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/timer/renesas,tpu.txt
 create mode 100644 Documentation/devicetree/bindings/timer/renesas,tpu.yaml
Signature · 12 lines
2.25.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
#1 lore raw

PATCH v2 1/2 dt-bindings: pwm: renesas,tpu-pwm: Improve json-schema

- Include the general PWM controller schema,
- Make clocks, power-domains, and resets properties required.

---
v2:
- Keep additionalProperties, as pwm.yaml doesn't add any other properties.

---
 .../bindings/pwm/renesas,tpu-pwm.yaml           | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
Documentation/devicetree/bindings/pwm/renesas,tpu-pwm.yaml +17 -0
index aa9a4570c9068226..7c99e42ad780c2cd 100644
@@ -58,6 +58,23 @@ required:
   - compatible
   - reg
   - '#pwm-cells'
+  - clocks
+  - power-domains
+
+allOf:
+  - $ref: pwm.yaml#
+
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - renesas,tpu-r8a73a4
+                - renesas,tpu-r8a7740
+    then:
+      required:
+        - resets
 
 additionalProperties: false
 
Signature · 1 line
2.25.1
Acked-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: pwm: renesas,tpu-pwm: Improve json-schema

Quoted 44 lines · Geert Uytterhoeven

- Include the general PWM controller schema,
- Make clocks, power-domains, and resets properties required.

---
v2:
- Keep additionalProperties, as pwm.yaml doesn't add any other properties.

---
 .../bindings/pwm/renesas,tpu-pwm.yaml           | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
Documentation/devicetree/bindings/pwm/renesas,tpu-pwm.yaml +17 -0
index aa9a4570c9068226..7c99e42ad780c2cd 100644
@@ -58,6 +58,23 @@ required:
   - compatible
   - reg
   - '#pwm-cells'
+  - clocks
+  - power-domains
+
+allOf:
+  - $ref: pwm.yaml#
+
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - renesas,tpu-r8a73a4
+                - renesas,tpu-r8a7740
+    then:
+      required:
+        - resets
 
 additionalProperties: false
 
Signature · 1 line
2.25.1
Signature · 1 line
Yosinori Sato
maintainer Applied
#3 lore raw

Re: [PATCH v2 1/2] dt-bindings: pwm: renesas,tpu-pwm: Improve json-schema

In reply to Geert Uytterhoeven
Quoted 12 lines · Geert Uytterhoeven

- Include the general PWM controller schema,
- Make clocks, power-domains, and resets properties required.

---
v2:
- Keep additionalProperties, as pwm.yaml doesn't add any other properties.

---
 .../bindings/pwm/renesas,tpu-pwm.yaml           | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Applied, thanks!

#4 lore raw

PATCH v2 2/2 dt-bindings: timer: renesas,tpu: Convert to json-schema

In reply to Geert Uytterhoeven

Convert the Renesas H8/300 Timer Pulse Unit Device Tree binding documentation to json-schema.

Correct clock-names, as "peripheral_clk" is the name of the supplier, and all users use "fck".

Note that there are two different bindings for the TPU, both using "renesas,tpu": this one for using the TPU as a clock source (used on H8/300), and a second use for using the TPU as a PWM controller (used on ARM). To avoid conflicts, both bindings are marked with the appropriate "select" logic, to check for the absence respectively presence of the "#pwm-cells" property.

---
v2:
- Drop unneeded "'#pwm-cells': true" from "select" section in renesas,tpu-pwm.yaml,
- Add Reviewed-by.

I have listed Sato-san as the maintainer, as he wrote the original driver and bindings.
Sato-san: Please scream if this is inappropriate ;-)

---
 .../bindings/pwm/renesas,tpu-pwm.yaml         |  9 +++
 .../devicetree/bindings/timer/renesas,tpu.txt | 21 -------
 .../bindings/timer/renesas,tpu.yaml           | 56 +++++++++++++++++++
 3 files changed, 65 insertions(+), 21 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/timer/renesas,tpu.txt
 create mode 100644 Documentation/devicetree/bindings/timer/renesas,tpu.yaml
Documentation/devicetree/bindings/pwm/renesas,tpu-pwm.yaml +9 -0
index 7c99e42ad780c2cd..81ccb2110162c3eb 100644
@@ -9,6 +9,15 @@ title: Renesas R-Car Timer Pulse Unit PWM Controller
 maintainers:
   - Laurent Pinchart <[email protected]>
 
+select:
+  properties:
+    compatible:
+      contains:
+        const: renesas,tpu
+  required:
+    - compatible
+    - '#pwm-cells'
+
 properties:
   compatible:
     items:
Documentation/devicetree/bindings/timer/renesas,tpu.txt deleted +0 -21
deleted file mode 100644
index 1d46f9de4feb8a84..0000000000000000
@@ -1,21 +0,0 @@
-* Renesas H8/300 Timer Pulse Unit
-
-The TPU is a 16bit timer/counter with configurable clock inputs and
-programmable compare match.
-This implementation support only cascade mode.
-
-Required Properties:
-
-  - compatible: must contain "renesas,tpu"
-  - reg: base address and length of the registers block in 2 channel.
-  - clocks: a list of phandle, one for each entry in clock-names.
-  - clock-names: must contain "peripheral_clk" for the functional clock.
-
-
-Example:
-	tpu: tpu@ffffe0 {
-		compatible = "renesas,tpu";
-		reg = <0xffffe0 16>, <0xfffff0 12>;
-		clocks = <&pclk>;
-		clock-names = "peripheral_clk";
-	};
Documentation/devicetree/bindings/timer/renesas,tpu.yaml new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
2.25.1
Acked-by on v2 2/2
#5 lore raw

Re: [PATCH v2 2/2] dt-bindings: timer: renesas,tpu: Convert to json-schema

Quoted 145 lines · Geert Uytterhoeven

Convert the Renesas H8/300 Timer Pulse Unit Device Tree binding documentation to json-schema.

Correct clock-names, as "peripheral_clk" is the name of the supplier, and all users use "fck".

Note that there are two different bindings for the TPU, both using "renesas,tpu": this one for using the TPU as a clock source (used on H8/300), and a second use for using the TPU as a PWM controller (used on ARM). To avoid conflicts, both bindings are marked with the appropriate "select" logic, to check for the absence respectively presence of the "#pwm-cells" property.

---
v2:
- Drop unneeded "'#pwm-cells': true" from "select" section in renesas,tpu-pwm.yaml,
- Add Reviewed-by.

I have listed Sato-san as the maintainer, as he wrote the original driver and bindings.
Sato-san: Please scream if this is inappropriate ;-)

---
 .../bindings/pwm/renesas,tpu-pwm.yaml         |  9 +++
 .../devicetree/bindings/timer/renesas,tpu.txt | 21 -------
 .../bindings/timer/renesas,tpu.yaml           | 56 +++++++++++++++++++
 3 files changed, 65 insertions(+), 21 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/timer/renesas,tpu.txt
 create mode 100644 Documentation/devicetree/bindings/timer/renesas,tpu.yaml
Documentation/devicetree/bindings/pwm/renesas,tpu-pwm.yaml +9 -0
index 7c99e42ad780c2cd..81ccb2110162c3eb 100644
@@ -9,6 +9,15 @@ title: Renesas R-Car Timer Pulse Unit PWM Controller
 maintainers:
   - Laurent Pinchart <[email protected]>
 
+select:
+  properties:
+    compatible:
+      contains:
+        const: renesas,tpu
+  required:
+    - compatible
+    - '#pwm-cells'
+
 properties:
   compatible:
     items:
Documentation/devicetree/bindings/timer/renesas,tpu.txt deleted +0 -21
deleted file mode 100644
index 1d46f9de4feb8a84..0000000000000000
@@ -1,21 +0,0 @@
-* Renesas H8/300 Timer Pulse Unit
-
-The TPU is a 16bit timer/counter with configurable clock inputs and
-programmable compare match.
-This implementation support only cascade mode.
-
-Required Properties:
-
-  - compatible: must contain "renesas,tpu"
-  - reg: base address and length of the registers block in 2 channel.
-  - clocks: a list of phandle, one for each entry in clock-names.
-  - clock-names: must contain "peripheral_clk" for the functional clock.
-
-
-Example:
-	tpu: tpu@ffffe0 {
-		compatible = "renesas,tpu";
-		reg = <0xffffe0 16>, <0xfffff0 12>;
-		clocks = <&pclk>;
-		clock-names = "peripheral_clk";
-	};
Documentation/devicetree/bindings/timer/renesas,tpu.yaml new file +56 -0
new file mode 100644
index 0000000000000000..01554dff23d8a954
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/timer/renesas,tpu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas H8/300 Timer Pulse Unit
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+description:
+  The TPU is a 16bit timer/counter with configurable clock inputs and
+  programmable compare match.
+  This implementation supports only cascade mode.
+
+select:
+  properties:
+    compatible:
+      contains:
+        const: renesas,tpu
+    '#pwm-cells': false
+  required:
+    - compatible
+
+properties:
+  compatible:
+    const: renesas,tpu
+
+  reg:
+    items:
+      - description: First channel
+      - description: Second channel
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: fck
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+    tpu: tpu@ffffe0 {
+            compatible = "renesas,tpu";
+            reg = <0xffffe0 16>, <0xfffff0 12>;
+            clocks = <&pclk>;
+            clock-names = "fck";
+    };
Signature · 1 line
2.25.1
Signature · 1 line
Yosinori Sato
maintainer Applied
#6 lore raw

Re: [PATCH v2 2/2] dt-bindings: timer: renesas,tpu: Convert to json-schema

In reply to Geert Uytterhoeven
Quoted 24 lines · Geert Uytterhoeven

Convert the Renesas H8/300 Timer Pulse Unit Device Tree binding documentation to json-schema.

Correct clock-names, as "peripheral_clk" is the name of the supplier, and all users use "fck".

Note that there are two different bindings for the TPU, both using "renesas,tpu": this one for using the TPU as a clock source (used on H8/300), and a second use for using the TPU as a PWM controller (used on ARM). To avoid conflicts, both bindings are marked with the appropriate "select" logic, to check for the absence respectively presence of the "#pwm-cells" property.

---
v2:
- Drop unneeded "'#pwm-cells': true" from "select" section in renesas,tpu-pwm.yaml,
- Add Reviewed-by.

I have listed Sato-san as the maintainer, as he wrote the original driver and bindings.
Sato-san: Please scream if this is inappropriate ;-)

Quoted 8 lines
---
 .../bindings/pwm/renesas,tpu-pwm.yaml         |  9 +++
 .../devicetree/bindings/timer/renesas,tpu.txt | 21 -------
 .../bindings/timer/renesas,tpu.yaml           | 56 +++++++++++++++++++
 3 files changed, 65 insertions(+), 21 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/timer/renesas,tpu.txt
 create mode 100644 Documentation/devicetree/bindings/timer/renesas,tpu.yaml

Applied, thanks!