2020-08-04 15:08:30

by Anson Huang

[permalink] [raw]
Subject: [PATCH] dt-bindings: gpio: Convert vf610 to json-schema

Convert the vf610 gpio binding to DT schema format using json-schema.

Signed-off-by: Anson Huang <[email protected]>
---
.../devicetree/bindings/gpio/gpio-vf610.txt | 63 -----------------
.../devicetree/bindings/gpio/gpio-vf610.yaml | 79 ++++++++++++++++++++++
2 files changed, 79 insertions(+), 63 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-vf610.txt
create mode 100644 Documentation/devicetree/bindings/gpio/gpio-vf610.yaml

diff --git a/Documentation/devicetree/bindings/gpio/gpio-vf610.txt b/Documentation/devicetree/bindings/gpio/gpio-vf610.txt
deleted file mode 100644
index ae254aa..0000000
--- a/Documentation/devicetree/bindings/gpio/gpio-vf610.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-* Freescale VF610 PORT/GPIO module
-
-The Freescale PORT/GPIO modules are two adjacent modules providing GPIO
-functionality. Each pair serves 32 GPIOs. The VF610 has 5 instances of
-each, and each PORT module has its own interrupt.
-
-Required properties for GPIO node:
-- compatible : Should be "fsl,<soc>-gpio", below is supported list:
- "fsl,vf610-gpio"
- "fsl,imx7ulp-gpio"
-- reg : The first reg tuple represents the PORT module, the second tuple
- the GPIO module.
-- interrupts : Should be the port interrupt shared by all 32 pins.
-- gpio-controller : Marks the device node as a gpio controller.
-- #gpio-cells : Should be two. The first cell is the pin number and
- the second cell is used to specify the gpio polarity:
- 0 = active high
- 1 = active low
-- interrupt-controller: Marks the device node as an interrupt controller.
-- #interrupt-cells : Should be 2. The first cell is the GPIO number.
- The second cell bits[3:0] is used to specify trigger type and level flags:
- 1 = low-to-high edge triggered.
- 2 = high-to-low edge triggered.
- 4 = active high level-sensitive.
- 8 = active low level-sensitive.
-
-Optional properties:
--clocks: Must contain an entry for each entry in clock-names.
- See common clock-bindings.txt for details.
--clock-names: A list of clock names. For imx7ulp, it must contain
- "gpio", "port".
-
-Note: Each GPIO port should have an alias correctly numbered in "aliases"
-node.
-
-Examples:
-
-aliases {
- gpio0 = &gpio1;
- gpio1 = &gpio2;
-};
-
-gpio1: gpio@40049000 {
- compatible = "fsl,vf610-gpio";
- reg = <0x40049000 0x1000 0x400ff000 0x40>;
- interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
- gpio-controller;
- #gpio-cells = <2>;
- interrupt-controller;
- #interrupt-cells = <2>;
- gpio-ranges = <&iomuxc 0 0 32>;
-};
-
-gpio2: gpio@4004a000 {
- compatible = "fsl,vf610-gpio";
- reg = <0x4004a000 0x1000 0x400ff040 0x40>;
- interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
- gpio-controller;
- #gpio-cells = <2>;
- interrupt-controller;
- #interrupt-cells = <2>;
- gpio-ranges = <&iomuxc 0 32 32>;
-};
diff --git a/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
new file mode 100644
index 0000000..315ffde
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
@@ -0,0 +1,79 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/gpio-vf610.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale VF610 PORT/GPIO module
+
+maintainers:
+ - Stefan Agner <[email protected]>
+
+description: |
+ The Freescale PORT/GPIO modules are two adjacent modules providing GPIO
+ functionality. Each pair serves 32 GPIOs. The VF610 has 5 instances of
+ each, and each PORT module has its own interrupt.
+
+ Note: Each GPIO port should have an alias correctly numbered in "aliases"
+ node.
+
+properties:
+ compatible:
+ enum:
+ - fsl,vf610-gpio
+ - fsl,imx7ulp-gpio
+
+ reg:
+ description: The first reg tuple represents the PORT module, the second tuple
+ represents the GPIO module.
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ interrupt-controller: true
+
+ "#interrupt-cells":
+ const: 2
+
+ "#gpio-cells":
+ const: 2
+
+ gpio-controller: true
+
+ clocks:
+ items:
+ - description: SoC GPIO clock
+ - description: SoC PORT clock
+
+ clock-names:
+ items:
+ - const: gpio
+ - const: port
+
+ gpio-ranges:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - interrupt-controller
+ - "#interrupt-cells"
+ - "#gpio-cells"
+ - gpio-controller
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+ gpio1: gpio@40049000 {
+ compatible = "fsl,vf610-gpio";
+ reg = <0x40049000 0x1000 0x400ff000 0x40>;
+ interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ gpio-ranges = <&iomuxc 0 0 32>;
+ };
--
2.7.4


2020-08-06 16:57:25

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH] dt-bindings: gpio: Convert vf610 to json-schema

On Tue, 04 Aug 2020 23:01:48 +0800, Anson Huang wrote:
> Convert the vf610 gpio binding to DT schema format using json-schema.
>
> Signed-off-by: Anson Huang <[email protected]>
> ---
> .../devicetree/bindings/gpio/gpio-vf610.txt | 63 -----------------
> .../devicetree/bindings/gpio/gpio-vf610.yaml | 79 ++++++++++++++++++++++
> 2 files changed, 79 insertions(+), 63 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-vf610.txt
> create mode 100644 Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
>


My bot found errors running 'make dt_binding_check' on your patch:

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/gpio/gpio-vf610.example.dt.yaml: example-0: gpio@40049000:reg:0: [1074040832, 4096, 1074786304, 64] is too long


See https://patchwork.ozlabs.org/patch/1340897

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure dt-schema is up to date:

pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade

Please check and re-submit.

2020-08-06 17:41:05

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH] dt-bindings: gpio: Convert vf610 to json-schema

On Tue, Aug 04, 2020 at 11:01:48PM +0800, Anson Huang wrote:
> Convert the vf610 gpio binding to DT schema format using json-schema.
>
> Signed-off-by: Anson Huang <[email protected]>
> ---
> .../devicetree/bindings/gpio/gpio-vf610.txt | 63 -----------------
> .../devicetree/bindings/gpio/gpio-vf610.yaml | 79 ++++++++++++++++++++++
> 2 files changed, 79 insertions(+), 63 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-vf610.txt
> create mode 100644 Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
>
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-vf610.txt b/Documentation/devicetree/bindings/gpio/gpio-vf610.txt
> deleted file mode 100644
> index ae254aa..0000000
> --- a/Documentation/devicetree/bindings/gpio/gpio-vf610.txt
> +++ /dev/null
> @@ -1,63 +0,0 @@
> -* Freescale VF610 PORT/GPIO module
> -
> -The Freescale PORT/GPIO modules are two adjacent modules providing GPIO
> -functionality. Each pair serves 32 GPIOs. The VF610 has 5 instances of
> -each, and each PORT module has its own interrupt.
> -
> -Required properties for GPIO node:
> -- compatible : Should be "fsl,<soc>-gpio", below is supported list:
> - "fsl,vf610-gpio"
> - "fsl,imx7ulp-gpio"
> -- reg : The first reg tuple represents the PORT module, the second tuple
> - the GPIO module.
> -- interrupts : Should be the port interrupt shared by all 32 pins.
> -- gpio-controller : Marks the device node as a gpio controller.
> -- #gpio-cells : Should be two. The first cell is the pin number and
> - the second cell is used to specify the gpio polarity:
> - 0 = active high
> - 1 = active low
> -- interrupt-controller: Marks the device node as an interrupt controller.
> -- #interrupt-cells : Should be 2. The first cell is the GPIO number.
> - The second cell bits[3:0] is used to specify trigger type and level flags:
> - 1 = low-to-high edge triggered.
> - 2 = high-to-low edge triggered.
> - 4 = active high level-sensitive.
> - 8 = active low level-sensitive.
> -
> -Optional properties:
> --clocks: Must contain an entry for each entry in clock-names.
> - See common clock-bindings.txt for details.
> --clock-names: A list of clock names. For imx7ulp, it must contain
> - "gpio", "port".
> -
> -Note: Each GPIO port should have an alias correctly numbered in "aliases"
> -node.
> -
> -Examples:
> -
> -aliases {
> - gpio0 = &gpio1;
> - gpio1 = &gpio2;
> -};
> -
> -gpio1: gpio@40049000 {
> - compatible = "fsl,vf610-gpio";
> - reg = <0x40049000 0x1000 0x400ff000 0x40>;
> - interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
> - gpio-controller;
> - #gpio-cells = <2>;
> - interrupt-controller;
> - #interrupt-cells = <2>;
> - gpio-ranges = <&iomuxc 0 0 32>;
> -};
> -
> -gpio2: gpio@4004a000 {
> - compatible = "fsl,vf610-gpio";
> - reg = <0x4004a000 0x1000 0x400ff040 0x40>;
> - interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
> - gpio-controller;
> - #gpio-cells = <2>;
> - interrupt-controller;
> - #interrupt-cells = <2>;
> - gpio-ranges = <&iomuxc 0 32 32>;
> -};
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
> new file mode 100644
> index 0000000..315ffde
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
> @@ -0,0 +1,79 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/gpio/gpio-vf610.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Freescale VF610 PORT/GPIO module
> +
> +maintainers:
> + - Stefan Agner <[email protected]>
> +
> +description: |
> + The Freescale PORT/GPIO modules are two adjacent modules providing GPIO
> + functionality. Each pair serves 32 GPIOs. The VF610 has 5 instances of
> + each, and each PORT module has its own interrupt.
> +
> + Note: Each GPIO port should have an alias correctly numbered in "aliases"
> + node.
> +
> +properties:
> + compatible:
> + enum:
> + - fsl,vf610-gpio
> + - fsl,imx7ulp-gpio
> +
> + reg:
> + description: The first reg tuple represents the PORT module, the second tuple
> + represents the GPIO module.
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1
> +
> + interrupt-controller: true
> +
> + "#interrupt-cells":
> + const: 2
> +
> + "#gpio-cells":
> + const: 2
> +
> + gpio-controller: true
> +
> + clocks:
> + items:
> + - description: SoC GPIO clock
> + - description: SoC PORT clock
> +
> + clock-names:
> + items:
> + - const: gpio
> + - const: port
> +
> + gpio-ranges:
> + maxItems: 1
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> + - interrupt-controller
> + - "#interrupt-cells"
> + - "#gpio-cells"
> + - gpio-controller

additionalProperties: false

> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> + gpio1: gpio@40049000 {
> + compatible = "fsl,vf610-gpio";
> + reg = <0x40049000 0x1000 0x400ff000 0x40>;
> + interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
> + gpio-controller;
> + #gpio-cells = <2>;
> + interrupt-controller;
> + #interrupt-cells = <2>;
> + gpio-ranges = <&iomuxc 0 0 32>;
> + };
> --
> 2.7.4
>

2020-08-07 01:55:03

by Anson Huang

[permalink] [raw]
Subject: RE: [PATCH] dt-bindings: gpio: Convert vf610 to json-schema

Hi, Rob


> Subject: Re: [PATCH] dt-bindings: gpio: Convert vf610 to json-schema
>
> On Tue, 04 Aug 2020 23:01:48 +0800, Anson Huang wrote:
> > Convert the vf610 gpio binding to DT schema format using json-schema.
> >
> > Signed-off-by: Anson Huang <[email protected]>
> > ---
> > .../devicetree/bindings/gpio/gpio-vf610.txt | 63 -----------------
> > .../devicetree/bindings/gpio/gpio-vf610.yaml | 79
> ++++++++++++++++++++++
> > 2 files changed, 79 insertions(+), 63 deletions(-) delete mode
> > 100644 Documentation/devicetree/bindings/gpio/gpio-vf610.txt
> > create mode 100644
> > Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
> >
>
>
> My bot found errors running 'make dt_binding_check' on your patch:
>
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/gpio/
> gpio-vf610.example.dt.yaml: example-0: gpio@40049000:reg:0: [1074040832,
> 4096, 1074786304, 64] is too long
>

I updated the dt-schema and the latest commit is as below, and there is no build error
on my side, do you know why?

commit 8fd8ce7ff6bd47616ceb48f69d1a04116dee7a41
Author: Rob Herring <[email protected]>
Date: Wed Aug 5 10:38:08 2020 -0600

dt-extract-example: Use the C yaml parser

The 'pure' (Python) loader was needed at one time for YAML 1.2, but ruamel
has supported 1.2 with its libyaml since 0.15.63 and we depend on version
0.15.70 at least.

Signed-off-by: Rob Herring <[email protected]>

tools/dt-extract-example


anson@anson-OptiPlex-790:~/workspace/stash/linux-next$ make.cross ARCH=arm dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
make CROSS_COMPILE=/opt/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi- --jobs=8 ARCH=arm dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
CHKDT Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
SCHEMA Documentation/devicetree/bindings/processed-schema-examples.yaml
/home/anson/workspace/stash/linux-next/Documentation/devicetree/bindings/pinctrl/ingenic,pinctrl.yaml: ignoring, error in schema: additionalProperties
warning: no schema found in file: ./Documentation/devicetree/bindings/pinctrl/ingenic,pinctrl.yaml
DTC Documentation/devicetree/bindings/gpio/gpio-vf610.example.dt.yaml
CHECK Documentation/devicetree/bindings/gpio/gpio-vf610.example.dt.yaml
anson@anson-OptiPlex-790:~/workspace/stash/linux-next$

Thanks,
Anson