linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] dt-bindings: interrupt-controller: Convert UniPhier AIDET to json-schema
@ 2020-02-22 11:04 Masahiro Yamada
  2020-02-26 22:13 ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2020-02-22 11:04 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Rob Herring, devicetree, linux-kernel, masahiroy,
	Masahiro Yamada, Jason Cooper, Marc Zyngier, Mark Rutland,
	Thomas Gleixner

Convert the UniPhier AIDET (ARM Interrupt Detector) binding to DT
schema format.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Some qeustions:

I was wondering when 'additionalProperties: false' should be added.

If I add it to a bus controller device (e.g. I2C),
I see some schema warnings because various sub-nodes
are added depending on which device you connect.

On the other hand, the interrupt controller like this
does not have a subnode.
So, probably this is the case where we can add
'additionalProperties: false'.

Is this correct?

One more thing.

There are multiple ways to do a similar thing:

   compatible:
     enum:
        - socionext,uniphier-ld4-aidet
        - socionext,uniphier-pro4-aidet
        ...
vs

   compatible:
     oneOf:
        - const: socionext,uniphier-ld4-aidet
        - const: socionext,uniphier-pro4-aidet
        ...

I adopted the former because I can save 'const'.
If there is a preferred way, I will follow it.

END

---

Changes in v2:
  - fix the schema warning in the example

 .../socionext,uniphier-aidet.txt              | 32 ----------
 .../socionext,uniphier-aidet.yaml             | 61 +++++++++++++++++++
 2 files changed, 61 insertions(+), 32 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/interrupt-controller/socionext,uniphier-aidet.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/socionext,uniphier-aidet.yaml

diff --git a/Documentation/devicetree/bindings/interrupt-controller/socionext,uniphier-aidet.txt b/Documentation/devicetree/bindings/interrupt-controller/socionext,uniphier-aidet.txt
deleted file mode 100644
index 48e71d3ac2ad..000000000000
--- a/Documentation/devicetree/bindings/interrupt-controller/socionext,uniphier-aidet.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-UniPhier AIDET
-
-UniPhier AIDET (ARM Interrupt Detector) is an add-on block for ARM GIC (Generic
-Interrupt Controller).  GIC itself can handle only high level and rising edge
-interrupts.  The AIDET provides logic inverter to support low level and falling
-edge interrupts.
-
-Required properties:
-- compatible: Should be one of the following:
-    "socionext,uniphier-ld4-aidet"  - for LD4 SoC
-    "socionext,uniphier-pro4-aidet" - for Pro4 SoC
-    "socionext,uniphier-sld8-aidet" - for sLD8 SoC
-    "socionext,uniphier-pro5-aidet" - for Pro5 SoC
-    "socionext,uniphier-pxs2-aidet" - for PXs2/LD6b SoC
-    "socionext,uniphier-ld11-aidet" - for LD11 SoC
-    "socionext,uniphier-ld20-aidet" - for LD20 SoC
-    "socionext,uniphier-pxs3-aidet" - for PXs3 SoC
-- reg: Specifies offset and length of the register set for the device.
-- interrupt-controller: Identifies the node as an interrupt controller
-- #interrupt-cells : Specifies the number of cells needed to encode an interrupt
-  source.  The value should be 2.  The first cell defines the interrupt number
-  (corresponds to the SPI interrupt number of GIC).  The second cell specifies
-  the trigger type as defined in interrupts.txt in this directory.
-
-Example:
-
-	aidet: aidet@5fc20000 {
-		compatible = "socionext,uniphier-pro4-aidet";
-		reg = <0x5fc20000 0x200>;
-		interrupt-controller;
-		#interrupt-cells = <2>;
-	};
diff --git a/Documentation/devicetree/bindings/interrupt-controller/socionext,uniphier-aidet.yaml b/Documentation/devicetree/bindings/interrupt-controller/socionext,uniphier-aidet.yaml
new file mode 100644
index 000000000000..f89ebde76dab
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/socionext,uniphier-aidet.yaml
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/socionext,uniphier-aidet.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: UniPhier AIDET
+
+description: |
+  UniPhier AIDET (ARM Interrupt Detector) is an add-on block for ARM GIC
+  (Generic Interrupt Controller). GIC itself can handle only high level and
+  rising edge interrupts. The AIDET provides logic inverter to support low
+  level and falling edge interrupts.
+
+maintainers:
+  - Masahiro Yamada <yamada.masahiro@socionext.com>
+
+allOf:
+  - $ref: /schemas/interrupt-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - socionext,uniphier-ld4-aidet
+      - socionext,uniphier-pro4-aidet
+      - socionext,uniphier-sld8-aidet
+      - socionext,uniphier-pro5-aidet
+      - socionext,uniphier-pxs2-aidet
+      - socionext,uniphier-ld6b-aidet
+      - socionext,uniphier-ld11-aidet
+      - socionext,uniphier-ld20-aidet
+      - socionext,uniphier-pxs3-aidet
+
+  reg:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  '#interrupt-cells':
+    description: |
+      The first cell defines the interrupt number (corresponds to the SPI
+      interrupt number of GIC). The second cell specifies the trigger type as
+      defined in interrupts.txt in this directory.
+    const: 2
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    interrupt-controller@5fc20000 {
+        compatible = "socionext,uniphier-pro4-aidet";
+        reg = <0x5fc20000 0x200>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+    };
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] dt-bindings: interrupt-controller: Convert UniPhier AIDET to json-schema
  2020-02-22 11:04 [PATCH v2] dt-bindings: interrupt-controller: Convert UniPhier AIDET to json-schema Masahiro Yamada
@ 2020-02-26 22:13 ` Rob Herring
  2020-02-27  1:46   ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2020-02-26 22:13 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-arm-kernel, devicetree, linux-kernel, masahiroy,
	Jason Cooper, Marc Zyngier, Mark Rutland, Thomas Gleixner

On Sat, Feb 22, 2020 at 08:04:35PM +0900, Masahiro Yamada wrote:
> Convert the UniPhier AIDET (ARM Interrupt Detector) binding to DT
> schema format.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Some qeustions:
> 
> I was wondering when 'additionalProperties: false' should be added.
> 
> If I add it to a bus controller device (e.g. I2C),
> I see some schema warnings because various sub-nodes
> are added depending on which device you connect.
> 
> On the other hand, the interrupt controller like this
> does not have a subnode.
> So, probably this is the case where we can add
> 'additionalProperties: false'.
> 
> Is this correct?

Yes.

The problem with 'additionalProperties: false' is it doesn't include 
what any $ref includes. There's a json-schema fix for this coming with 
'unevaluatedProperties', but the json-schema python lib we use doesn't 
yet support that.

> 
> One more thing.
> 
> There are multiple ways to do a similar thing:
> 
>    compatible:
>      enum:
>         - socionext,uniphier-ld4-aidet
>         - socionext,uniphier-pro4-aidet
>         ...
> vs
> 
>    compatible:
>      oneOf:
>         - const: socionext,uniphier-ld4-aidet
>         - const: socionext,uniphier-pro4-aidet
>         ...
> 
> I adopted the former because I can save 'const'.
> If there is a preferred way, I will follow it.

I prefer the former.

> 
> END
> 
> ---
> 
> Changes in v2:
>   - fix the schema warning in the example
> 
>  .../socionext,uniphier-aidet.txt              | 32 ----------
>  .../socionext,uniphier-aidet.yaml             | 61 +++++++++++++++++++
>  2 files changed, 61 insertions(+), 32 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/interrupt-controller/socionext,uniphier-aidet.txt
>  create mode 100644 Documentation/devicetree/bindings/interrupt-controller/socionext,uniphier-aidet.yaml

It all looks fine, so I'll drop the questions and apply.

Rob

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] dt-bindings: interrupt-controller: Convert UniPhier AIDET to json-schema
  2020-02-26 22:13 ` Rob Herring
@ 2020-02-27  1:46   ` Masahiro Yamada
  0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2020-02-27  1:46 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-arm-kernel, DTML, Linux Kernel Mailing List, Jason Cooper,
	Marc Zyngier, Mark Rutland, Thomas Gleixner

Hi Rob,

On Thu, Feb 27, 2020 at 7:13 AM Rob Herring <robh@kernel.org> wrote:

<snip>

>
> It all looks fine, so I'll drop the questions and apply.
>
> Rob

Thanks for your answer!

Yes, please drop the questions.

I just want to put them below '---' marker.
(You can see some questions in my patches)

I use a tool that automates this, but I made a mistake
in scripting for this one.




-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-27  1:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-22 11:04 [PATCH v2] dt-bindings: interrupt-controller: Convert UniPhier AIDET to json-schema Masahiro Yamada
2020-02-26 22:13 ` Rob Herring
2020-02-27  1:46   ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).