Skip to contentSkip to conversation

dt-bindings: gpio: Convert i.MX to json-schema

PATCH In review Anson Huang 2 participants 2 messages Apr 13, 2020 – Apr 20, 2020

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

PATCH 1/1 dt-bindings: gpio: Convert i.MX to json-schema

Convert the i.MX GPIO binding to DT schema format using json-schema.

---
 .../devicetree/bindings/gpio/fsl-imx-gpio.txt      | 35 -----------
 .../devicetree/bindings/gpio/fsl-imx-gpio.yaml     | 72 ++++++++++++++++++++++
 2 files changed, 72 insertions(+), 35 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/gpio/fsl-imx-gpio.txt
 create mode 100644 Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
Documentation/devicetree/bindings/gpio/fsl-imx-gpio.txt deleted +0 -35
deleted file mode 100644
index b4cd9f90..0000000
@@ -1,35 +0,0 @@
-* Freescale i.MX/MXC GPIO controller
-
-Required properties:
-- compatible : Should be "fsl,<soc>-gpio"
-- reg : Address and length of the register set for the device
-- interrupts : Should be the port interrupt shared by all 32 pins, if
-  one number.  If two numbers, the first one is the interrupt shared
-  by low 16 pins and the second one is for high 16 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: the clock for clocking the GPIO silicon
-
-Example:
-
-gpio0: gpio@73f84000 {
-	compatible = "fsl,imx51-gpio", "fsl,imx35-gpio";
-	reg = <0x73f84000 0x4000>;
-	interrupts = <50 51>;
-	gpio-controller;
-	#gpio-cells = <2>;
-	interrupt-controller;
-	#interrupt-cells = <2>;
-};
Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml new file +72 -0

72 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 68 lines · Anson Huang

Convert the i.MX GPIO binding to DT schema format using json-schema.

---
 .../devicetree/bindings/gpio/fsl-imx-gpio.txt      | 35 -----------
 .../devicetree/bindings/gpio/fsl-imx-gpio.yaml     | 72 ++++++++++++++++++++++
 2 files changed, 72 insertions(+), 35 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/gpio/fsl-imx-gpio.txt
 create mode 100644 Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
Documentation/devicetree/bindings/gpio/fsl-imx-gpio.txt deleted +0 -35
deleted file mode 100644
index b4cd9f90..0000000
@@ -1,35 +0,0 @@
-* Freescale i.MX/MXC GPIO controller
-
-Required properties:
-- compatible : Should be "fsl,<soc>-gpio"
-- reg : Address and length of the register set for the device
-- interrupts : Should be the port interrupt shared by all 32 pins, if
-  one number.  If two numbers, the first one is the interrupt shared
-  by low 16 pins and the second one is for high 16 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: the clock for clocking the GPIO silicon
-
-Example:
-
-gpio0: gpio@73f84000 {
-	compatible = "fsl,imx51-gpio", "fsl,imx35-gpio";
-	reg = <0x73f84000 0x4000>;
-	interrupts = <50 51>;
-	gpio-controller;
-	#gpio-cells = <2>;
-	interrupt-controller;
-	#interrupt-cells = <2>;
-};
Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml new file +11 -0
new file mode 100644
index 0000000..465104c
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/fsl-imx-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale i.MX/MXC GPIO controller
+
+maintainers:
+  - Anson Huang <[email protected]>
+

Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml line 21

Quoted 10 lines
Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml new file +10 -0
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - fsl,imx1-gpio
+              - fsl,imx21-gpio
+              - fsl,imx31-gpio
+              - fsl,imx35-gpio
+              - fsl,imx7d-gpio

compatible:
enum:
- fsl,imx1-gpio
- fsl,imx21-gpio
- fsl,imx31-gpio
- fsl,imx35-gpio
- fsl,imx7d-gpio

Quoted 10 lines
Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml new file +10 -0
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    description: |
+      Should be the port interrupt shared by all 32 pins, if one number.
+      If two numbers, the first one is the interrupt shared by low 16 pins
+      and the second one is for high 16 pins.
+    minItems: 1

Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml line 41

Quoted 10 lines
Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml new file +10 -0
+    maxItems: 2
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
+  clocks:
+    description: |
+      The clock for clocking the GPIO silicon.

Can drop.

Quoted 34 lines
Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml new file +31 -0
+    maxItems: 1
+
+  "#gpio-cells":
+    const: 2
+
+  gpio-controller: true
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-controller
+  - "#interrupt-cells"
+  - "#gpio-cells"
+  - gpio-controller
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio0: gpio@73f84000 {
+        compatible = "fsl,imx35-gpio";
+        reg = <0x73f84000 0x4000>;
+        interrupts = <50 51>;
+        gpio-controller;
+        #gpio-cells = <2>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+    };
+
+...
Signature · 1 line
2.7.4