linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] dt-bindings: gpio: Convert vf610 to json-schema
@ 2020-08-12  7:52 Anson Huang
  2020-08-18  2:12 ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: Anson Huang @ 2020-08-12  7:52 UTC (permalink / raw)
  To: linus.walleij, bgolaszewski, robh+dt, stefan, linux-gpio,
	devicetree, linux-kernel
  Cc: Linux-imx

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

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
changes since V1:
	- fix reg property to pass build;
	- add "additionalProperties: false".
---
 .../devicetree/bindings/gpio/gpio-vf610.txt        | 63 -----------------
 .../devicetree/bindings/gpio/gpio-vf610.yaml       | 81 ++++++++++++++++++++++
 2 files changed, 81 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..6ac5a78
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
@@ -0,0 +1,81 @@
+# 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 <stefan@agner.ch>
+
+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: 2
+
+  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


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

* Re: [PATCH V2] dt-bindings: gpio: Convert vf610 to json-schema
  2020-08-12  7:52 [PATCH V2] dt-bindings: gpio: Convert vf610 to json-schema Anson Huang
@ 2020-08-18  2:12 ` Rob Herring
  2020-08-28  9:13   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2020-08-18  2:12 UTC (permalink / raw)
  To: Anson Huang
  Cc: linux-kernel, bgolaszewski, robh+dt, linux-gpio, devicetree,
	Linux-imx, linus.walleij, stefan

On Wed, 12 Aug 2020 15:52:21 +0800, Anson Huang wrote:
> Convert the vf610 gpio binding to DT schema format using json-schema.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
> changes since V1:
> 	- fix reg property to pass build;
> 	- add "additionalProperties: false".
> ---
>  .../devicetree/bindings/gpio/gpio-vf610.txt        | 63 -----------------
>  .../devicetree/bindings/gpio/gpio-vf610.yaml       | 81 ++++++++++++++++++++++
>  2 files changed, 81 insertions(+), 63 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-vf610.txt
>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
> 

Applied, thanks!

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

* Re: [PATCH V2] dt-bindings: gpio: Convert vf610 to json-schema
  2020-08-18  2:12 ` Rob Herring
@ 2020-08-28  9:13   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2020-08-28  9:13 UTC (permalink / raw)
  To: Rob Herring
  Cc: Anson Huang, linux-kernel, Bartosz Golaszewski, Rob Herring,
	open list:GPIO SUBSYSTEM,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	NXP Linux Team, Stefan Agner

Hi Rob,

On Tue, Aug 18, 2020 at 4:12 AM Rob Herring <robh@kernel.org> wrote:
> On Wed, 12 Aug 2020 15:52:21 +0800, Anson Huang wrote:
> > Convert the vf610 gpio binding to DT schema format using json-schema.
> >
> > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > ---
> > changes since V1:
> >       - fix reg property to pass build;
> >       - add "additionalProperties: false".
> > ---
> >  .../devicetree/bindings/gpio/gpio-vf610.txt        | 63 -----------------
> >  .../devicetree/bindings/gpio/gpio-vf610.yaml       | 81 ++++++++++++++++++++++
> >  2 files changed, 81 insertions(+), 63 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-vf610.txt
> >  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
> >
>
> Applied, thanks!

With the increasing number of nice GPIO yaml bindings I'm starting to
think we should create a Documentation/devicetree/bindings/gpio/common.yaml
and try to extract out commonalities, but your intuition is gonna be better
than mine about this, do you think it's worth it?

BR,
Linus Walleij

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

end of thread, other threads:[~2020-08-28  9:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12  7:52 [PATCH V2] dt-bindings: gpio: Convert vf610 to json-schema Anson Huang
2020-08-18  2:12 ` Rob Herring
2020-08-28  9:13   ` Linus Walleij

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).