All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema
@ 2021-05-11  9:01 Aswath Govindraju
  2021-05-17 22:15 ` Rob Herring
  2021-05-27  0:17 ` Linus Walleij
  0 siblings, 2 replies; 10+ messages in thread
From: Aswath Govindraju @ 2021-05-11  9:01 UTC (permalink / raw)
  Cc: Vignesh Raghavendra, Lokesh Vutla, Grygorii Strashko,
	Kishon Vijay Abraham I, Aswath Govindraju, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Keerthy, linux-gpio,
	devicetree, linux-kernel

Convert gpio-davinci dt-binding documentation from txt to yaml format.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
---
 .../devicetree/bindings/gpio/gpio-davinci.txt | 167 ---------------
 .../bindings/gpio/gpio-davinci.yaml           | 193 ++++++++++++++++++
 MAINTAINERS                                   |   2 +-
 3 files changed, 194 insertions(+), 168 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.yaml

diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
deleted file mode 100644
index 696ea46227d1..000000000000
--- a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
+++ /dev/null
@@ -1,167 +0,0 @@
-Davinci/Keystone GPIO controller bindings
-
-Required Properties:
-- compatible: should be "ti,dm6441-gpio": for Davinci da850 SoCs
-			"ti,keystone-gpio": for Keystone 2 66AK2H/K, 66AK2L,
-						66AK2E SoCs
-			"ti,k2g-gpio", "ti,keystone-gpio": for 66AK2G
-			"ti,am654-gpio", "ti,keystone-gpio": for TI K3 AM654
-			"ti,j721e-gpio", "ti,keystone-gpio": for J721E SoCs
-			"ti,am64-gpio", "ti,keystone-gpio": for AM64 SoCs
-
-- reg: Physical base address of the controller and the size of memory mapped
-       registers.
-
-- gpio-controller : Marks the device node as a gpio controller.
-
-- #gpio-cells : Should be two.
-  - first cell is the pin number
-  - second cell is used to specify optional parameters (unused)
-
-- interrupts: Array of GPIO interrupt number. Only banked or unbanked IRQs are
-	      supported at a time.
-
-- ti,ngpio: The number of GPIO pins supported.
-
-- ti,davinci-gpio-unbanked: The number of GPIOs that have an individual interrupt
-		            line to processor.
-
-- clocks: Should contain the device's input clock, and should be defined as per
-          the appropriate clock bindings consumer usage in,
-
-          Documentation/devicetree/bindings/clock/keystone-gate.txt
-                            for 66AK2HK/66AK2L/66AK2E SoCs or,
-
-          Documentation/devicetree/bindings/clock/ti,sci-clk.txt
-                            for 66AK2G SoCs
-
-- clock-names: Name should be "gpio";
-
-Currently clock-names and clocks are needed for all keystone 2 platforms
-Davinci platforms do not have DT clocks as of now.
-
-The GPIO controller also acts as an interrupt controller. It uses the default
-two cells specifier as described in Documentation/devicetree/bindings/
-interrupt-controller/interrupts.txt.
-
-Example:
-
-gpio: gpio@1e26000 {
-	compatible = "ti,dm6441-gpio";
-	gpio-controller;
-	#gpio-cells = <2>;
-	reg = <0x226000 0x1000>;
-	interrupt-parent = <&intc>;
-	interrupts = <42 IRQ_TYPE_EDGE_BOTH 43 IRQ_TYPE_EDGE_BOTH
-		44 IRQ_TYPE_EDGE_BOTH 45 IRQ_TYPE_EDGE_BOTH
-		46 IRQ_TYPE_EDGE_BOTH 47 IRQ_TYPE_EDGE_BOTH
-		48 IRQ_TYPE_EDGE_BOTH 49 IRQ_TYPE_EDGE_BOTH
-		50 IRQ_TYPE_EDGE_BOTH>;
-	ti,ngpio = <144>;
-	ti,davinci-gpio-unbanked = <0>;
-	interrupt-controller;
-	#interrupt-cells = <2>;
-};
-
-leds {
-	compatible = "gpio-leds";
-
-	led1 {
-		label = "davinci:green:usr1";
-		gpios = <&gpio 10 GPIO_ACTIVE_HIGH>;
-		...
-	};
-
-	led2 {
-		label = "davinci:red:debug1";
-		gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
-		...
-	};
-};
-
-Example for 66AK2G:
-
-gpio0: gpio@2603000 {
-	compatible = "ti,k2g-gpio", "ti,keystone-gpio";
-	reg = <0x02603000 0x100>;
-	gpio-controller;
-	#gpio-cells = <2>;
-	interrupts = <GIC_SPI 432 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 433 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 434 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 435 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 436 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 437 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 438 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 439 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 440 IRQ_TYPE_EDGE_RISING>;
-	interrupt-controller;
-	#interrupt-cells = <2>;
-	ti,ngpio = <144>;
-	ti,davinci-gpio-unbanked = <0>;
-	clocks = <&k2g_clks 0x001b 0x0>;
-	clock-names = "gpio";
-};
-
-Example for 66AK2HK/66AK2L/66AK2E:
-
-gpio0: gpio@260bf00 {
-	compatible = "ti,keystone-gpio";
-	reg = <0x0260bf00 0x100>;
-	gpio-controller;
-	#gpio-cells = <2>;
-	/* HW Interrupts mapped to GPIO pins */
-	interrupts = <GIC_SPI 120 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 121 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 122 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 123 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 124 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 125 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 126 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 127 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 128 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 129 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 130 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 131 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 132 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 133 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 134 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 135 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 136 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 137 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 138 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 139 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 140 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 141 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 142 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 143 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 144 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 145 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 146 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 147 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 148 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 149 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 150 IRQ_TYPE_EDGE_RISING>,
-			<GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
-			clocks = <&clkgpio>;
-	clock-names = "gpio";
-	ti,ngpio = <32>;
-	ti,davinci-gpio-unbanked = <32>;
-};
-
-Example for K3 AM654:
-
-wkup_gpio0: wkup_gpio0@42110000 {
-	compatible = "ti,am654-gpio", "ti,keystone-gpio";
-	reg = <0x42110000 0x100>;
-	gpio-controller;
-	#gpio-cells = <2>;
-	interrupt-parent = <&intr_wkup_gpio>;
-	interrupts = <59 128>, <59 129>, <59 130>, <59 131>;
-	interrupt-controller;
-	#interrupt-cells = <2>;
-	ti,ngpio = <56>;
-	ti,davinci-gpio-unbanked = <0>;
-	clocks = <&k3_clks 59 0>;
-	clock-names = "gpio";
-};
diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml b/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
new file mode 100644
index 000000000000..1e16172669c7
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
@@ -0,0 +1,193 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/gpio-davinci.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: GPIO controller for Davinci and keystone devices
+
+maintainers:
+  - Keerthy <j-keerthy@ti.com>
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - ti,k2g-gpio
+              - ti,am654-gpio
+              - ti,j721e-gpio
+              - ti,am64-gpio
+          - const: ti,keystone-gpio
+
+      - items:
+          - const: ti,dm6441-gpio
+      - items:
+          - const: ti,keystone-gpio
+
+  reg:
+    maxItems: 1
+    description:
+      Physical base address of the controller and the size of memory mapped registers.
+
+  gpio-controller: true
+
+  gpio-ranges: true
+
+  gpio-line-names:
+    description: strings describing the names of each gpio line.
+
+  "#gpio-cells":
+    const: 2
+    description:
+      first cell is the pin number and second cell is used to specify optional parameters (unused).
+
+  interrupts:
+    description:
+      Array of GPIO interrupt number. Only banked or unbanked IRQs are supported at a time.
+
+  ti,ngpio:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: The number of GPIO pins supported consecutively.
+    minimum: 1
+
+  ti,davinci-gpio-unbanked:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: The number of GPIOs that have an individual interrupt line to processor.
+    minimum: 0
+
+  clocks:
+    maxItems: 1
+    description:
+      clock-specifier to represent input to the GPIO controller.
+
+  clock-names:
+    const: gpio
+
+  interrupt-controller: true
+
+  power-domains:
+    maxItems: 1
+    description:
+      Phandle to the power domain provider node.
+
+  "#interrupt-cells":
+    const: 2
+
+patternProperties:
+  "-hog$":
+    type: object
+    properties:
+      gpios: true
+      gpio-hog: true
+      input: true
+      output-high: true
+      output-low: true
+      line-name: true
+
+    required:
+      - gpio-hog
+      - gpios
+
+required:
+  - compatible
+  - reg
+  - gpio-controller
+  - "#gpio-cells"
+  - interrupts
+  - ti,ngpio
+  - ti,davinci-gpio-unbanked
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include<dt-bindings/interrupt-controller/arm-gic.h>
+
+    gpio0: gpio@2603000 {
+      compatible = "ti,k2g-gpio", "ti,keystone-gpio";
+      reg = <0x02603000 0x100>;
+      gpio-controller;
+      #gpio-cells = <2>;
+      interrupts = <GIC_SPI 432 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 433 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 434 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 435 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 436 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 437 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 438 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 439 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 440 IRQ_TYPE_EDGE_RISING>;
+      interrupt-controller;
+      #interrupt-cells = <2>;
+      ti,ngpio = <144>;
+      ti,davinci-gpio-unbanked = <0>;
+      clocks = <&k2g_clks 0x001b 0x0>;
+      clock-names = "gpio";
+    };
+
+  - |
+    #include<dt-bindings/interrupt-controller/arm-gic.h>
+
+    gpio1: gpio@260bf00 {
+      compatible = "ti,keystone-gpio";
+      reg = <0x0260bf00 0x100>;
+      gpio-controller;
+      #gpio-cells = <2>;
+      /* HW Interrupts mapped to GPIO pins */
+      interrupts = <GIC_SPI 120 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 121 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 122 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 123 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 124 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 125 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 126 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 127 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 128 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 129 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 130 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 131 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 132 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 133 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 134 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 135 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 136 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 137 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 138 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 139 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 140 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 141 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 142 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 143 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 144 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 145 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 146 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 147 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 148 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 149 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 150 IRQ_TYPE_EDGE_RISING>,
+                   <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
+      clocks = <&clkgpio>;
+      clock-names = "gpio";
+      ti,ngpio = <32>;
+      ti,davinci-gpio-unbanked = <32>;
+    };
+
+  - |
+    wkup_gpio0: wkup_gpio0@42110000 {
+      compatible = "ti,am654-gpio", "ti,keystone-gpio";
+      reg = <0x42110000 0x100>;
+      gpio-controller;
+      #gpio-cells = <2>;
+      interrupt-parent = <&intr_wkup_gpio>;
+      interrupts = <60>, <61>, <62>, <63>;
+      interrupt-controller;
+      #interrupt-cells = <2>;
+      ti,ngpio = <56>;
+      ti,davinci-gpio-unbanked = <0>;
+      clocks = <&k3_clks 59 0>;
+      clock-names = "gpio";
+    };
+
diff --git a/MAINTAINERS b/MAINTAINERS
index 6e183abbbd2e..6b3519db8085 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18269,7 +18269,7 @@ TI DAVINCI SERIES GPIO DRIVER
 M:	Keerthy <j-keerthy@ti.com>
 L:	linux-gpio@vger.kernel.org
 S:	Maintained
-F:	Documentation/devicetree/bindings/gpio/gpio-davinci.txt
+F:	Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
 F:	drivers/gpio/gpio-davinci.c
 
 TI DAVINCI SERIES MEDIA DRIVER
-- 
2.17.1


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

* Re: [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema
  2021-05-11  9:01 [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema Aswath Govindraju
@ 2021-05-17 22:15 ` Rob Herring
  2021-05-18 14:13   ` Aswath Govindraju
  2021-05-21  8:31   ` Grygorii Strashko
  2021-05-27  0:17 ` Linus Walleij
  1 sibling, 2 replies; 10+ messages in thread
From: Rob Herring @ 2021-05-17 22:15 UTC (permalink / raw)
  To: Aswath Govindraju
  Cc: Vignesh Raghavendra, Lokesh Vutla, Grygorii Strashko,
	Kishon Vijay Abraham I, Linus Walleij, Bartosz Golaszewski,
	Keerthy, linux-gpio, devicetree, linux-kernel

On Tue, May 11, 2021 at 02:31:20PM +0530, Aswath Govindraju wrote:
> Convert gpio-davinci dt-binding documentation from txt to yaml format.
> 
> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
> ---
>  .../devicetree/bindings/gpio/gpio-davinci.txt | 167 ---------------
>  .../bindings/gpio/gpio-davinci.yaml           | 193 ++++++++++++++++++
>  MAINTAINERS                                   |   2 +-
>  3 files changed, 194 insertions(+), 168 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
> 
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> deleted file mode 100644
> index 696ea46227d1..000000000000
> --- a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> +++ /dev/null
> @@ -1,167 +0,0 @@
> -Davinci/Keystone GPIO controller bindings
> -
> -Required Properties:
> -- compatible: should be "ti,dm6441-gpio": for Davinci da850 SoCs
> -			"ti,keystone-gpio": for Keystone 2 66AK2H/K, 66AK2L,
> -						66AK2E SoCs
> -			"ti,k2g-gpio", "ti,keystone-gpio": for 66AK2G
> -			"ti,am654-gpio", "ti,keystone-gpio": for TI K3 AM654
> -			"ti,j721e-gpio", "ti,keystone-gpio": for J721E SoCs
> -			"ti,am64-gpio", "ti,keystone-gpio": for AM64 SoCs
> -
> -- reg: Physical base address of the controller and the size of memory mapped
> -       registers.
> -
> -- gpio-controller : Marks the device node as a gpio controller.
> -
> -- #gpio-cells : Should be two.
> -  - first cell is the pin number
> -  - second cell is used to specify optional parameters (unused)
> -
> -- interrupts: Array of GPIO interrupt number. Only banked or unbanked IRQs are
> -	      supported at a time.
> -
> -- ti,ngpio: The number of GPIO pins supported.
> -
> -- ti,davinci-gpio-unbanked: The number of GPIOs that have an individual interrupt
> -		            line to processor.
> -
> -- clocks: Should contain the device's input clock, and should be defined as per
> -          the appropriate clock bindings consumer usage in,
> -
> -          Documentation/devicetree/bindings/clock/keystone-gate.txt
> -                            for 66AK2HK/66AK2L/66AK2E SoCs or,
> -
> -          Documentation/devicetree/bindings/clock/ti,sci-clk.txt
> -                            for 66AK2G SoCs
> -
> -- clock-names: Name should be "gpio";
> -
> -Currently clock-names and clocks are needed for all keystone 2 platforms
> -Davinci platforms do not have DT clocks as of now.
> -
> -The GPIO controller also acts as an interrupt controller. It uses the default
> -two cells specifier as described in Documentation/devicetree/bindings/
> -interrupt-controller/interrupts.txt.
> -
> -Example:
> -
> -gpio: gpio@1e26000 {
> -	compatible = "ti,dm6441-gpio";
> -	gpio-controller;
> -	#gpio-cells = <2>;
> -	reg = <0x226000 0x1000>;
> -	interrupt-parent = <&intc>;
> -	interrupts = <42 IRQ_TYPE_EDGE_BOTH 43 IRQ_TYPE_EDGE_BOTH
> -		44 IRQ_TYPE_EDGE_BOTH 45 IRQ_TYPE_EDGE_BOTH
> -		46 IRQ_TYPE_EDGE_BOTH 47 IRQ_TYPE_EDGE_BOTH
> -		48 IRQ_TYPE_EDGE_BOTH 49 IRQ_TYPE_EDGE_BOTH
> -		50 IRQ_TYPE_EDGE_BOTH>;
> -	ti,ngpio = <144>;
> -	ti,davinci-gpio-unbanked = <0>;
> -	interrupt-controller;
> -	#interrupt-cells = <2>;
> -};
> -
> -leds {
> -	compatible = "gpio-leds";
> -
> -	led1 {
> -		label = "davinci:green:usr1";
> -		gpios = <&gpio 10 GPIO_ACTIVE_HIGH>;
> -		...
> -	};
> -
> -	led2 {
> -		label = "davinci:red:debug1";
> -		gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
> -		...
> -	};
> -};
> -
> -Example for 66AK2G:
> -
> -gpio0: gpio@2603000 {
> -	compatible = "ti,k2g-gpio", "ti,keystone-gpio";
> -	reg = <0x02603000 0x100>;
> -	gpio-controller;
> -	#gpio-cells = <2>;
> -	interrupts = <GIC_SPI 432 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 433 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 434 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 435 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 436 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 437 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 438 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 439 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 440 IRQ_TYPE_EDGE_RISING>;
> -	interrupt-controller;
> -	#interrupt-cells = <2>;
> -	ti,ngpio = <144>;
> -	ti,davinci-gpio-unbanked = <0>;
> -	clocks = <&k2g_clks 0x001b 0x0>;
> -	clock-names = "gpio";
> -};
> -
> -Example for 66AK2HK/66AK2L/66AK2E:
> -
> -gpio0: gpio@260bf00 {
> -	compatible = "ti,keystone-gpio";
> -	reg = <0x0260bf00 0x100>;
> -	gpio-controller;
> -	#gpio-cells = <2>;
> -	/* HW Interrupts mapped to GPIO pins */
> -	interrupts = <GIC_SPI 120 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 121 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 122 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 123 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 124 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 125 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 126 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 127 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 128 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 129 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 130 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 131 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 132 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 133 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 134 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 135 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 136 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 137 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 138 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 139 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 140 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 141 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 142 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 143 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 144 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 145 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 146 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 147 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 148 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 149 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 150 IRQ_TYPE_EDGE_RISING>,
> -			<GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
> -			clocks = <&clkgpio>;
> -	clock-names = "gpio";
> -	ti,ngpio = <32>;
> -	ti,davinci-gpio-unbanked = <32>;
> -};
> -
> -Example for K3 AM654:
> -
> -wkup_gpio0: wkup_gpio0@42110000 {
> -	compatible = "ti,am654-gpio", "ti,keystone-gpio";
> -	reg = <0x42110000 0x100>;
> -	gpio-controller;
> -	#gpio-cells = <2>;
> -	interrupt-parent = <&intr_wkup_gpio>;
> -	interrupts = <59 128>, <59 129>, <59 130>, <59 131>;
> -	interrupt-controller;
> -	#interrupt-cells = <2>;
> -	ti,ngpio = <56>;
> -	ti,davinci-gpio-unbanked = <0>;
> -	clocks = <&k3_clks 59 0>;
> -	clock-names = "gpio";
> -};
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml b/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
> new file mode 100644
> index 000000000000..1e16172669c7
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
> @@ -0,0 +1,193 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/gpio/gpio-davinci.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: GPIO controller for Davinci and keystone devices
> +
> +maintainers:
> +  - Keerthy <j-keerthy@ti.com>
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - items:
> +          - enum:
> +              - ti,k2g-gpio
> +              - ti,am654-gpio
> +              - ti,j721e-gpio
> +              - ti,am64-gpio
> +          - const: ti,keystone-gpio
> +
> +      - items:
> +          - const: ti,dm6441-gpio
> +      - items:
> +          - const: ti,keystone-gpio

These 2 can be expressed as an 'enum'.

> +
> +  reg:
> +    maxItems: 1
> +    description:
> +      Physical base address of the controller and the size of memory mapped registers.

Drop. That's every 'reg' property.

> +
> +  gpio-controller: true
> +
> +  gpio-ranges: true
> +
> +  gpio-line-names:
> +    description: strings describing the names of each gpio line.

Any constraints like min/max number of lines? 

> +
> +  "#gpio-cells":
> +    const: 2
> +    description:
> +      first cell is the pin number and second cell is used to specify optional parameters (unused).
> +
> +  interrupts:
> +    description:
> +      Array of GPIO interrupt number. Only banked or unbanked IRQs are supported at a time.

Needs constraints. How many items and what are they?

> +
> +  ti,ngpio:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: The number of GPIO pins supported consecutively.
> +    minimum: 1
> +
> +  ti,davinci-gpio-unbanked:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: The number of GPIOs that have an individual interrupt line to processor.
> +    minimum: 0
> +
> +  clocks:
> +    maxItems: 1
> +    description:
> +      clock-specifier to represent input to the GPIO controller.

Drop description.

> +
> +  clock-names:
> +    const: gpio
> +
> +  interrupt-controller: true
> +
> +  power-domains:
> +    maxItems: 1
> +    description:
> +      Phandle to the power domain provider node.

Drop.

> +
> +  "#interrupt-cells":
> +    const: 2
> +
> +patternProperties:
> +  "-hog$":
> +    type: object
> +    properties:
> +      gpios: true
> +      gpio-hog: true
> +      input: true
> +      output-high: true
> +      output-low: true
> +      line-name: true
> +
> +    required:
> +      - gpio-hog
> +      - gpios
> +
> +required:
> +  - compatible
> +  - reg
> +  - gpio-controller
> +  - "#gpio-cells"
> +  - interrupts
> +  - ti,ngpio
> +  - ti,davinci-gpio-unbanked
> +  - clocks
> +  - clock-names
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include<dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    gpio0: gpio@2603000 {
> +      compatible = "ti,k2g-gpio", "ti,keystone-gpio";
> +      reg = <0x02603000 0x100>;
> +      gpio-controller;
> +      #gpio-cells = <2>;
> +      interrupts = <GIC_SPI 432 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 433 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 434 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 435 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 436 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 437 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 438 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 439 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 440 IRQ_TYPE_EDGE_RISING>;
> +      interrupt-controller;
> +      #interrupt-cells = <2>;
> +      ti,ngpio = <144>;
> +      ti,davinci-gpio-unbanked = <0>;
> +      clocks = <&k2g_clks 0x001b 0x0>;
> +      clock-names = "gpio";
> +    };
> +
> +  - |
> +    #include<dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    gpio1: gpio@260bf00 {
> +      compatible = "ti,keystone-gpio";
> +      reg = <0x0260bf00 0x100>;
> +      gpio-controller;
> +      #gpio-cells = <2>;
> +      /* HW Interrupts mapped to GPIO pins */
> +      interrupts = <GIC_SPI 120 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 121 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 122 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 123 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 124 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 125 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 126 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 127 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 128 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 129 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 130 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 131 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 132 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 133 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 134 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 135 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 136 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 137 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 138 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 139 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 140 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 141 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 142 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 143 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 144 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 145 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 146 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 147 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 148 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 149 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 150 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
> +      clocks = <&clkgpio>;
> +      clock-names = "gpio";
> +      ti,ngpio = <32>;
> +      ti,davinci-gpio-unbanked = <32>;
> +    };
> +
> +  - |
> +    wkup_gpio0: wkup_gpio0@42110000 {

gpio@...

> +      compatible = "ti,am654-gpio", "ti,keystone-gpio";
> +      reg = <0x42110000 0x100>;
> +      gpio-controller;
> +      #gpio-cells = <2>;
> +      interrupt-parent = <&intr_wkup_gpio>;
> +      interrupts = <60>, <61>, <62>, <63>;
> +      interrupt-controller;
> +      #interrupt-cells = <2>;
> +      ti,ngpio = <56>;
> +      ti,davinci-gpio-unbanked = <0>;
> +      clocks = <&k3_clks 59 0>;
> +      clock-names = "gpio";
> +    };
> +
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 6e183abbbd2e..6b3519db8085 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -18269,7 +18269,7 @@ TI DAVINCI SERIES GPIO DRIVER
>  M:	Keerthy <j-keerthy@ti.com>
>  L:	linux-gpio@vger.kernel.org
>  S:	Maintained
> -F:	Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> +F:	Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
>  F:	drivers/gpio/gpio-davinci.c
>  
>  TI DAVINCI SERIES MEDIA DRIVER
> -- 
> 2.17.1
> 

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

* Re: [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema
  2021-05-17 22:15 ` Rob Herring
@ 2021-05-18 14:13   ` Aswath Govindraju
  2021-05-20 16:41     ` Rob Herring
  2021-05-21  8:31   ` Grygorii Strashko
  1 sibling, 1 reply; 10+ messages in thread
From: Aswath Govindraju @ 2021-05-18 14:13 UTC (permalink / raw)
  To: Rob Herring
  Cc: Vignesh Raghavendra, Lokesh Vutla, Grygorii Strashko,
	Kishon Vijay Abraham I, Linus Walleij, Bartosz Golaszewski,
	Keerthy, linux-gpio, devicetree, linux-kernel


Hi Rob,

On 18/05/21 3:45 am, Rob Herring wrote:
> On Tue, May 11, 2021 at 02:31:20PM +0530, Aswath Govindraju wrote:
>> Convert gpio-davinci dt-binding documentation from txt to yaml format.
>>
>> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
>> ---
>>  .../devicetree/bindings/gpio/gpio-davinci.txt | 167 ---------------
>>  .../bindings/gpio/gpio-davinci.yaml           | 193 ++++++++++++++++++
>>  MAINTAINERS                                   |   2 +-
>>  3 files changed, 194 insertions(+), 168 deletions(-)
>>  delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
>>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
>>

[...]

>> +properties:
>> +  compatible:
>> +    oneOf:
>> +      - items:
>> +          - enum:
>> +              - ti,k2g-gpio
>> +              - ti,am654-gpio
>> +              - ti,j721e-gpio
>> +              - ti,am64-gpio
>> +          - const: ti,keystone-gpio
>> +
>> +      - items:
>> +          - const: ti,dm6441-gpio
>> +      - items:
>> +          - const: ti,keystone-gpio
> 
> These 2 can be expressed as an 'enum'.

I will change this.

> 
>> +
>> +  reg:
>> +    maxItems: 1
>> +    description:
>> +      Physical base address of the controller and the size of memory mapped registers.
> 
> Drop. That's every 'reg' property.
> 

I'll drop this.

>> +
>> +  gpio-controller: true
>> +
>> +  gpio-ranges: true
>> +
>> +  gpio-line-names:
>> +    description: strings describing the names of each gpio line.
> 
> Any constraints like min/max number of lines? 
> 

The max number of lines will be equal to ti,ngpio. Is there any way to
equate maxItems to the a property value in json schema ?

>> +
>> +  "#gpio-cells":
>> +    const: 2
>> +    description:
>> +      first cell is the pin number and second cell is used to specify optional parameters (unused).
>> +
>> +  interrupts:
>> +    description:
>> +      Array of GPIO interrupt number. Only banked or unbanked IRQs are supported at a time.
> 
> Needs constraints. How many items and what are they?

Here also the maximum number of interrupts is equal to ti,ngpio in
unbanked interrupts case. Same as above is there anyway to equate
maxItems to ti,ngpio property in json schma ? If not, then what would be
the best way to handle this ?

> 
>> +
>> +  ti,ngpio:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    description: The number of GPIO pins supported consecutively.
>> +    minimum: 1
>> +
>> +  ti,davinci-gpio-unbanked:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    description: The number of GPIOs that have an individual interrupt line to processor.
>> +    minimum: 0
>> +
>> +  clocks:
>> +    maxItems: 1
>> +    description:
>> +      clock-specifier to represent input to the GPIO controller.
> 
> Drop description.
> 

Will drop this.

>> +
>> +  clock-names:
>> +    const: gpio
>> +
>> +  interrupt-controller: true
>> +
>> +  power-domains:
>> +    maxItems: 1
>> +    description:
>> +      Phandle to the power domain provider node.
> 
> Drop

Will drop this.
.
> 
>> +
>> +  "#interrupt-cells":
>> +    const: 2
>> +
>> +patternProperties:
>> +  "-hog$":
>> +    type: object
>> +    properties:
>> +      gpios: true
>> +      gpio-hog: true
>> +      input: true
>> +      output-high: true
>> +      output-low: true
>> +      line-name: true
>> +
>> +    required:
>> +      - gpio-hog
>> +      - gpios
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - gpio-controller
>> +  - "#gpio-cells"
>> +  - interrupts
>> +  - ti,ngpio
>> +  - ti,davinci-gpio-unbanked
>> +  - clocks
>> +  - clock-names
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> +  - |
>> +    #include<dt-bindings/interrupt-controller/arm-gic.h>
>> +
>> +    gpio0: gpio@2603000 {
>> +      compatible = "ti,k2g-gpio", "ti,keystone-gpio";
>> +      reg = <0x02603000 0x100>;
>> +      gpio-controller;
>> +      #gpio-cells = <2>;
>> +      interrupts = <GIC_SPI 432 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 433 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 434 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 435 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 436 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 437 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 438 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 439 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 440 IRQ_TYPE_EDGE_RISING>;
>> +      interrupt-controller;
>> +      #interrupt-cells = <2>;
>> +      ti,ngpio = <144>;
>> +      ti,davinci-gpio-unbanked = <0>;
>> +      clocks = <&k2g_clks 0x001b 0x0>;
>> +      clock-names = "gpio";
>> +    };
>> +
>> +  - |
>> +    #include<dt-bindings/interrupt-controller/arm-gic.h>
>> +
>> +    gpio1: gpio@260bf00 {
>> +      compatible = "ti,keystone-gpio";
>> +      reg = <0x0260bf00 0x100>;
>> +      gpio-controller;
>> +      #gpio-cells = <2>;
>> +      /* HW Interrupts mapped to GPIO pins */
>> +      interrupts = <GIC_SPI 120 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 121 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 122 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 123 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 124 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 125 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 126 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 127 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 128 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 129 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 130 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 131 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 132 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 133 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 134 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 135 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 136 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 137 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 138 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 139 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 140 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 141 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 142 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 143 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 144 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 145 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 146 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 147 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 148 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 149 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 150 IRQ_TYPE_EDGE_RISING>,
>> +                   <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
>> +      clocks = <&clkgpio>;
>> +      clock-names = "gpio";
>> +      ti,ngpio = <32>;
>> +      ti,davinci-gpio-unbanked = <32>;
>> +    };
>> +
>> +  - |
>> +    wkup_gpio0: wkup_gpio0@42110000 {
> 
> gpio@...
> 

will change this in respin

Thanks,
Aswath

>> +      compatible = "ti,am654-gpio", "ti,keystone-gpio";
>> +      reg = <0x42110000 0x100>;
>> +      gpio-controller;
>> +      #gpio-cells = <2>;
>> +      interrupt-parent = <&intr_wkup_gpio>;
>> +      interrupts = <60>, <61>, <62>, <63>;
>> +      interrupt-controller;
>> +      #interrupt-cells = <2>;
>> +      ti,ngpio = <56>;
>> +      ti,davinci-gpio-unbanked = <0>;
>> +      clocks = <&k3_clks 59 0>;
>> +      clock-names = "gpio";
>> +    };
>> +
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 6e183abbbd2e..6b3519db8085 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -18269,7 +18269,7 @@ TI DAVINCI SERIES GPIO DRIVER
>>  M:	Keerthy <j-keerthy@ti.com>
>>  L:	linux-gpio@vger.kernel.org
>>  S:	Maintained
>> -F:	Documentation/devicetree/bindings/gpio/gpio-davinci.txt
>> +F:	Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
>>  F:	drivers/gpio/gpio-davinci.c
>>  
>>  TI DAVINCI SERIES MEDIA DRIVER
>> -- 
>> 2.17.1
>>


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

* Re: [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema
  2021-05-18 14:13   ` Aswath Govindraju
@ 2021-05-20 16:41     ` Rob Herring
  2021-05-20 17:04       ` Aswath Govindraju
  0 siblings, 1 reply; 10+ messages in thread
From: Rob Herring @ 2021-05-20 16:41 UTC (permalink / raw)
  To: Aswath Govindraju
  Cc: Vignesh Raghavendra, Lokesh Vutla, Grygorii Strashko,
	Kishon Vijay Abraham I, Linus Walleij, Bartosz Golaszewski,
	Keerthy, open list:GPIO SUBSYSTEM, devicetree, linux-kernel

On Tue, May 18, 2021 at 9:13 AM Aswath Govindraju <a-govindraju@ti.com> wrote:
>
>
> Hi Rob,
>
> On 18/05/21 3:45 am, Rob Herring wrote:
> > On Tue, May 11, 2021 at 02:31:20PM +0530, Aswath Govindraju wrote:
> >> Convert gpio-davinci dt-binding documentation from txt to yaml format.
> >>
> >> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
> >> ---
> >>  .../devicetree/bindings/gpio/gpio-davinci.txt | 167 ---------------
> >>  .../bindings/gpio/gpio-davinci.yaml           | 193 ++++++++++++++++++
> >>  MAINTAINERS                                   |   2 +-
> >>  3 files changed, 194 insertions(+), 168 deletions(-)
> >>  delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> >>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
> >>
>
> [...]
>
> >> +properties:
> >> +  compatible:
> >> +    oneOf:
> >> +      - items:
> >> +          - enum:
> >> +              - ti,k2g-gpio
> >> +              - ti,am654-gpio
> >> +              - ti,j721e-gpio
> >> +              - ti,am64-gpio
> >> +          - const: ti,keystone-gpio
> >> +
> >> +      - items:
> >> +          - const: ti,dm6441-gpio
> >> +      - items:
> >> +          - const: ti,keystone-gpio
> >
> > These 2 can be expressed as an 'enum'.
>
> I will change this.
>
> >
> >> +
> >> +  reg:
> >> +    maxItems: 1
> >> +    description:
> >> +      Physical base address of the controller and the size of memory mapped registers.
> >
> > Drop. That's every 'reg' property.
> >
>
> I'll drop this.
>
> >> +
> >> +  gpio-controller: true
> >> +
> >> +  gpio-ranges: true
> >> +
> >> +  gpio-line-names:
> >> +    description: strings describing the names of each gpio line.
> >
> > Any constraints like min/max number of lines?
> >
>
> The max number of lines will be equal to ti,ngpio. Is there any way to
> equate maxItems to the a property value in json schema ?

There have been discussions about something like that for json-schema,
but nothing yet AFAIK. Is there a max for ti,ngpio? Nothing means
2^32. Surely there's something less than that. You can always adjust
the max later.

> >> +
> >> +  "#gpio-cells":
> >> +    const: 2
> >> +    description:
> >> +      first cell is the pin number and second cell is used to specify optional parameters (unused).
> >> +
> >> +  interrupts:
> >> +    description:
> >> +      Array of GPIO interrupt number. Only banked or unbanked IRQs are supported at a time.
> >
> > Needs constraints. How many items and what are they?
>
> Here also the maximum number of interrupts is equal to ti,ngpio in
> unbanked interrupts case. Same as above is there anyway to equate
> maxItems to ti,ngpio property in json schma ? If not, then what would be
> the best way to handle this ?

Banked means 1 combined interrupt?

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

* Re: [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema
  2021-05-20 16:41     ` Rob Herring
@ 2021-05-20 17:04       ` Aswath Govindraju
  0 siblings, 0 replies; 10+ messages in thread
From: Aswath Govindraju @ 2021-05-20 17:04 UTC (permalink / raw)
  To: Rob Herring
  Cc: Vignesh Raghavendra, Lokesh Vutla, Grygorii Strashko,
	Kishon Vijay Abraham I, Linus Walleij, Bartosz Golaszewski,
	Keerthy, open list:GPIO SUBSYSTEM, devicetree, linux-kernel

Hi Rob,

On 20/05/21 10:11 pm, Rob Herring wrote:
> On Tue, May 18, 2021 at 9:13 AM Aswath Govindraju <a-govindraju@ti.com> wrote:
>>
>>
>> Hi Rob,
>>
>> On 18/05/21 3:45 am, Rob Herring wrote:
>>> On Tue, May 11, 2021 at 02:31:20PM +0530, Aswath Govindraju wrote:
>>>> Convert gpio-davinci dt-binding documentation from txt to yaml format.
>>>>
>>>> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
>>>> ---
>>>>  .../devicetree/bindings/gpio/gpio-davinci.txt | 167 ---------------
>>>>  .../bindings/gpio/gpio-davinci.yaml           | 193 ++++++++++++++++++
>>>>  MAINTAINERS                                   |   2 +-
>>>>  3 files changed, 194 insertions(+), 168 deletions(-)
>>>>  delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
>>>>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
>>>>
>>
>> [...]
>>
>>>> +properties:
>>>> +  compatible:
>>>> +    oneOf:
>>>> +      - items:
>>>> +          - enum:
>>>> +              - ti,k2g-gpio
>>>> +              - ti,am654-gpio
>>>> +              - ti,j721e-gpio
>>>> +              - ti,am64-gpio
>>>> +          - const: ti,keystone-gpio
>>>> +
>>>> +      - items:
>>>> +          - const: ti,dm6441-gpio
>>>> +      - items:
>>>> +          - const: ti,keystone-gpio
>>>
>>> These 2 can be expressed as an 'enum'.
>>
>> I will change this.
>>
>>>
>>>> +
>>>> +  reg:
>>>> +    maxItems: 1
>>>> +    description:
>>>> +      Physical base address of the controller and the size of memory mapped registers.
>>>
>>> Drop. That's every 'reg' property.
>>>
>>
>> I'll drop this.
>>
>>>> +
>>>> +  gpio-controller: true
>>>> +
>>>> +  gpio-ranges: true
>>>> +
>>>> +  gpio-line-names:
>>>> +    description: strings describing the names of each gpio line.
>>>
>>> Any constraints like min/max number of lines?
>>>
>>
>> The max number of lines will be equal to ti,ngpio. Is there any way to
>> equate maxItems to the a property value in json schema ?
> 
> There have been discussions about something like that for json-schema,
> but nothing yet AFAIK. Is there a max for ti,ngpio? Nothing means
> 2^32. Surely there's something less than that. You can always adjust
> the max later.

Thank you. I will put an cap on this number based on the existing device
trees.

> 
>>>> +
>>>> +  "#gpio-cells":
>>>> +    const: 2
>>>> +    description:
>>>> +      first cell is the pin number and second cell is used to specify optional parameters (unused).
>>>> +
>>>> +  interrupts:
>>>> +    description:
>>>> +      Array of GPIO interrupt number. Only banked or unbanked IRQs are supported at a time.
>>>
>>> Needs constraints. How many items and what are they?
>>
>> Here also the maximum number of interrupts is equal to ti,ngpio in
>> unbanked interrupts case. Same as above is there anyway to equate
>> maxItems to ti,ngpio property in json schma ? If not, then what would be
>> the best way to handle this ?
> 
> Banked means 1 combined interrupt?
> 
Yes, one combined interrupt per bank and there can be multiple banks per
gpio instance.

Thanks,
Aswath

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

* Re: [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema
  2021-05-17 22:15 ` Rob Herring
  2021-05-18 14:13   ` Aswath Govindraju
@ 2021-05-21  8:31   ` Grygorii Strashko
  2021-05-21 12:56     ` Rob Herring
  1 sibling, 1 reply; 10+ messages in thread
From: Grygorii Strashko @ 2021-05-21  8:31 UTC (permalink / raw)
  To: Rob Herring, Aswath Govindraju
  Cc: Vignesh Raghavendra, Lokesh Vutla, Kishon Vijay Abraham I,
	Linus Walleij, Bartosz Golaszewski, Keerthy, linux-gpio,
	devicetree, linux-kernel

Hi Rob, All

On 18/05/2021 01:15, Rob Herring wrote:
> On Tue, May 11, 2021 at 02:31:20PM +0530, Aswath Govindraju wrote:
>> Convert gpio-davinci dt-binding documentation from txt to yaml format.
>>
>> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
>> ---
>>   .../devicetree/bindings/gpio/gpio-davinci.txt | 167 ---------------
>>   .../bindings/gpio/gpio-davinci.yaml           | 193 ++++++++++++++++++
>>   MAINTAINERS                                   |   2 +-
>>   3 files changed, 194 insertions(+), 168 deletions(-)
>>   delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
>>   create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
>> deleted file mode 100644
>> index 696ea46227d1..000000000000
>> --- a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
>> +++ /dev/null
>> @@ -1,167 +0,0 @@
>> -Davinci/Keystone GPIO controller bindings
>> -
>> -Required Properties:
>> -- compatible: should be "ti,dm6441-gpio": for Davinci da850 SoCs
>> -			"ti,keystone-gpio": for Keystone 2 66AK2H/K, 66AK2L,
>> -						66AK2E SoCs
>> -			"ti,k2g-gpio", "ti,keystone-gpio": for 66AK2G
>> -			"ti,am654-gpio", "ti,keystone-gpio": for TI K3 AM654
>> -			"ti,j721e-gpio", "ti,keystone-gpio": for J721E SoCs
>> -			"ti,am64-gpio", "ti,keystone-gpio": for AM64 SoCs
>> -

[...]

>> -};
>> diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml b/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
>> new file mode 100644
>> index 000000000000..1e16172669c7
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
>> @@ -0,0 +1,193 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/gpio/gpio-davinci.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: GPIO controller for Davinci and keystone devices
>> +
>> +maintainers:
>> +  - Keerthy <j-keerthy@ti.com>
>> +
>> +properties:
>> +  compatible:
>> +    oneOf:
>> +      - items:
>> +          - enum:
>> +              - ti,k2g-gpio
>> +              - ti,am654-gpio
>> +              - ti,j721e-gpio
>> +              - ti,am64-gpio
>> +          - const: ti,keystone-gpio
>> +
>> +      - items:
>> +          - const: ti,dm6441-gpio
>> +      - items:
>> +          - const: ti,keystone-gpio
> 
> These 2 can be expressed as an 'enum'.
> 
>> +
>> +  reg:
>> +    maxItems: 1
>> +    description:
>> +      Physical base address of the controller and the size of memory mapped registers.
> 
> Drop. That's every 'reg' property.
> 
>> +
>> +  gpio-controller: true
>> +
>> +  gpio-ranges: true
>> +
>> +  gpio-line-names:
>> +    description: strings describing the names of each gpio line.
> 
> Any constraints like min/max number of lines?
> 
>> +
>> +  "#gpio-cells":
>> +    const: 2
>> +    description:
>> +      first cell is the pin number and second cell is used to specify optional parameters (unused).
>> +
>> +  interrupts:
>> +    description:
>> +      Array of GPIO interrupt number. Only banked or unbanked IRQs are supported at a time.
> 
> Needs constraints. How many items and what are they?
> 
>> +
>> +  ti,ngpio:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    description: The number of GPIO pins supported consecutively.
>> +    minimum: 1
>> +
>> +  ti,davinci-gpio-unbanked:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    description: The number of GPIOs that have an individual interrupt line to processor.
>> +    minimum: 0
>> +
>> +  clocks:
>> +    maxItems: 1
>> +    description:
>> +      clock-specifier to represent input to the GPIO controller.
> 
> Drop description.
> 
>> +
>> +  clock-names:
>> +    const: gpio
>> +
>> +  interrupt-controller: true
>> +
>> +  power-domains:
>> +    maxItems: 1
>> +    description:
>> +      Phandle to the power domain provider node.
> 
> Drop.
> 
>> +
>> +  "#interrupt-cells":
>> +    const: 2
>> +
>> +patternProperties:
>> +  "-hog$":
>> +    type: object
>> +    properties:
>> +      gpios: true
>> +      gpio-hog: true
>> +      input: true
>> +      output-high: true
>> +      output-low: true
>> +      line-name: true
>> +
>> +    required:
>> +      - gpio-hog
>> +      - gpios

I see that gpio-hog.yaml dtschema has been added.
Can it be reused here and how?


>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - gpio-controller
>> +  - "#gpio-cells"
>> +  - interrupts
>> +  - ti,ngpio
>> +  - ti,davinci-gpio-unbanked
>> +  - clocks
>> +  - clock-names
>> +
>> +additionalProperties: false
>> +

[...]

-- 
Best regards,
grygorii

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

* Re: [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema
  2021-05-21  8:31   ` Grygorii Strashko
@ 2021-05-21 12:56     ` Rob Herring
  2021-05-21 16:06       ` Grygorii Strashko
  0 siblings, 1 reply; 10+ messages in thread
From: Rob Herring @ 2021-05-21 12:56 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: Aswath Govindraju, Vignesh Raghavendra, Lokesh Vutla,
	Kishon Vijay Abraham I, Linus Walleij, Bartosz Golaszewski,
	Keerthy, open list:GPIO SUBSYSTEM, devicetree, linux-kernel

On Fri, May 21, 2021 at 3:32 AM Grygorii Strashko
<grygorii.strashko@ti.com> wrote:
>
> Hi Rob, All
>
> On 18/05/2021 01:15, Rob Herring wrote:
> > On Tue, May 11, 2021 at 02:31:20PM +0530, Aswath Govindraju wrote:
> >> Convert gpio-davinci dt-binding documentation from txt to yaml format.
> >>
> >> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
> >> ---
> >>   .../devicetree/bindings/gpio/gpio-davinci.txt | 167 ---------------
> >>   .../bindings/gpio/gpio-davinci.yaml           | 193 ++++++++++++++++++
> >>   MAINTAINERS                                   |   2 +-
> >>   3 files changed, 194 insertions(+), 168 deletions(-)
> >>   delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> >>   create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
> >>
> >> diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> >> deleted file mode 100644
> >> index 696ea46227d1..000000000000
> >> --- a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> >> +++ /dev/null
> >> @@ -1,167 +0,0 @@
> >> -Davinci/Keystone GPIO controller bindings
> >> -
> >> -Required Properties:
> >> -- compatible: should be "ti,dm6441-gpio": for Davinci da850 SoCs
> >> -                    "ti,keystone-gpio": for Keystone 2 66AK2H/K, 66AK2L,
> >> -                                            66AK2E SoCs
> >> -                    "ti,k2g-gpio", "ti,keystone-gpio": for 66AK2G
> >> -                    "ti,am654-gpio", "ti,keystone-gpio": for TI K3 AM654
> >> -                    "ti,j721e-gpio", "ti,keystone-gpio": for J721E SoCs
> >> -                    "ti,am64-gpio", "ti,keystone-gpio": for AM64 SoCs
> >> -
>
> [...]
>
> >> -};
> >> diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml b/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
> >> new file mode 100644
> >> index 000000000000..1e16172669c7
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
> >> @@ -0,0 +1,193 @@
> >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >> +%YAML 1.2
> >> +---
> >> +$id: http://devicetree.org/schemas/gpio/gpio-davinci.yaml#
> >> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> >> +
> >> +title: GPIO controller for Davinci and keystone devices
> >> +
> >> +maintainers:
> >> +  - Keerthy <j-keerthy@ti.com>
> >> +
> >> +properties:
> >> +  compatible:
> >> +    oneOf:
> >> +      - items:
> >> +          - enum:
> >> +              - ti,k2g-gpio
> >> +              - ti,am654-gpio
> >> +              - ti,j721e-gpio
> >> +              - ti,am64-gpio
> >> +          - const: ti,keystone-gpio
> >> +
> >> +      - items:
> >> +          - const: ti,dm6441-gpio
> >> +      - items:
> >> +          - const: ti,keystone-gpio
> >
> > These 2 can be expressed as an 'enum'.
> >
> >> +
> >> +  reg:
> >> +    maxItems: 1
> >> +    description:
> >> +      Physical base address of the controller and the size of memory mapped registers.
> >
> > Drop. That's every 'reg' property.
> >
> >> +
> >> +  gpio-controller: true
> >> +
> >> +  gpio-ranges: true
> >> +
> >> +  gpio-line-names:
> >> +    description: strings describing the names of each gpio line.
> >
> > Any constraints like min/max number of lines?
> >
> >> +
> >> +  "#gpio-cells":
> >> +    const: 2
> >> +    description:
> >> +      first cell is the pin number and second cell is used to specify optional parameters (unused).
> >> +
> >> +  interrupts:
> >> +    description:
> >> +      Array of GPIO interrupt number. Only banked or unbanked IRQs are supported at a time.
> >
> > Needs constraints. How many items and what are they?
> >
> >> +
> >> +  ti,ngpio:
> >> +    $ref: /schemas/types.yaml#/definitions/uint32
> >> +    description: The number of GPIO pins supported consecutively.
> >> +    minimum: 1
> >> +
> >> +  ti,davinci-gpio-unbanked:
> >> +    $ref: /schemas/types.yaml#/definitions/uint32
> >> +    description: The number of GPIOs that have an individual interrupt line to processor.
> >> +    minimum: 0
> >> +
> >> +  clocks:
> >> +    maxItems: 1
> >> +    description:
> >> +      clock-specifier to represent input to the GPIO controller.
> >
> > Drop description.
> >
> >> +
> >> +  clock-names:
> >> +    const: gpio
> >> +
> >> +  interrupt-controller: true
> >> +
> >> +  power-domains:
> >> +    maxItems: 1
> >> +    description:
> >> +      Phandle to the power domain provider node.
> >
> > Drop.
> >
> >> +
> >> +  "#interrupt-cells":
> >> +    const: 2
> >> +
> >> +patternProperties:
> >> +  "-hog$":
> >> +    type: object
> >> +    properties:
> >> +      gpios: true
> >> +      gpio-hog: true
> >> +      input: true
> >> +      output-high: true
> >> +      output-low: true
> >> +      line-name: true
> >> +
> >> +    required:
> >> +      - gpio-hog
> >> +      - gpios
>
> I see that gpio-hog.yaml dtschema has been added.
> Can it be reused here and how?

It's applied to any node containing 'gpio-hog' property, so all you need is:

required:
  - gpio-hog

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

* Re: [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema
  2021-05-21 12:56     ` Rob Herring
@ 2021-05-21 16:06       ` Grygorii Strashko
  2021-05-21 16:30         ` Rob Herring
  0 siblings, 1 reply; 10+ messages in thread
From: Grygorii Strashko @ 2021-05-21 16:06 UTC (permalink / raw)
  To: Rob Herring
  Cc: Aswath Govindraju, Vignesh Raghavendra, Lokesh Vutla,
	Kishon Vijay Abraham I, Linus Walleij, Bartosz Golaszewski,
	Keerthy, open list:GPIO SUBSYSTEM, devicetree, linux-kernel

Hi Rob,

On 21/05/2021 15:56, Rob Herring wrote:
> On Fri, May 21, 2021 at 3:32 AM Grygorii Strashko
> <grygorii.strashko@ti.com> wrote:
>>
>> Hi Rob, All
>>
>> On 18/05/2021 01:15, Rob Herring wrote:
>>> On Tue, May 11, 2021 at 02:31:20PM +0530, Aswath Govindraju wrote:
>>>> Convert gpio-davinci dt-binding documentation from txt to yaml format.
>>>>
>>>> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
>>>> ---
>>>>    .../devicetree/bindings/gpio/gpio-davinci.txt | 167 ---------------
>>>>    .../bindings/gpio/gpio-davinci.yaml           | 193 ++++++++++++++++++
>>>>    MAINTAINERS                                   |   2 +-
>>>>    3 files changed, 194 insertions(+), 168 deletions(-)
>>>>    delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
>>>>    create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
>>>> deleted file mode 100644
>>>> index 696ea46227d1..000000000000
>>>> --- a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
>>>> +++ /dev/null
>>>> @@ -1,167 +0,0 @@
>>>> -Davinci/Keystone GPIO controller bindings
>>>> -
>>>> -Required Properties:
>>>> -- compatible: should be "ti,dm6441-gpio": for Davinci da850 SoCs
>>>> -                    "ti,keystone-gpio": for Keystone 2 66AK2H/K, 66AK2L,
>>>> -                                            66AK2E SoCs
>>>> -                    "ti,k2g-gpio", "ti,keystone-gpio": for 66AK2G
>>>> -                    "ti,am654-gpio", "ti,keystone-gpio": for TI K3 AM654
>>>> -                    "ti,j721e-gpio", "ti,keystone-gpio": for J721E SoCs
>>>> -                    "ti,am64-gpio", "ti,keystone-gpio": for AM64 SoCs
>>>> -
>>
>> [...]
>>
>>>> -};
>>>> diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml b/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
>>>> new file mode 100644
>>>> index 000000000000..1e16172669c7
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
>>>> @@ -0,0 +1,193 @@
>>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>>> +%YAML 1.2
>>>> +---
>>>> +$id: http://devicetree.org/schemas/gpio/gpio-davinci.yaml#
>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>> +
>>>> +title: GPIO controller for Davinci and keystone devices
>>>> +
>>>> +maintainers:
>>>> +  - Keerthy <j-keerthy@ti.com>
>>>> +
>>>> +properties:
>>>> +  compatible:
>>>> +    oneOf:
>>>> +      - items:
>>>> +          - enum:
>>>> +              - ti,k2g-gpio
>>>> +              - ti,am654-gpio
>>>> +              - ti,j721e-gpio
>>>> +              - ti,am64-gpio
>>>> +          - const: ti,keystone-gpio
>>>> +
>>>> +      - items:
>>>> +          - const: ti,dm6441-gpio
>>>> +      - items:
>>>> +          - const: ti,keystone-gpio
>>>
>>> These 2 can be expressed as an 'enum'.
>>>
>>>> +
>>>> +  reg:
>>>> +    maxItems: 1
>>>> +    description:
>>>> +      Physical base address of the controller and the size of memory mapped registers.
>>>
>>> Drop. That's every 'reg' property.
>>>
>>>> +
>>>> +  gpio-controller: true
>>>> +
>>>> +  gpio-ranges: true
>>>> +
>>>> +  gpio-line-names:
>>>> +    description: strings describing the names of each gpio line.
>>>
>>> Any constraints like min/max number of lines?
>>>
>>>> +
>>>> +  "#gpio-cells":
>>>> +    const: 2
>>>> +    description:
>>>> +      first cell is the pin number and second cell is used to specify optional parameters (unused).
>>>> +
>>>> +  interrupts:
>>>> +    description:
>>>> +      Array of GPIO interrupt number. Only banked or unbanked IRQs are supported at a time.
>>>
>>> Needs constraints. How many items and what are they?
>>>
>>>> +
>>>> +  ti,ngpio:
>>>> +    $ref: /schemas/types.yaml#/definitions/uint32
>>>> +    description: The number of GPIO pins supported consecutively.
>>>> +    minimum: 1
>>>> +
>>>> +  ti,davinci-gpio-unbanked:
>>>> +    $ref: /schemas/types.yaml#/definitions/uint32
>>>> +    description: The number of GPIOs that have an individual interrupt line to processor.
>>>> +    minimum: 0
>>>> +
>>>> +  clocks:
>>>> +    maxItems: 1
>>>> +    description:
>>>> +      clock-specifier to represent input to the GPIO controller.
>>>
>>> Drop description.
>>>
>>>> +
>>>> +  clock-names:
>>>> +    const: gpio
>>>> +
>>>> +  interrupt-controller: true
>>>> +
>>>> +  power-domains:
>>>> +    maxItems: 1
>>>> +    description:
>>>> +      Phandle to the power domain provider node.
>>>
>>> Drop.
>>>
>>>> +
>>>> +  "#interrupt-cells":
>>>> +    const: 2
>>>> +
>>>> +patternProperties:
>>>> +  "-hog$":
>>>> +    type: object
>>>> +    properties:
>>>> +      gpios: true
>>>> +      gpio-hog: true
>>>> +      input: true
>>>> +      output-high: true
>>>> +      output-low: true
>>>> +      line-name: true
>>>> +
>>>> +    required:
>>>> +      - gpio-hog
>>>> +      - gpios
>>
>> I see that gpio-hog.yaml dtschema has been added.
>> Can it be reused here and how?
> 
> It's applied to any node containing 'gpio-hog' property, so all you need is:
> 
> required:
>    - gpio-hog
> 
Thanks for you comments. But I'd like to clarify the Hog child node definition - will work as below?

patternProperties:
   "^(hog-[0-9]+|.+-hog(-[0-9]+)?)$":
     type: object

     properties:
       gpio-hog: true

     required:
       - gpio-hog

In general, patternProperties duplicates $nodename in gpio-hog dtschema.

-- 
Best regards,
grygorii

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

* Re: [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema
  2021-05-21 16:06       ` Grygorii Strashko
@ 2021-05-21 16:30         ` Rob Herring
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2021-05-21 16:30 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: Aswath Govindraju, Vignesh Raghavendra, Lokesh Vutla,
	Kishon Vijay Abraham I, Linus Walleij, Bartosz Golaszewski,
	Keerthy, open list:GPIO SUBSYSTEM, devicetree, linux-kernel

On Fri, May 21, 2021 at 11:06 AM Grygorii Strashko
<grygorii.strashko@ti.com> wrote:
>
> Hi Rob,
>
> On 21/05/2021 15:56, Rob Herring wrote:
> > On Fri, May 21, 2021 at 3:32 AM Grygorii Strashko
> > <grygorii.strashko@ti.com> wrote:
> >>
> >> Hi Rob, All
> >>
> >> On 18/05/2021 01:15, Rob Herring wrote:
> >>> On Tue, May 11, 2021 at 02:31:20PM +0530, Aswath Govindraju wrote:
> >>>> Convert gpio-davinci dt-binding documentation from txt to yaml format.
> >>>>
> >>>> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
> >>>> ---
> >>>>    .../devicetree/bindings/gpio/gpio-davinci.txt | 167 ---------------
> >>>>    .../bindings/gpio/gpio-davinci.yaml           | 193 ++++++++++++++++++
> >>>>    MAINTAINERS                                   |   2 +-
> >>>>    3 files changed, 194 insertions(+), 168 deletions(-)
> >>>>    delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> >>>>    create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
> >>>>
> >>>> diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> >>>> deleted file mode 100644
> >>>> index 696ea46227d1..000000000000
> >>>> --- a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> >>>> +++ /dev/null
> >>>> @@ -1,167 +0,0 @@
> >>>> -Davinci/Keystone GPIO controller bindings
> >>>> -
> >>>> -Required Properties:
> >>>> -- compatible: should be "ti,dm6441-gpio": for Davinci da850 SoCs
> >>>> -                    "ti,keystone-gpio": for Keystone 2 66AK2H/K, 66AK2L,
> >>>> -                                            66AK2E SoCs
> >>>> -                    "ti,k2g-gpio", "ti,keystone-gpio": for 66AK2G
> >>>> -                    "ti,am654-gpio", "ti,keystone-gpio": for TI K3 AM654
> >>>> -                    "ti,j721e-gpio", "ti,keystone-gpio": for J721E SoCs
> >>>> -                    "ti,am64-gpio", "ti,keystone-gpio": for AM64 SoCs
> >>>> -
> >>
> >> [...]
> >>
> >>>> -};
> >>>> diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml b/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
> >>>> new file mode 100644
> >>>> index 000000000000..1e16172669c7
> >>>> --- /dev/null
> >>>> +++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
> >>>> @@ -0,0 +1,193 @@
> >>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >>>> +%YAML 1.2
> >>>> +---
> >>>> +$id: http://devicetree.org/schemas/gpio/gpio-davinci.yaml#
> >>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> >>>> +
> >>>> +title: GPIO controller for Davinci and keystone devices
> >>>> +
> >>>> +maintainers:
> >>>> +  - Keerthy <j-keerthy@ti.com>
> >>>> +
> >>>> +properties:
> >>>> +  compatible:
> >>>> +    oneOf:
> >>>> +      - items:
> >>>> +          - enum:
> >>>> +              - ti,k2g-gpio
> >>>> +              - ti,am654-gpio
> >>>> +              - ti,j721e-gpio
> >>>> +              - ti,am64-gpio
> >>>> +          - const: ti,keystone-gpio
> >>>> +
> >>>> +      - items:
> >>>> +          - const: ti,dm6441-gpio
> >>>> +      - items:
> >>>> +          - const: ti,keystone-gpio
> >>>
> >>> These 2 can be expressed as an 'enum'.
> >>>
> >>>> +
> >>>> +  reg:
> >>>> +    maxItems: 1
> >>>> +    description:
> >>>> +      Physical base address of the controller and the size of memory mapped registers.
> >>>
> >>> Drop. That's every 'reg' property.
> >>>
> >>>> +
> >>>> +  gpio-controller: true
> >>>> +
> >>>> +  gpio-ranges: true
> >>>> +
> >>>> +  gpio-line-names:
> >>>> +    description: strings describing the names of each gpio line.
> >>>
> >>> Any constraints like min/max number of lines?
> >>>
> >>>> +
> >>>> +  "#gpio-cells":
> >>>> +    const: 2
> >>>> +    description:
> >>>> +      first cell is the pin number and second cell is used to specify optional parameters (unused).
> >>>> +
> >>>> +  interrupts:
> >>>> +    description:
> >>>> +      Array of GPIO interrupt number. Only banked or unbanked IRQs are supported at a time.
> >>>
> >>> Needs constraints. How many items and what are they?
> >>>
> >>>> +
> >>>> +  ti,ngpio:
> >>>> +    $ref: /schemas/types.yaml#/definitions/uint32
> >>>> +    description: The number of GPIO pins supported consecutively.
> >>>> +    minimum: 1
> >>>> +
> >>>> +  ti,davinci-gpio-unbanked:
> >>>> +    $ref: /schemas/types.yaml#/definitions/uint32
> >>>> +    description: The number of GPIOs that have an individual interrupt line to processor.
> >>>> +    minimum: 0
> >>>> +
> >>>> +  clocks:
> >>>> +    maxItems: 1
> >>>> +    description:
> >>>> +      clock-specifier to represent input to the GPIO controller.
> >>>
> >>> Drop description.
> >>>
> >>>> +
> >>>> +  clock-names:
> >>>> +    const: gpio
> >>>> +
> >>>> +  interrupt-controller: true
> >>>> +
> >>>> +  power-domains:
> >>>> +    maxItems: 1
> >>>> +    description:
> >>>> +      Phandle to the power domain provider node.
> >>>
> >>> Drop.
> >>>
> >>>> +
> >>>> +  "#interrupt-cells":
> >>>> +    const: 2
> >>>> +
> >>>> +patternProperties:
> >>>> +  "-hog$":
> >>>> +    type: object
> >>>> +    properties:
> >>>> +      gpios: true
> >>>> +      gpio-hog: true
> >>>> +      input: true
> >>>> +      output-high: true
> >>>> +      output-low: true
> >>>> +      line-name: true
> >>>> +
> >>>> +    required:
> >>>> +      - gpio-hog
> >>>> +      - gpios
> >>
> >> I see that gpio-hog.yaml dtschema has been added.
> >> Can it be reused here and how?
> >
> > It's applied to any node containing 'gpio-hog' property, so all you need is:
> >
> > required:
> >    - gpio-hog
> >
> Thanks for you comments. But I'd like to clarify the Hog child node definition - will work as below?

Yes, but...

> patternProperties:
>    "^(hog-[0-9]+|.+-hog(-[0-9]+)?)$":
>      type: object
>
>      properties:
>        gpio-hog: true

Don't need this.

>
>      required:
>        - gpio-hog
>
> In general, patternProperties duplicates $nodename in gpio-hog dtschema.

I'd hope you could be a bit stricter here and only support one form.

Rob

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

* Re: [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema
  2021-05-11  9:01 [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema Aswath Govindraju
  2021-05-17 22:15 ` Rob Herring
@ 2021-05-27  0:17 ` Linus Walleij
  1 sibling, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2021-05-27  0:17 UTC (permalink / raw)
  To: Aswath Govindraju, Marc Zyngier
  Cc: Vignesh Raghavendra, Lokesh Vutla, Grygorii Strashko,
	Kishon Vijay Abraham I, Bartosz Golaszewski, Rob Herring,
	Keerthy, open list:GPIO SUBSYSTEM,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel

On Tue, May 11, 2021 at 11:01 AM Aswath Govindraju <a-govindraju@ti.com> wrote:

Just a drive-by comment (not your problem right now)

> +      /* HW Interrupts mapped to GPIO pins */
> +      interrupts = <GIC_SPI 120 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 121 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 122 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 123 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 124 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 125 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 126 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 127 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 128 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 129 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 130 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 131 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 132 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 133 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 134 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 135 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 136 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 137 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 138 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 139 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 140 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 141 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 142 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 143 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 144 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 145 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 146 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 147 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 148 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 149 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 150 IRQ_TYPE_EDGE_RISING>,
> +                   <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;

This is quite obviously a hiearchical interrupt controller. I think
this appeared in the kernel before the GIC could even deal with
hierarchical IRQs but it should really be fixed to make the platform
modern.

Yours,
Linus Walleij

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

end of thread, other threads:[~2021-05-27  0:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11  9:01 [PATCH] dt-bindings: gpio: gpio-davinci: Convert to json-schema Aswath Govindraju
2021-05-17 22:15 ` Rob Herring
2021-05-18 14:13   ` Aswath Govindraju
2021-05-20 16:41     ` Rob Herring
2021-05-20 17:04       ` Aswath Govindraju
2021-05-21  8:31   ` Grygorii Strashko
2021-05-21 12:56     ` Rob Herring
2021-05-21 16:06       ` Grygorii Strashko
2021-05-21 16:30         ` Rob Herring
2021-05-27  0:17 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.