Skip to contentSkip to conversation

dt-bindings: irqchip: renesas: intc-irqpin: convert bindings to json-schema

PATCH In review Yoshihiro Kaneko 3 participants 4 messages Sep 26, 2019 – Oct 11, 2019

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

PATCH v2 1/1 dt-bindings: irqchip: renesas: intc-irqpin: convert bindings to json-schema

Convert R-/SH-Mobile IRQPin Controller bindings documentation to json-schema.

---

v2
- correct Geert-san's E-mail address.
- delete Guennadi-san from the maintainer of this binding.
- give 'sense-bitfield-width' the uint32 type.
- describe 'control-parent' property as a boolean.

 .../interrupt-controller/renesas,intc-irqpin.txt   |  62 -------------
 .../interrupt-controller/renesas,intc-irqpin.yaml  | 102 +++++++++++++++++++++
 2 files changed, 102 insertions(+), 62 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.txt deleted +0 -62
deleted file mode 100644
index 772c550..0000000
@@ -1,62 +0,0 @@
-DT bindings for the R-/SH-Mobile irqpin controller
-
-Required properties:
-
-- compatible: has to be "renesas,intc-irqpin-<soctype>", "renesas,intc-irqpin"
-  as fallback.
-  Examples with soctypes are:
-    - "renesas,intc-irqpin-r8a7740" (R-Mobile A1)
-    - "renesas,intc-irqpin-r8a7778" (R-Car M1A)
-    - "renesas,intc-irqpin-r8a7779" (R-Car H1)
-    - "renesas,intc-irqpin-sh73a0" (SH-Mobile AG5)
-
-- reg: Base address and length of each register bank used by the external
-  IRQ pins driven by the interrupt controller hardware module. The base
-  addresses, length and number of required register banks varies with soctype.
-- interrupt-controller: Identifies the node as an interrupt controller.
-- #interrupt-cells: has to be <2>: an interrupt index and flags, as defined in
-  interrupts.txt in this directory.
-- interrupts: Must contain a list of interrupt specifiers. For each interrupt
-  provided by this irqpin controller instance, there must be one entry,
-  referring to the corresponding parent interrupt.
-
-Optional properties:
-
-- any properties, listed in interrupts.txt, and any standard resource allocation
-  properties
-- sense-bitfield-width: width of a single sense bitfield in the SENSE register,
-  if different from the default 4 bits
-- control-parent: disable and enable interrupts on the parent interrupt
-  controller, needed for some broken implementations
-- clocks: Must contain a reference to the functional clock.  This property is
-  mandatory if the hardware implements a controllable functional clock for
-  the irqpin controller instance.
-- power-domains: Must contain a reference to the power domain. This property is
-  mandatory if the irqpin controller instance is part of a controllable power
-  domain.
-
-
-Example
--------
-
-	irqpin1: interrupt-controller@e6900004 {
-		compatible = "renesas,intc-irqpin-r8a7740",
-			     "renesas,intc-irqpin";
-		#interrupt-cells = <2>;
-		interrupt-controller;
-		reg = <0xe6900004 4>,
-			<0xe6900014 4>,
-			<0xe6900024 1>,
-			<0xe6900044 1>,
-			<0xe6900064 1>;
-		interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH
-			      0 149 IRQ_TYPE_LEVEL_HIGH
-			      0 149 IRQ_TYPE_LEVEL_HIGH
-			      0 149 IRQ_TYPE_LEVEL_HIGH
-			      0 149 IRQ_TYPE_LEVEL_HIGH
-			      0 149 IRQ_TYPE_LEVEL_HIGH
-			      0 149 IRQ_TYPE_LEVEL_HIGH
-			      0 149 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
-		power-domains = <&pd_a4s>;
-	};
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +102 -0

102 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 42 lines · Yoshihiro Kaneko

Convert R-/SH-Mobile IRQPin Controller bindings documentation to json-schema.

---

v2
- correct Geert-san's E-mail address.
- delete Guennadi-san from the maintainer of this binding.
- give 'sense-bitfield-width' the uint32 type.
- describe 'control-parent' property as a boolean.

 .../interrupt-controller/renesas,intc-irqpin.txt   |  62 -------------
 .../interrupt-controller/renesas,intc-irqpin.yaml  | 102 +++++++++++++++++++++
 2 files changed, 102 insertions(+), 62 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +18 -0
new file mode 100644
index 0000000..5925890
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/renesas,intc-irqpin.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: DT bindings for the R-/SH-Mobile irqpin controller
+
+maintainers:
+  - Geert Uytterhoeven <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,intc-irqpin-r8a7740  # R-Mobile A1
+          - renesas,intc-irqpin-r8a7778  # R-Car M1A
+          - renesas,intc-irqpin-r8a7779  # R-Car H1

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 28

Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +10 -0
+          - renesas,intc-irqpin-sh73a0   # SH-Mobile AG5
+      - const: renesas,intc-irqpin
+
+  reg:
+    # Base address and length of each register bank used by the external
+    # IRQ pins driven by the interrupt controller hardware module. The base
+    # addresses, length and number of required register banks varies with
+    # soctype.
+    minItems: 1
+    maxItems: 6

Every entry is the same thing?

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 31

Quoted 3 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +3 -0
+
+  interrupt-controller: true
+    # Identifies the node as an interrupt controller.

No need to define standard properties.

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 35

Quoted 4 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +4 -0
+
+  '#interrupt-cells':
+    # an interrupt index and flags, as defined in interrupts.txt in this
+    # directory.

Same here.

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 41

Quoted 6 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +6 -0
+    const: 2
+
+  interrupts:
+    # Must contain a list of interrupt specifiers. For each interrupt
+    # provided by this irqpin controller instance, there must be one entry,
+    # referring to the corresponding parent interrupt.

And here.

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 46

Quoted 5 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +5 -0
+    maxItems: 1
+
+  sense-bitfield-width:
+    # width of a single sense bitfield in the SENSE register, if different
+    # from the default 4 bits

Use 'description'

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 48

Quoted 2 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +2 -0
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maxItems: 1

Update dtschema and run 'make dt_binding_check' and I think you'll find this fails now. The problem is $ref needs to be under an 'allOf' if there's additional schema.

maxItems is also wrong here. 'uint32' type implies that. What you should have is a definition of possible values using enum or minimum/maximum.

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 52

Quoted 4 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +4 -0
+
+  control-parent:
+    # disable and enable interrupts on the parent interrupt controller,
+    # needed for some broken implementations

Use 'description'

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 58

Quoted 6 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +6 -0
+    type: boolean
+
+  clocks:
+    # Must contain a reference to the functional clock.  This property is
+    # mandatory if the hardware implements a controllable functional clock for
+    # the irqpin controller instance.

Drop this. A single entry doesn't need more description.

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 64

Quoted 6 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +6 -0
+    maxItems: 1
+
+  power-domains:
+    # Must contain a reference to the power domain. This property is
+    # mandatory if the irqpin controller instance is part of a controllable
+    # power domain.

Same here.

Quoted 17 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +17 -0
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/r8a7740-clock.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 91

Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +10 -0
+    irqpin1: interrupt-controller@e6900004 {
+        compatible = "renesas,intc-irqpin-r8a7740",
+                     "renesas,intc-irqpin";
+        #interrupt-cells = <2>;
+        interrupt-controller;
+        reg = <0xe6900004 4>,
+              <0xe6900014 4>,
+              <0xe6900024 1>,
+              <0xe6900044 1>,
+              <0xe6900064 1>;

Really only 1 byte?

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 99

Quoted 8 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +8 -0
+        interrupts = <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>;

<> each interrupt specifier.

Above you said there is only 1 interrupt...

Quoted 6 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +3 -0
+        clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
+        power-domains = <&pd_a4s>;
+    };
Signature · 1 line
1.9.1
#2 lore raw

Hi Rob, Kaneko-san,

Quoted 5 lines · Rob Herring
Quoted 3 lines · Yoshihiro Kaneko

Convert R-/SH-Mobile IRQPin Controller bindings documentation to json-schema.

Quoted 13 lines

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 10

Quoted 13 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +10 -0
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/renesas,intc-irqpin.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: DT bindings for the R-/SH-Mobile irqpin controller
+
+maintainers:
+  - Geert Uytterhoeven <[email protected]>

Looks like I received many maintainerships recently ;-)

Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +9 -0
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,intc-irqpin-r8a7740  # R-Mobile A1
+          - renesas,intc-irqpin-r8a7778  # R-Car M1A
+          - renesas,intc-irqpin-r8a7779  # R-Car H1
+          - renesas,intc-irqpin-sh73a0   # SH-Mobile AG5
Quoted 8 lines

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 27

Quoted 8 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +8 -0
+      - const: renesas,intc-irqpin
+
+  reg:
+    # Base address and length of each register bank used by the external
+    # IRQ pins driven by the interrupt controller hardware module. The base
+    # addresses, length and number of required register banks varies with
+    # soctype.
+    minItems: 1

minItems: 5

Quoted 3 lines

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 28

Quoted 1 line
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +1 -0
+    maxItems: 6

Every entry is the same thing?

No they're not.

First entry is the Interrupt control register.
Second entry is the Interrupt priority register.
Third entry is the Interrupt source register.
Fourth entry is the Interrupt mask register.
Fifth entry is the Interrupt mask clear register.
Sixth entry is the optional Interrupt control register for ICR0 with IRLM bit.

The fact that SH/R-Mobile SoCs have 4 instances of this block, with interleaved registers, and different register widths, doesn't help much, and I understand that was the reason for the individual register descriptions.

This is a very old binding, which tried to describe everything in DT, using a generic compatible value. Of course this lead to a mess when having different register layouts, optional registers, and a sense-bitfield-width property...

The modern way would be to describe all differences in the driver, based on SoC-specific compatible values.
Given this is for rather old SoCs, I see no point in upgrading the bindings.

Quoted 11 lines

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 91

Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +10 -0
+    irqpin1: interrupt-controller@e6900004 {
+        compatible = "renesas,intc-irqpin-r8a7740",
+                     "renesas,intc-irqpin";
+        #interrupt-cells = <2>;
+        interrupt-controller;
+        reg = <0xe6900004 4>,
+              <0xe6900014 4>,
+              <0xe6900024 1>,
+              <0xe6900044 1>,
+              <0xe6900064 1>;
Quoted 1 line

Really only 1 byte?

Yep. Some registers are 8-bit on some SoCs...

Quoted 9 lines

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 99

Quoted 8 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +8 -0
+        interrupts = <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH
+                      GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>;
Quoted 3 lines

<> each interrupt specifier.

Above you said there is only 1 interrupt...

Which is wrong. But the description was correct.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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
maintainer
#3 lore raw
Quoted 9 lines · Geert Uytterhoeven

Hi Rob, Kaneko-san,

Quoted 4 lines · Rob Herring
Quoted 3 lines · Yoshihiro Kaneko

Convert R-/SH-Mobile IRQPin Controller bindings documentation to json-schema.

Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +2 -0
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
Quoted 8 lines

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 10

Quoted 8 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +8 -0
+---
+$id: http://devicetree.org/schemas/interrupt-controller/renesas,intc-irqpin.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: DT bindings for the R-/SH-Mobile irqpin controller
+
+maintainers:
+  - Geert Uytterhoeven <[email protected]>

Looks like I received many maintainerships recently ;-)

Maybe I should have called it something else, but I view this as who's the owner not who applies it. There are lots of binding files with no maintainer, so it's me by default. I wanted to avoid that and not by having 4K MAINTAINERS entries.

Quoted 24 lines
Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +9 -0
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,intc-irqpin-r8a7740  # R-Mobile A1
+          - renesas,intc-irqpin-r8a7778  # R-Car M1A
+          - renesas,intc-irqpin-r8a7779  # R-Car H1
+          - renesas,intc-irqpin-sh73a0   # SH-Mobile AG5
Quoted 8 lines

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 27

Quoted 8 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +8 -0
+      - const: renesas,intc-irqpin
+
+  reg:
+    # Base address and length of each register bank used by the external
+    # IRQ pins driven by the interrupt controller hardware module. The base
+    # addresses, length and number of required register banks varies with
+    # soctype.
+    minItems: 1

minItems: 5

Quoted 3 lines

Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml line 28

Quoted 1 line
Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.yaml new file +1 -0
+    maxItems: 6

Every entry is the same thing?

Quoted 8 lines

No they're not.

First entry is the Interrupt control register.
Second entry is the Interrupt priority register.
Third entry is the Interrupt source register.
Fourth entry is the Interrupt mask register.
Fifth entry is the Interrupt mask clear register.
Sixth entry is the optional Interrupt control register for ICR0 with IRLM bit.

So this should be an 'items' list with these descriptions.

Rob