[PATCH 10/21] dt-bindings: gpio: adi,adsp-port-gpio: add bindings

Arturs Artamonovs via B4 Relay posted 21 patches 2 months, 2 weeks ago
[PATCH 10/21] dt-bindings: gpio: adi,adsp-port-gpio: add bindings
Posted by Arturs Artamonovs via B4 Relay 2 months, 2 weeks ago
From: Arturs Artamonovs <arturs.artamonovs@analog.com>

Add ADSP-SC5xx GPIO driver bindings.

Signed-off-by: Arturs Artamonovs <Arturs.Artamonovs@analog.com>
Co-developed-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Co-developed-by: Greg Malysa <greg.malysa@timesys.com>
Signed-off-by: Greg Malysa <greg.malysa@timesys.com>
---
 .../bindings/gpio/adi,adsp-port-gpio.yaml          | 69 ++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpio/adi,adsp-port-gpio.yaml b/Documentation/devicetree/bindings/gpio/adi,adsp-port-gpio.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..3d7899ce759193296ce787d09d742824277f37f8
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/adi,adsp-port-gpio.yaml
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/adi,adsp-port-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices GPIO Port Driver for SC5XX-family processors
+
+maintainers:
+  - Arturs Artamonovs <arturs.artamonovs@analog.com>
+  - Utsav Agarwal <Utsav.Agarwal@analog.com>
+
+description: |
+  Analog Devices GPIO Port Driver for SC5XX-family processors
+
+properties:
+  compatible:
+    enum:
+      - adi,adsp-port-gpio
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+
+  gpio-ranges:
+    description: Associated pinmux controller and the GPIO range values
+
+  adi,pint:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description: Associated pin interrupt controller driver
+    items:
+      - items:
+          - description: phandle to pin interrupt controller driver
+          - description: interrupt value
+
+  reg:
+    description: PORT GPIO control registers
+
+required:
+  - compatible
+  - reg
+  - "#gpio-cells"
+  - gpio-controller
+  - gpio-ranges
+  - adi,pint
+
+additionalProperties: false
+
+examples:
+  - |
+    gpa: gport@31004000 {
+      compatible = "adi,adsp-port-gpio";
+      gpio-controller;
+      #gpio-cells = <2>;
+      reg = <0x31004000 0x7F>;
+      gpio-ranges = <&pinctrl0 0 0 16>;
+      adi,pint = <&pint0 1>;
+    };
+
+    gpb: gport@31004080 {
+      compatible = "adi,adsp-port-gpio";
+      gpio-controller;
+      #gpio-cells = <2>;
+      reg = <0x31004080 0x7F>;
+      gpio-ranges = <&pinctrl0 0 16 16>;
+      adi,pint = <&pint0 0>;
+    };
+...

-- 
2.25.1
Re: [PATCH 10/21] dt-bindings: gpio: adi,adsp-port-gpio: add bindings
Posted by Krzysztof Kozlowski 2 months, 2 weeks ago
On 12/09/2024 20:24, Arturs Artamonovs via B4 Relay wrote:
> From: Arturs Artamonovs <arturs.artamonovs@analog.com>
> 
> Add ADSP-SC5xx GPIO driver bindings.
> 
> Signed-off-by: Arturs Artamonovs <Arturs.Artamonovs@analog.com>
> Co-developed-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
> Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
> Co-developed-by: Greg Malysa <greg.malysa@timesys.com>
> Signed-off-by: Greg Malysa <greg.malysa@timesys.com>
> ---
>  .../bindings/gpio/adi,adsp-port-gpio.yaml          | 69 ++++++++++++++++++++++
>  1 file changed, 69 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/gpio/adi,adsp-port-gpio.yaml b/Documentation/devicetree/bindings/gpio/adi,adsp-port-gpio.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..3d7899ce759193296ce787d09d742824277f37f8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/adi,adsp-port-gpio.yaml
> @@ -0,0 +1,69 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/gpio/adi,adsp-port-gpio.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Analog Devices GPIO Port Driver for SC5XX-family processors
> +
> +maintainers:
> +  - Arturs Artamonovs <arturs.artamonovs@analog.com>
> +  - Utsav Agarwal <Utsav.Agarwal@analog.com>
> +
> +description: |

Do not need '|' unless you need to preserve formatting.

All review comments apply to all your patches.

> +  Analog Devices GPIO Port Driver for SC5XX-family processors
> +
> +properties:
> +  compatible:
> +    enum:
> +      - adi,adsp-port-gpio

No, this *must* be SoC-specific compatible. If you are unsure, just look
at any other SoC (of course nothing ancient).

> +
> +  gpio-controller: true
> +
> +  "#gpio-cells":
> +    const: 2
> +
> +  gpio-ranges:
> +    description: Associated pinmux controller and the GPIO range values

That's useless comment. Just true, or min/maxItems

> +
> +  adi,pint:
> +    $ref: /schemas/types.yaml#/definitions/phandle-array
> +    description: Associated pin interrupt controller driver
> +    items:
> +      - items:
> +          - description: phandle to pin interrupt controller driver
> +          - description: interrupt value

Hm? No, why would you put it here? And why this is not just interrupts
property?

> +
> +  reg:
> +    description: PORT GPIO control registers

Reg goes after compatible

> +
> +required:
> +  - compatible
> +  - reg

Look, here order is correct.

> +  - "#gpio-cells"
> +  - gpio-controller
> +  - gpio-ranges
> +  - adi,pint
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    gpa: gport@31004000 {

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Drop unused label.


> +      compatible = "adi,adsp-port-gpio";
> +      gpio-controller;
> +      #gpio-cells = <2>;
> +      reg = <0x31004000 0x7F>;


It is ALWAYS lowercase hex. This applies (just like all other comments)
to all your DT-related code.

> +      gpio-ranges = <&pinctrl0 0 0 16>;
> +      adi,pint = <&pint0 1>;

Just one example. Drop the one below.

> +    };
> +
> +    gpb: gport@31004080 {
> +      compatible = "adi,adsp-port-gpio";
> +      gpio-controller;
> +      #gpio-cells = <2>;
> +      reg = <0x31004080 0x7F>;
> +      gpio-ranges = <&pinctrl0 0 16 16>;
> +      adi,pint = <&pint0 0>;
> +    };
> +...
> 

Best regards,
Krzysztof