diff mbox series

[v4,2/2] dt-bindings: gpio: Add devicetree binding for IDT 79RC32434 GPIO controller

Message ID 20210426095426.118356-2-tsbogend@alpha.franken.de
State New
Headers show
Series [v4,1/2] gpio: Add support for IDT 79RC3243x GPIO controller | expand

Commit Message

Thomas Bogendoerfer April 26, 2021, 9:54 a.m. UTC
Add YAML devicetree binding for IDT 79RC32434 GPIO controller

Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
Changes in v4:
 - renamed to idt,32434-gpio this time for real

Changes in v3:
 - renamed to idt,32434-gpio
 - drop ngpio description
 - use gpio0: gpio@50004 in example

 .../bindings/gpio/idt,32434-gpio.yaml         | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/idt,32434-gpio.yaml

Comments

Rob Herring April 30, 2021, 8:19 p.m. UTC | #1
On Mon, 26 Apr 2021 11:54:26 +0200, Thomas Bogendoerfer wrote:
> Add YAML devicetree binding for IDT 79RC32434 GPIO controller
> 
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
> Changes in v4:
>  - renamed to idt,32434-gpio this time for real
> 
> Changes in v3:
>  - renamed to idt,32434-gpio
>  - drop ngpio description
>  - use gpio0: gpio@50004 in example
> 
>  .../bindings/gpio/idt,32434-gpio.yaml         | 71 +++++++++++++++++++
>  1 file changed, 71 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/gpio/idt,32434-gpio.yaml
> 

Reviewed-by: Rob Herring <robh@kernel.org>
Linus Walleij May 1, 2021, 12:13 p.m. UTC | #2
On Mon, Apr 26, 2021 at 11:54 AM Thomas Bogendoerfer
<tsbogend@alpha.franken.de> wrote:

> Add YAML devicetree binding for IDT 79RC32434 GPIO controller
>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
> Changes in v4:
>  - renamed to idt,32434-gpio this time for real

Overall looks good to me.

> +required:
(...)
> +  - ngpios

Is there a *technical* reason why this is required?

Can't the driver just default to 32 gpios when not specified?

> +  - interrupt-controller
> +  - "#interrupt-cells"
> +  - interrupts

Why can't interrupt support be made optional?

It is fine if the driver errors out if not provided, but
for the bindings this feels optional.

Or does the thing break unless you handle the IRQs?

Yours,
Linus Walleij
Rob Herring May 4, 2021, 1:44 p.m. UTC | #3
On Sat, May 1, 2021 at 7:13 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Mon, Apr 26, 2021 at 11:54 AM Thomas Bogendoerfer
> <tsbogend@alpha.franken.de> wrote:
>
> > Add YAML devicetree binding for IDT 79RC32434 GPIO controller
> >
> > Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > ---
> > Changes in v4:
> >  - renamed to idt,32434-gpio this time for real
>
> Overall looks good to me.
>
> > +required:
> (...)
> > +  - ngpios
>
> Is there a *technical* reason why this is required?
>
> Can't the driver just default to 32 gpios when not specified?
>
> > +  - interrupt-controller
> > +  - "#interrupt-cells"
> > +  - interrupts
>
> Why can't interrupt support be made optional?
>
> It is fine if the driver errors out if not provided, but
> for the bindings this feels optional.
>
> Or does the thing break unless you handle the IRQs?

If the hardware has interrupts, then we should describe that. It's the
OS driver that may or may not support interrupts.

Rob
Linus Walleij May 6, 2021, 11:11 a.m. UTC | #4
On Tue, May 4, 2021 at 3:44 PM Rob Herring <robh+dt@kernel.org> wrote:
> On Sat, May 1, 2021 at 7:13 AM Linus Walleij <linus.walleij@linaro.org> wrote:

> > Why can't interrupt support be made optional?
(...)
>
> If the hardware has interrupts, then we should describe that. It's the
> OS driver that may or may not support interrupts.

You're right of course. What was I thinking.

Yours,
Linus Walleij
Thomas Bogendoerfer May 11, 2021, 9:13 p.m. UTC | #5
On Sat, May 01, 2021 at 02:13:35PM +0200, Linus Walleij wrote:
> On Mon, Apr 26, 2021 at 11:54 AM Thomas Bogendoerfer
> <tsbogend@alpha.franken.de> wrote:
> 
> > Add YAML devicetree binding for IDT 79RC32434 GPIO controller
> >
> > Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > ---
> > Changes in v4:
> >  - renamed to idt,32434-gpio this time for real
> 
> Overall looks good to me.
> 
> > +required:
> (...)
> > +  - ngpios
> 
> Is there a *technical* reason why this is required?
> 
> Can't the driver just default to 32 gpios when not specified?

sure, I make it optional.

> > +  - interrupt-controller
> > +  - "#interrupt-cells"
> > +  - interrupts
> 
> Why can't interrupt support be made optional?
> 
> It is fine if the driver errors out if not provided, but
> for the bindings this feels optional.

I'll make them optional.

> Or does the thing break unless you handle the IRQs?

no, they could be used just as GPIOs.

Thomas.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/gpio/idt,32434-gpio.yaml b/Documentation/devicetree/bindings/gpio/idt,32434-gpio.yaml
new file mode 100644
index 000000000000..517d14b6c2e2
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/idt,32434-gpio.yaml
@@ -0,0 +1,71 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/idt,32434-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: IDT 79RC32434 GPIO controller
+
+maintainers:
+  - Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+
+properties:
+  compatible:
+    const: idt,32434-gpio
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: gpio
+      - const: pic
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+
+  ngpios:
+    minimum: 1
+    maximum: 32
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - gpio-controller
+  - "#gpio-cells"
+  - ngpios
+  - interrupt-controller
+  - "#interrupt-cells"
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio0: gpio@50004 {
+        compatible = "idt,32434-gpio";
+        reg = <0x50004 0x10>, <0x38030 0x0c>;
+        reg-names = "gpio", "pic";
+
+        interrupt-controller;
+        #interrupt-cells = <2>;
+
+        interrupt-parent = <&cpuintc>;
+        interrupts = <6>;
+
+        gpio-controller;
+        #gpio-cells = <2>;
+
+        ngpios = <14>;
+    };