* [PATCH] dt-bindings: interrupt-controller: Convert stm32-exti to json-schema
@ 2019-11-14 16:41 Alexandre Torgue
2019-11-14 17:18 ` Rob Herring
0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Torgue @ 2019-11-14 16:41 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Thomas Gleixner, Jason Cooper, Marc Zyngier
Cc: devicetree, linux-arm-kernel, linux-kernel, Alexandre Torgue,
linux-stm32
Convert the STM32 external interrupt controller (EXTI) binding to DT
schema format using json-schema.
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
---
Hi Rob,
I planned to use "additionalProperties: false" for this schema but as I add a
property under condition, I got an error (property added under contion seems
to be detected as an "additional" property and then error is raised).
Is there a way to fix that ?
regards
Alex
diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt
deleted file mode 100644
index cd01b2292ec6..000000000000
--- a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-STM32 External Interrupt Controller
-
-Required properties:
-
-- compatible: Should be:
- "st,stm32-exti"
- "st,stm32h7-exti"
- "st,stm32mp1-exti"
-- reg: Specifies base physical address and size of the registers
-- interrupt-controller: Indentifies the node as an interrupt controller
-- #interrupt-cells: Specifies the number of cells to encode an interrupt
- specifier, shall be 2
-- interrupts: interrupts references to primary interrupt controller
- (only needed for exti controller with multiple exti under
- same parent interrupt: st,stm32-exti and st,stm32h7-exti)
-
-Optional properties:
-
-- hwlocks: reference to a phandle of a hardware spinlock provider node.
-
-Example:
-
-exti: interrupt-controller@40013c00 {
- compatible = "st,stm32-exti";
- interrupt-controller;
- #interrupt-cells = <2>;
- reg = <0x40013C00 0x400>;
- interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
-};
diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
new file mode 100644
index 000000000000..39be37e1e532
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
@@ -0,0 +1,82 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/st,stm32-exti.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STM32 External Interrupt Controller Device Tree Bindings
+
+maintainers:
+ - Alexandre Torgue <alexandre.torgue@st.com>
+ - Ludovic Barre <ludovic.barre@st.com>
+
+properties:
+ compatible:
+ oneOf:
+ - items:
+ - enum:
+ - st,stm32-exti
+ - st,stm32h7-exti
+ - items:
+ - enum:
+ - st,stm32mp1-exti
+ - const: syscon
+
+ "#interrupt-cells":
+ const: 2
+
+ reg:
+ maxItems: 1
+
+ interrupt-controller: true
+
+ hwlocks:
+ maxItems: 1
+ description:
+ Reference to a phandle of a hardware spinlock provider node.
+
+required:
+ - "#interrupt-cells"
+ - compatible
+ - reg
+ - interrupt-controller
+
+allOf:
+ - $ref: /schemas/interrupt-controller.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - st,stm32-exti
+ - st,stm32h7-exti
+ then:
+ properties:
+ interrupts:
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/uint32-array
+ description:
+ Interrupts references to primary interrupt controller
+ required:
+ - interrupts
+
+examples:
+ - |
+ //Example 1
+ exti1: interrupt-controller@5000d000 {
+ compatible = "st,stm32mp1-exti", "syscon";
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ reg = <0x5000d000 0x400>;
+ };
+
+ //Example 2
+ exti2: interrupt-controller@40013c00 {
+ compatible = "st,stm32-exti";
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ reg = <0x40013C00 0x400>;
+ interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
+ };
+
+...
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] dt-bindings: interrupt-controller: Convert stm32-exti to json-schema
2019-11-14 16:41 [PATCH] dt-bindings: interrupt-controller: Convert stm32-exti to json-schema Alexandre Torgue
@ 2019-11-14 17:18 ` Rob Herring
2019-11-15 17:28 ` Alexandre Torgue
0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2019-11-14 17:18 UTC (permalink / raw)
To: Alexandre Torgue
Cc: Mark Rutland, Thomas Gleixner, Jason Cooper, Marc Zyngier,
devicetree,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
linux-kernel, linux-stm32
On Thu, Nov 14, 2019 at 10:41 AM Alexandre Torgue
<alexandre.torgue@st.com> wrote:
>
> Convert the STM32 external interrupt controller (EXTI) binding to DT
> schema format using json-schema.
>
> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
> ---
>
> Hi Rob,
>
> I planned to use "additionalProperties: false" for this schema but as I add a
> property under condition, I got an error (property added under contion seems
> to be detected as an "additional" property and then error is raised).
>
> Is there a way to fix that ?
See below.
>
> regards
> Alex
>
> diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt
> deleted file mode 100644
> index cd01b2292ec6..000000000000
> --- a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -STM32 External Interrupt Controller
> -
> -Required properties:
> -
> -- compatible: Should be:
> - "st,stm32-exti"
> - "st,stm32h7-exti"
> - "st,stm32mp1-exti"
> -- reg: Specifies base physical address and size of the registers
> -- interrupt-controller: Indentifies the node as an interrupt controller
> -- #interrupt-cells: Specifies the number of cells to encode an interrupt
> - specifier, shall be 2
> -- interrupts: interrupts references to primary interrupt controller
> - (only needed for exti controller with multiple exti under
> - same parent interrupt: st,stm32-exti and st,stm32h7-exti)
> -
> -Optional properties:
> -
> -- hwlocks: reference to a phandle of a hardware spinlock provider node.
> -
> -Example:
> -
> -exti: interrupt-controller@40013c00 {
> - compatible = "st,stm32-exti";
> - interrupt-controller;
> - #interrupt-cells = <2>;
> - reg = <0x40013C00 0x400>;
> - interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
> -};
> diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
> new file mode 100644
> index 000000000000..39be37e1e532
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
> @@ -0,0 +1,82 @@
> +# SPDX-License-Identifier: GPL-2.0
If ST has copyright on the old binding, can you add BSD here.
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/interrupt-controller/st,stm32-exti.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: STM32 External Interrupt Controller Device Tree Bindings
> +
> +maintainers:
> + - Alexandre Torgue <alexandre.torgue@st.com>
> + - Ludovic Barre <ludovic.barre@st.com>
> +
> +properties:
> + compatible:
> + oneOf:
> + - items:
> + - enum:
> + - st,stm32-exti
> + - st,stm32h7-exti
> + - items:
> + - enum:
> + - st,stm32mp1-exti
> + - const: syscon
> +
> + "#interrupt-cells":
> + const: 2
> +
> + reg:
> + maxItems: 1
> +
> + interrupt-controller: true
> +
> + hwlocks:
> + maxItems: 1
> + description:
> + Reference to a phandle of a hardware spinlock provider node.
> +
> +required:
> + - "#interrupt-cells"
> + - compatible
> + - reg
> + - interrupt-controller
> +
> +allOf:
> + - $ref: /schemas/interrupt-controller.yaml#
> + - if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - st,stm32-exti
> + - st,stm32h7-exti
> + then:
> + properties:
> + interrupts:
> + allOf:
> + - $ref: /schemas/types.yaml#/definitions/uint32-array
Standard property, doesn't need a type. You just need 'maxItems' or an
'items' list if the index is not meaningful. This appears to be the
former case.
> + description:
> + Interrupts references to primary interrupt controller
> + required:
> + - interrupts
You can move the definition to the main section as you only need
'required' here. That should fix your additionalProperties issue.
In hindsight, the mp1 case probably should have used interrupt-map.
> +
> +examples:
> + - |
> + //Example 1
> + exti1: interrupt-controller@5000d000 {
> + compatible = "st,stm32mp1-exti", "syscon";
> + interrupt-controller;
> + #interrupt-cells = <2>;
> + reg = <0x5000d000 0x400>;
> + };
> +
> + //Example 2
> + exti2: interrupt-controller@40013c00 {
> + compatible = "st,stm32-exti";
> + interrupt-controller;
> + #interrupt-cells = <2>;
> + reg = <0x40013C00 0x400>;
> + interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
> + };
> +
> +...
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] dt-bindings: interrupt-controller: Convert stm32-exti to json-schema
2019-11-14 17:18 ` Rob Herring
@ 2019-11-15 17:28 ` Alexandre Torgue
2019-11-15 17:41 ` Rob Herring
0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Torgue @ 2019-11-15 17:28 UTC (permalink / raw)
To: Rob Herring
Cc: Mark Rutland, Thomas Gleixner, Jason Cooper, Marc Zyngier,
devicetree,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
linux-kernel, linux-stm32
On 11/14/19 6:18 PM, Rob Herring wrote:
> On Thu, Nov 14, 2019 at 10:41 AM Alexandre Torgue
> <alexandre.torgue@st.com> wrote:
>>
>> Convert the STM32 external interrupt controller (EXTI) binding to DT
>> schema format using json-schema.
>>
>> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
>> ---
>>
>> Hi Rob,
>>
>> I planned to use "additionalProperties: false" for this schema but as I add a
>> property under condition, I got an error (property added under contion seems
>> to be detected as an "additional" property and then error is raised).
>>
>> Is there a way to fix that ?
>
> See below.
>
>>
>> regards
>> Alex
>>
>> diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt
>> deleted file mode 100644
>> index cd01b2292ec6..000000000000
>> --- a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt
>> +++ /dev/null
>> @@ -1,29 +0,0 @@
>> -STM32 External Interrupt Controller
>> -
>> -Required properties:
>> -
>> -- compatible: Should be:
>> - "st,stm32-exti"
>> - "st,stm32h7-exti"
>> - "st,stm32mp1-exti"
>> -- reg: Specifies base physical address and size of the registers
>> -- interrupt-controller: Indentifies the node as an interrupt controller
>> -- #interrupt-cells: Specifies the number of cells to encode an interrupt
>> - specifier, shall be 2
>> -- interrupts: interrupts references to primary interrupt controller
>> - (only needed for exti controller with multiple exti under
>> - same parent interrupt: st,stm32-exti and st,stm32h7-exti)
>> -
>> -Optional properties:
>> -
>> -- hwlocks: reference to a phandle of a hardware spinlock provider node.
>> -
>> -Example:
>> -
>> -exti: interrupt-controller@40013c00 {
>> - compatible = "st,stm32-exti";
>> - interrupt-controller;
>> - #interrupt-cells = <2>;
>> - reg = <0x40013C00 0x400>;
>> - interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
>> -};
>> diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
>> new file mode 100644
>> index 000000000000..39be37e1e532
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
>> @@ -0,0 +1,82 @@
>> +# SPDX-License-Identifier: GPL-2.0
>
> If ST has copyright on the old binding, can you add BSD here.
>
I will.
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/interrupt-controller/st,stm32-exti.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: STM32 External Interrupt Controller Device Tree Bindings
>> +
>> +maintainers:
>> + - Alexandre Torgue <alexandre.torgue@st.com>
>> + - Ludovic Barre <ludovic.barre@st.com>
>> +
>> +properties:
>> + compatible:
>> + oneOf:
>> + - items:
>> + - enum:
>> + - st,stm32-exti
>> + - st,stm32h7-exti
>> + - items:
>> + - enum:
>> + - st,stm32mp1-exti
>> + - const: syscon
>> +
>> + "#interrupt-cells":
>> + const: 2
>> +
>> + reg:
>> + maxItems: 1
>> +
>> + interrupt-controller: true
>> +
>> + hwlocks:
>> + maxItems: 1
>> + description:
>> + Reference to a phandle of a hardware spinlock provider node.
>> +
>> +required:
>> + - "#interrupt-cells"
>> + - compatible
>> + - reg
>> + - interrupt-controller
>> +
>> +allOf:
>> + - $ref: /schemas/interrupt-controller.yaml#
>> + - if:
>> + properties:
>> + compatible:
>> + contains:
>> + enum:
>> + - st,stm32-exti
>> + - st,stm32h7-exti
>> + then:
>> + properties:
>> + interrupts:
>> + allOf:
>> + - $ref: /schemas/types.yaml#/definitions/uint32-array
>
> Standard property, doesn't need a type. You just need 'maxItems' or an
> 'items' list if the index is not meaningful. This appears to be the
> former case.
ok
>
>> + description:
>> + Interrupts references to primary interrupt controller
>> + required:
>> + - interrupts
>
> You can move the definition to the main section as you only need
> 'required' here. That should fix your additionalProperties issue.
>
Doing that it fails as I don't have interrupts define for mp1
compatible. Maybe I missed something ?
> In hindsight, the mp1 case probably should have used interrupt-map.
For MP1 driver is written differently and mapping is done inside the driver.
>
>> +
>> +examples:
>> + - |
>> + //Example 1
>> + exti1: interrupt-controller@5000d000 {
>> + compatible = "st,stm32mp1-exti", "syscon";
>> + interrupt-controller;
>> + #interrupt-cells = <2>;
>> + reg = <0x5000d000 0x400>;
>> + };
>> +
>> + //Example 2
>> + exti2: interrupt-controller@40013c00 {
>> + compatible = "st,stm32-exti";
>> + interrupt-controller;
>> + #interrupt-cells = <2>;
>> + reg = <0x40013C00 0x400>;
>> + interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
>> + };
>> +
>> +...
>> --
>> 2.17.1
>>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] dt-bindings: interrupt-controller: Convert stm32-exti to json-schema
2019-11-15 17:28 ` Alexandre Torgue
@ 2019-11-15 17:41 ` Rob Herring
2019-11-15 18:11 ` Alexandre Torgue
0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2019-11-15 17:41 UTC (permalink / raw)
To: Alexandre Torgue
Cc: Mark Rutland, Thomas Gleixner, Jason Cooper, Marc Zyngier,
devicetree,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
linux-kernel, linux-stm32
On Fri, Nov 15, 2019 at 11:28 AM Alexandre Torgue
<alexandre.torgue@st.com> wrote:
>
>
>
> On 11/14/19 6:18 PM, Rob Herring wrote:
> > On Thu, Nov 14, 2019 at 10:41 AM Alexandre Torgue
> > <alexandre.torgue@st.com> wrote:
> >>
> >> Convert the STM32 external interrupt controller (EXTI) binding to DT
> >> schema format using json-schema.
> >>
> >> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
> >> ---
> >>
> >> Hi Rob,
> >>
> >> I planned to use "additionalProperties: false" for this schema but as I add a
> >> property under condition, I got an error (property added under contion seems
> >> to be detected as an "additional" property and then error is raised).
> >>
> >> Is there a way to fix that ?
> >
> > See below.
> >
> >>
> >> regards
> >> Alex
> >>
> >> diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt
> >> deleted file mode 100644
> >> index cd01b2292ec6..000000000000
> >> --- a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt
> >> +++ /dev/null
> >> @@ -1,29 +0,0 @@
> >> -STM32 External Interrupt Controller
> >> -
> >> -Required properties:
> >> -
> >> -- compatible: Should be:
> >> - "st,stm32-exti"
> >> - "st,stm32h7-exti"
> >> - "st,stm32mp1-exti"
> >> -- reg: Specifies base physical address and size of the registers
> >> -- interrupt-controller: Indentifies the node as an interrupt controller
> >> -- #interrupt-cells: Specifies the number of cells to encode an interrupt
> >> - specifier, shall be 2
> >> -- interrupts: interrupts references to primary interrupt controller
> >> - (only needed for exti controller with multiple exti under
> >> - same parent interrupt: st,stm32-exti and st,stm32h7-exti)
> >> -
> >> -Optional properties:
> >> -
> >> -- hwlocks: reference to a phandle of a hardware spinlock provider node.
> >> -
> >> -Example:
> >> -
> >> -exti: interrupt-controller@40013c00 {
> >> - compatible = "st,stm32-exti";
> >> - interrupt-controller;
> >> - #interrupt-cells = <2>;
> >> - reg = <0x40013C00 0x400>;
> >> - interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
> >> -};
> >> diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
> >> new file mode 100644
> >> index 000000000000..39be37e1e532
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
> >> @@ -0,0 +1,82 @@
> >> +# SPDX-License-Identifier: GPL-2.0
> >
> > If ST has copyright on the old binding, can you add BSD here.
> >
>
> I will.
>
> >> +%YAML 1.2
> >> +---
> >> +$id: http://devicetree.org/schemas/interrupt-controller/st,stm32-exti.yaml#
> >> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> >> +
> >> +title: STM32 External Interrupt Controller Device Tree Bindings
> >> +
> >> +maintainers:
> >> + - Alexandre Torgue <alexandre.torgue@st.com>
> >> + - Ludovic Barre <ludovic.barre@st.com>
> >> +
> >> +properties:
> >> + compatible:
> >> + oneOf:
> >> + - items:
> >> + - enum:
> >> + - st,stm32-exti
> >> + - st,stm32h7-exti
> >> + - items:
> >> + - enum:
> >> + - st,stm32mp1-exti
> >> + - const: syscon
> >> +
> >> + "#interrupt-cells":
> >> + const: 2
> >> +
> >> + reg:
> >> + maxItems: 1
> >> +
> >> + interrupt-controller: true
> >> +
> >> + hwlocks:
> >> + maxItems: 1
> >> + description:
> >> + Reference to a phandle of a hardware spinlock provider node.
> >> +
> >> +required:
> >> + - "#interrupt-cells"
> >> + - compatible
> >> + - reg
> >> + - interrupt-controller
> >> +
> >> +allOf:
> >> + - $ref: /schemas/interrupt-controller.yaml#
> >> + - if:
> >> + properties:
> >> + compatible:
> >> + contains:
> >> + enum:
> >> + - st,stm32-exti
> >> + - st,stm32h7-exti
> >> + then:
> >> + properties:
> >> + interrupts:
> >> + allOf:
> >> + - $ref: /schemas/types.yaml#/definitions/uint32-array
> >
> > Standard property, doesn't need a type. You just need 'maxItems' or an
> > 'items' list if the index is not meaningful. This appears to be the
> > former case.
>
> ok
>
> >
> >> + description:
> >> + Interrupts references to primary interrupt controller
> >> + required:
> >> + - interrupts
> >
> > You can move the definition to the main section as you only need
> > 'required' here. That should fix your additionalProperties issue.
> >
> Doing that it fails as I don't have interrupts define for mp1
> compatible. Maybe I missed something ?
Like this:
properties:
...
interrupts:
maxItems: ??
minItems: ??
allOf:
- $ref: /schemas/interrupt-controller.yaml#
- if:
properties:
compatible:
contains:
enum:
- st,stm32-exti
- st,stm32h7-exti
then:
required:
- interrupts
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] dt-bindings: interrupt-controller: Convert stm32-exti to json-schema
2019-11-15 17:41 ` Rob Herring
@ 2019-11-15 18:11 ` Alexandre Torgue
0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Torgue @ 2019-11-15 18:11 UTC (permalink / raw)
To: Rob Herring
Cc: Mark Rutland, Thomas Gleixner, Jason Cooper, Marc Zyngier,
devicetree,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
linux-kernel, linux-stm32
On 11/15/19 6:41 PM, Rob Herring wrote:
> On Fri, Nov 15, 2019 at 11:28 AM Alexandre Torgue
> <alexandre.torgue@st.com> wrote:
>>
>>
>>
>> On 11/14/19 6:18 PM, Rob Herring wrote:
>>> On Thu, Nov 14, 2019 at 10:41 AM Alexandre Torgue
>>> <alexandre.torgue@st.com> wrote:
>>>>
>>>> Convert the STM32 external interrupt controller (EXTI) binding to DT
>>>> schema format using json-schema.
>>>>
>>>> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
>>>> ---
>>>>
>>>> Hi Rob,
>>>>
>>>> I planned to use "additionalProperties: false" for this schema but as I add a
>>>> property under condition, I got an error (property added under contion seems
>>>> to be detected as an "additional" property and then error is raised).
>>>>
>>>> Is there a way to fix that ?
>>>
>>> See below.
>>>
>>>>
>>>> regards
>>>> Alex
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt
>>>> deleted file mode 100644
>>>> index cd01b2292ec6..000000000000
>>>> --- a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.txt
>>>> +++ /dev/null
>>>> @@ -1,29 +0,0 @@
>>>> -STM32 External Interrupt Controller
>>>> -
>>>> -Required properties:
>>>> -
>>>> -- compatible: Should be:
>>>> - "st,stm32-exti"
>>>> - "st,stm32h7-exti"
>>>> - "st,stm32mp1-exti"
>>>> -- reg: Specifies base physical address and size of the registers
>>>> -- interrupt-controller: Indentifies the node as an interrupt controller
>>>> -- #interrupt-cells: Specifies the number of cells to encode an interrupt
>>>> - specifier, shall be 2
>>>> -- interrupts: interrupts references to primary interrupt controller
>>>> - (only needed for exti controller with multiple exti under
>>>> - same parent interrupt: st,stm32-exti and st,stm32h7-exti)
>>>> -
>>>> -Optional properties:
>>>> -
>>>> -- hwlocks: reference to a phandle of a hardware spinlock provider node.
>>>> -
>>>> -Example:
>>>> -
>>>> -exti: interrupt-controller@40013c00 {
>>>> - compatible = "st,stm32-exti";
>>>> - interrupt-controller;
>>>> - #interrupt-cells = <2>;
>>>> - reg = <0x40013C00 0x400>;
>>>> - interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
>>>> -};
>>>> diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
>>>> new file mode 100644
>>>> index 000000000000..39be37e1e532
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
>>>> @@ -0,0 +1,82 @@
>>>> +# SPDX-License-Identifier: GPL-2.0
>>>
>>> If ST has copyright on the old binding, can you add BSD here.
>>>
>>
>> I will.
>>
>>>> +%YAML 1.2
>>>> +---
>>>> +$id: http://devicetree.org/schemas/interrupt-controller/st,stm32-exti.yaml#
>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>> +
>>>> +title: STM32 External Interrupt Controller Device Tree Bindings
>>>> +
>>>> +maintainers:
>>>> + - Alexandre Torgue <alexandre.torgue@st.com>
>>>> + - Ludovic Barre <ludovic.barre@st.com>
>>>> +
>>>> +properties:
>>>> + compatible:
>>>> + oneOf:
>>>> + - items:
>>>> + - enum:
>>>> + - st,stm32-exti
>>>> + - st,stm32h7-exti
>>>> + - items:
>>>> + - enum:
>>>> + - st,stm32mp1-exti
>>>> + - const: syscon
>>>> +
>>>> + "#interrupt-cells":
>>>> + const: 2
>>>> +
>>>> + reg:
>>>> + maxItems: 1
>>>> +
>>>> + interrupt-controller: true
>>>> +
>>>> + hwlocks:
>>>> + maxItems: 1
>>>> + description:
>>>> + Reference to a phandle of a hardware spinlock provider node.
>>>> +
>>>> +required:
>>>> + - "#interrupt-cells"
>>>> + - compatible
>>>> + - reg
>>>> + - interrupt-controller
>>>> +
>>>> +allOf:
>>>> + - $ref: /schemas/interrupt-controller.yaml#
>>>> + - if:
>>>> + properties:
>>>> + compatible:
>>>> + contains:
>>>> + enum:
>>>> + - st,stm32-exti
>>>> + - st,stm32h7-exti
>>>> + then:
>>>> + properties:
>>>> + interrupts:
>>>> + allOf:
>>>> + - $ref: /schemas/types.yaml#/definitions/uint32-array
>>>
>>> Standard property, doesn't need a type. You just need 'maxItems' or an
>>> 'items' list if the index is not meaningful. This appears to be the
>>> former case.
>>
>> ok
>>
>>>
>>>> + description:
>>>> + Interrupts references to primary interrupt controller
>>>> + required:
>>>> + - interrupts
>>>
>>> You can move the definition to the main section as you only need
>>> 'required' here. That should fix your additionalProperties issue.
>>>
>> Doing that it fails as I don't have interrupts define for mp1
>> compatible. Maybe I missed something ?
>
> Like this:
>
> properties:
> ...
> interrupts:
> maxItems: ??
> minItems: ??
>
> allOf:
> - $ref: /schemas/interrupt-controller.yaml#
> - if:
> properties:
> compatible:
> contains:
> enum:
> - st,stm32-exti
> - st,stm32h7-exti
> then:
> required:
> - interrupts
>
Yes it is better :). Let me send the V2
Thanks
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-11-15 18:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 16:41 [PATCH] dt-bindings: interrupt-controller: Convert stm32-exti to json-schema Alexandre Torgue
2019-11-14 17:18 ` Rob Herring
2019-11-15 17:28 ` Alexandre Torgue
2019-11-15 17:41 ` Rob Herring
2019-11-15 18:11 ` Alexandre Torgue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®