diff mbox series

[32/43] dt-bindings: gpio: Add DT bindings ep93xx gpio

Message ID 20230424123522.18302-33-nikita.shubin@maquefel.me
State New
Headers show
Series ep93xx device tree conversion | expand

Commit Message

Nikita Shubin April 24, 2023, 12:34 p.m. UTC
Add YAML bindings for ep93xx SoC.

Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
---
 .../devicetree/bindings/gpio/gpio-ep93xx.yaml | 161 ++++++++++++++++++
 1 file changed, 161 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-ep93xx.yaml

Comments

Rob Herring (Arm) April 24, 2023, 4:32 p.m. UTC | #1
On Mon, Apr 24, 2023 at 03:34:48PM +0300, Nikita Shubin wrote:
> Add YAML bindings for ep93xx SoC.
> 
> Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
> ---
>  .../devicetree/bindings/gpio/gpio-ep93xx.yaml | 161 ++++++++++++++++++
>  1 file changed, 161 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-ep93xx.yaml
> 
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-ep93xx.yaml b/Documentation/devicetree/bindings/gpio/gpio-ep93xx.yaml
> new file mode 100644
> index 000000000000..4cf03c325d39
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/gpio-ep93xx.yaml
> @@ -0,0 +1,161 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/gpio/gpio-ep93xx.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: EP93xx GPIO controller
> +
> +maintainers:
> +  - Linus Walleij <linus.walleij@linaro.org>
> +  - Bartosz Golaszewski <brgl@bgdev.pl>
> +  - Nikita Shubin <nikita.shubin@maquefel.me>
> +
> +properties:
> +  compatible:
> +    const: cirrus,ep9301-gpio
> +
> +  chip-label:
> +    maxItems: 1
> +    description: human readable name.

Why do you need this? It's not standard and I don't see other GPIO 
controllers needing it.


> +
> +  reg:
> +    minItems: 2
> +    items:
> +      - description: data register
> +      - description: direction register
> +      - description: interrupt registers base
> +
> +  reg-names:
> +    minItems: 2
> +    items:
> +      - const: data
> +      - const: dir
> +      - const: intr
> +
> +  gpio-controller: true
> +
> +  gpio-ranges: true
> +
> +  "#gpio-cells":
> +    const: 2
> +
> +  interrupt-controller: true
> +
> +  "#interrupt-cells":
> +    const: 2
> +
> +  interrupts:
> +    items:
> +      - const: 27

The value of the interrupt cells depends on the parent which is outside 
the scope of this binding. Just 'maxItems: 1' is sufficient.

> +
> +  interrupts-extended:

'interrupts' covers interrupts-extended. So 'interrupts' should be:

interrupts:
  oneOf:
    - maxItems: 1
    - description: port F has dedicated irq line for each gpio line
      maxItems: 8

> +    minItems: 8
> +    maxItems: 8
> +    description: port F has dedicated irq line for each gpio line.
> +
> +required:
> +  - compatible
> +  - reg
> +  - gpio-controller
> +  - "#gpio-cells"
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +        gpio0: gpio@80840000 {
> +                compatible = "cirrus,ep9301-gpio";
> +                chip-label = "A";
> +                reg = <0x80840000 0x04>,
> +                      <0x80840010 0x04>,
> +                      <0x80840090 0x1c>;
> +                reg-names = "data", "dir", "intr";
> +                gpio-controller;
> +                #gpio-cells = <2>;
> +                interrupt-controller;
> +                interrupt-parent = <&vic1>;
> +                interrupts = <27>;
> +        };
> +
> +        gpio1: gpio@80840004 {
> +                compatible = "cirrus,ep9301-gpio";
> +                chip-label = "B";
> +                reg = <0x80840004 0x04>,
> +                      <0x80840014 0x04>,
> +                      <0x808400ac 0x1c>;
> +                reg-names = "data", "dir", "intr";
> +                gpio-controller;
> +                #gpio-cells = <2>;
> +                interrupt-controller;
> +                interrupt-parent = <&vic1>;
> +                interrupts = <27>;
> +        };
> +
> +        gpio2: gpio@80840008 {
> +                compatible = "cirrus,ep9301-gpio";
> +                chip-label = "C";
> +                reg = <0x80840008 0x04>,
> +                      <0x80840018 0x04>;
> +                reg-names = "data", "dir";
> +                gpio-controller;
> +                #gpio-cells = <2>;
> +        };
> +
> +        gpio3: gpio@8084000c {
> +                compatible = "cirrus,ep9301-gpio";
> +                chip-label = "D";
> +                reg = <0x8084000c 0x04>,
> +                      <0x8084001c 0x04>;
> +                reg-names = "data", "dir";
> +                gpio-controller;
> +                #gpio-cells = <2>;
> +        };
> +
> +        gpio4: gpio@80840020 {
> +                compatible = "cirrus,ep9301-gpio";
> +                chip-label = "E";
> +                reg = <0x80840020 0x04>,
> +                      <0x80840024 0x04>;
> +                reg-names = "data", "dir";
> +                gpio-controller;
> +                #gpio-cells = <2>;
> +        };
> +
> +        gpio5: gpio@80840030 {
> +                compatible = "cirrus,ep9301-gpio";
> +                chip-label = "F";
> +                reg = <0x80840030 0x04>,
> +                      <0x80840034 0x04>,
> +                      <0x8084004c 0x1c>;
> +                reg-names = "data", "dir", "intr";
> +                gpio-controller;
> +                #gpio-cells = <2>;
> +                interrupt-controller;
> +                interrupts-extended = <&vic0 19>, <&vic0 20>,
> +                                      <&vic0 21>, <&vic0 22>,
> +                                      <&vic1 15>, <&vic1 16>,
> +                                      <&vic1 17>, <&vic1 18>;
> +        };
> +
> +        gpio6: gpio@80840038 {
> +                compatible = "cirrus,ep9301-gpio";
> +                chip-label = "G";
> +                reg = <0x80840038 0x04>,
> +                      <0x8084003c 0x04>;
> +                reg-names = "data", "dir";
> +                gpio-controller;
> +                #gpio-cells = <2>;
> +        };
> +
> +        gpio7: gpio@80840040 {
> +                compatible = "cirrus,ep9301-gpio";
> +                chip-label = "H";
> +                reg = <0x80840040 0x04>,
> +                      <0x80840044 0x04>;
> +                reg-names = "data", "dir";
> +                gpio-controller;
> +                #gpio-cells = <2>;
> +        };
> +
> +...
> -- 
> 2.39.2
>
Linus Walleij April 26, 2023, 8:48 p.m. UTC | #2
On Mon, Apr 24, 2023 at 6:32 PM Rob Herring <robh@kernel.org> wrote:
> On Mon, Apr 24, 2023 at 03:34:48PM +0300, Nikita Shubin wrote:

> > Add YAML bindings for ep93xx SoC.
> >
> > Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
(...)
> > +  chip-label:
> > +    maxItems: 1
> > +    description: human readable name.
>
> Why do you need this? It's not standard and I don't see other GPIO
> controllers needing it.

Caught my eye too, Nikita can you live without this and just use dev_name()
or something to name the chip in Linux?

If it is to conform to EP93xx documentation naming I guess it should be
cirrus,ep93xx-gpio-chip-name = "..."; ?

Yours,
Linus Walleij
Nikita Shubin April 28, 2023, 2:44 p.m. UTC | #3
Hello Linus!

On Wed, 2023-04-26 at 22:48 +0200, Linus Walleij wrote:
> On Mon, Apr 24, 2023 at 6:32 PM Rob Herring <robh@kernel.org> wrote:
> > On Mon, Apr 24, 2023 at 03:34:48PM +0300, Nikita Shubin wrote:
> 
> > > Add YAML bindings for ep93xx SoC.
> > > 
> > > Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
> (...)
> > > +  chip-label:
> > > +    maxItems: 1
> > > +    description: human readable name.
> > 
> > Why do you need this? It's not standard and I don't see other GPIO
> > controllers needing it.
> 
> Caught my eye too, Nikita can you live without this and just use
> dev_name()
> or something to name the chip in Linux?
> 
> If it is to conform to EP93xx documentation naming I guess it should
> be
> cirrus,ep93xx-gpio-chip-name = "..."; ?

Nah, i should drop it, it was a reverence to people which are sad about
gpio index reordering.

Through i like the idea of "cirrus,ep93xx-gpio-chip-name".

> 
> Yours,
> Linus Walleij
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/gpio/gpio-ep93xx.yaml b/Documentation/devicetree/bindings/gpio/gpio-ep93xx.yaml
new file mode 100644
index 000000000000..4cf03c325d39
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-ep93xx.yaml
@@ -0,0 +1,161 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/gpio-ep93xx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: EP93xx GPIO controller
+
+maintainers:
+  - Linus Walleij <linus.walleij@linaro.org>
+  - Bartosz Golaszewski <brgl@bgdev.pl>
+  - Nikita Shubin <nikita.shubin@maquefel.me>
+
+properties:
+  compatible:
+    const: cirrus,ep9301-gpio
+
+  chip-label:
+    maxItems: 1
+    description: human readable name.
+
+  reg:
+    minItems: 2
+    items:
+      - description: data register
+      - description: direction register
+      - description: interrupt registers base
+
+  reg-names:
+    minItems: 2
+    items:
+      - const: data
+      - const: dir
+      - const: intr
+
+  gpio-controller: true
+
+  gpio-ranges: true
+
+  "#gpio-cells":
+    const: 2
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
+  interrupts:
+    items:
+      - const: 27
+
+  interrupts-extended:
+    minItems: 8
+    maxItems: 8
+    description: port F has dedicated irq line for each gpio line.
+
+required:
+  - compatible
+  - reg
+  - gpio-controller
+  - "#gpio-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+        gpio0: gpio@80840000 {
+                compatible = "cirrus,ep9301-gpio";
+                chip-label = "A";
+                reg = <0x80840000 0x04>,
+                      <0x80840010 0x04>,
+                      <0x80840090 0x1c>;
+                reg-names = "data", "dir", "intr";
+                gpio-controller;
+                #gpio-cells = <2>;
+                interrupt-controller;
+                interrupt-parent = <&vic1>;
+                interrupts = <27>;
+        };
+
+        gpio1: gpio@80840004 {
+                compatible = "cirrus,ep9301-gpio";
+                chip-label = "B";
+                reg = <0x80840004 0x04>,
+                      <0x80840014 0x04>,
+                      <0x808400ac 0x1c>;
+                reg-names = "data", "dir", "intr";
+                gpio-controller;
+                #gpio-cells = <2>;
+                interrupt-controller;
+                interrupt-parent = <&vic1>;
+                interrupts = <27>;
+        };
+
+        gpio2: gpio@80840008 {
+                compatible = "cirrus,ep9301-gpio";
+                chip-label = "C";
+                reg = <0x80840008 0x04>,
+                      <0x80840018 0x04>;
+                reg-names = "data", "dir";
+                gpio-controller;
+                #gpio-cells = <2>;
+        };
+
+        gpio3: gpio@8084000c {
+                compatible = "cirrus,ep9301-gpio";
+                chip-label = "D";
+                reg = <0x8084000c 0x04>,
+                      <0x8084001c 0x04>;
+                reg-names = "data", "dir";
+                gpio-controller;
+                #gpio-cells = <2>;
+        };
+
+        gpio4: gpio@80840020 {
+                compatible = "cirrus,ep9301-gpio";
+                chip-label = "E";
+                reg = <0x80840020 0x04>,
+                      <0x80840024 0x04>;
+                reg-names = "data", "dir";
+                gpio-controller;
+                #gpio-cells = <2>;
+        };
+
+        gpio5: gpio@80840030 {
+                compatible = "cirrus,ep9301-gpio";
+                chip-label = "F";
+                reg = <0x80840030 0x04>,
+                      <0x80840034 0x04>,
+                      <0x8084004c 0x1c>;
+                reg-names = "data", "dir", "intr";
+                gpio-controller;
+                #gpio-cells = <2>;
+                interrupt-controller;
+                interrupts-extended = <&vic0 19>, <&vic0 20>,
+                                      <&vic0 21>, <&vic0 22>,
+                                      <&vic1 15>, <&vic1 16>,
+                                      <&vic1 17>, <&vic1 18>;
+        };
+
+        gpio6: gpio@80840038 {
+                compatible = "cirrus,ep9301-gpio";
+                chip-label = "G";
+                reg = <0x80840038 0x04>,
+                      <0x8084003c 0x04>;
+                reg-names = "data", "dir";
+                gpio-controller;
+                #gpio-cells = <2>;
+        };
+
+        gpio7: gpio@80840040 {
+                compatible = "cirrus,ep9301-gpio";
+                chip-label = "H";
+                reg = <0x80840040 0x04>,
+                      <0x80840044 0x04>;
+                reg-names = "data", "dir";
+                gpio-controller;
+                #gpio-cells = <2>;
+        };
+
+...