Skip to contentSkip to conversation

dt-bindings: gpio: aspeed,ast2400-gpio: Convert to DT schema

PATCH In review Andrew Jeffery 3 participants 7 messages Feb 28, 2024 – Mar 4, 2024

Subsystems (3)
lore
Share & tools
lore

Andrew Jeffery

author maintainer
#0 lore raw

PATCH v6 1/1 dt-bindings: gpio: aspeed,ast2400-gpio: Convert to DT schema

Squash warnings such as:

```
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-galaxy100.dtb: /ahb/apb at 1e600000/gpio at 1e780000: failed to match any schema with compatible: ['aspeed,ast2400-gpio']
```

---
v6: Address more constraint feedback from Krzysztof:

    https://lore.kernel.org/all/f69ef2ad-8ace-40c8-b923-4dde20eda2ec at linaro.org/

v5: https://lore.kernel.org/all/20240227052353.1060306-1-andrew at codeconstruct.com.au/

Resolve macro definition clashes from aspeed clock headers in examples identified by Rob's bot:

https://lore.kernel.org/all/170900020204.2360855.790404478830111761.robh at kernel.org/

Clearly I missed running make dt_binding_check on the final iteration of the v4 patch I sent. Hopefully I'm running out of rakes to step on here!

v4: https://lore.kernel.org/all/20240227004414.841391-1-andrew at codeconstruct.com.au/

Add constraints for gpio-line-names, ngpios as requested by Krzysztof:
https://lore.kernel.org/all/458becdb-fb1e-4808-87b6-3037ec945647 at linaro.org/

Add more examples to exercise constraints.

v3: https://lore.kernel.org/all/20240226051645.414935-1-andrew at codeconstruct.com.au/

Base on v6.8-rc6, fix yamllint warning

Rob's bot picked the missing #interrupt-cells in the example on v2[1]. The patch was based on v6.8-rc1, and going back over my shell history I missed the following output from make dt_binding_check:

```
...
LINT Documentation/devicetree/bindings
usage: yamllint [-h] [-] [-c CONFIG_FILE | -d CONFIG_DATA] [--list-files] [-f {parsable,standard,colored,github,auto}] [-s] [--no-warnings] [-v] [FILE_OR_DIR ...]
yamllint: error: one of the arguments FILE_OR_DIR - is required
...
```

I've rebased on v6.8-rc6 and no-longer see the issue with the invocation of yamllint.

[1]: https://lore.kernel.org/all/170892197611.2260479.15343562563553959436.robh at kernel.org/

v2: https://lore.kernel.org/all/20240226031951.284847-1-andrew at codeconstruct.com.au/

Address feedback from Krzysztof:
https://lore.kernel.org/all/0d1dd262-b6dd-4d71-9239-8b0aec8cceff at linaro.org/

v1: https://lore.kernel.org/all/20240220052918.742793-1-andrew at codeconstruct.com.au/

 .../bindings/gpio/aspeed,ast2400-gpio.yaml    | 148 ++++++++++++++++++
 .../devicetree/bindings/gpio/gpio-aspeed.txt  |  39 -----
 2 files changed, 148 insertions(+), 39 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml
 delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-aspeed.txt
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +148 -0
new file mode 100644
index 000000000000..cf11aa7ec8c7
@@ -0,0 +1,148 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/aspeed,ast2400-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Aspeed GPIO controller
+
+maintainers:
+  - Andrew Jeffery <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - aspeed,ast2400-gpio
+      - aspeed,ast2500-gpio
+      - aspeed,ast2600-gpio
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+    description: The clock to use for debounce timings
+
+  gpio-controller: true
+  gpio-line-names:
+    minItems: 36
+    maxItems: 232
+
+  gpio-ranges: true
+
+  "#gpio-cells":
+    const: 2
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
+  ngpios:
+    minimum: 36
+    maximum: 232
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-controller
+  - "#interrupt-cells"
+  - gpio-controller
+  - "#gpio-cells"
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: aspeed,ast2400-gpio
+    then:
+      properties:
+        gpio-line-names:
+          minItems: 220
+          maxItems: 220
+        ngpios:
+          const: 220
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: aspeed,ast2500-gpio
+    then:
+      properties:
+        gpio-line-names:
+          minItems: 232
+          maxItems: 232
+        ngpios:
+          const: 232
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: aspeed,ast2600-gpio
+    then:
+      properties:
+        gpio-line-names:
+          minItems: 36
+          maxItems: 208
+        ngpios:
+          enum: [ 36, 208 ]
+      required:
+        - ngpios
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio at 1e780000 {
+        compatible = "aspeed,ast2400-gpio";
+        reg = <0x1e780000 0x1000>;
+        interrupts = <20>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+  - |
+    gpio: gpio at 1e780000 {
+        compatible = "aspeed,ast2500-gpio";
+        reg = <0x1e780000 0x200>;
+        interrupts = <20>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+        gpio-controller;
+        #gpio-cells = <2>;
+        gpio-ranges = <&pinctrl 0 0 232>;
+    };
+  - |
+    #include <dt-bindings/clock/ast2600-clock.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    gpio0: gpio at 1e780000 {
+        compatible = "aspeed,ast2600-gpio";
+        reg = <0x1e780000 0x400>;
+        clocks = <&syscon ASPEED_CLK_APB2>;
+        interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+        #gpio-cells = <2>;
+        gpio-controller;
+        gpio-ranges = <&pinctrl 0 0 208>;
+        ngpios = <208>;
+    };
+    gpio1: gpio at 1e780800 {
+        compatible = "aspeed,ast2600-gpio";
+        reg = <0x1e780800 0x800>;
+        clocks = <&syscon ASPEED_CLK_APB1>;
+        interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+        gpio-controller;
+        #gpio-cells = <2>;
+        gpio-ranges = <&pinctrl 0 208 36>;
+        ngpios = <36>;
+    };
Documentation/devicetree/bindings/gpio/gpio-aspeed.txt deleted +0 -39
deleted file mode 100644
index b2033fc3a71a..000000000000
@@ -1,39 +0,0 @@
-Aspeed GPIO controller Device Tree Bindings
--------------------------------------------
-
-Required properties:
-- compatible		: Either "aspeed,ast2400-gpio", "aspeed,ast2500-gpio",
-					or "aspeed,ast2600-gpio".
-
-- #gpio-cells 		: Should be two
-			  - First cell is the GPIO line number
-			  - Second cell is used to specify optional
-			    parameters (unused)
-
-- reg			: Address and length of the register set for the device
-- gpio-controller	: Marks the device node as a GPIO controller.
-- interrupts		: Interrupt specifier (see interrupt bindings for
-			  details)
-- interrupt-controller	: Mark the GPIO controller as an interrupt-controller
-
-Optional properties:
-
-- clocks		: A phandle to the clock to use for debounce timings
-- ngpios		: Number of GPIOs controlled by this controller. Should	be set
-				  when there are multiple GPIO controllers on a SoC (ast2600).
-
-The gpio and interrupt properties are further described in their respective
-bindings documentation:
-
-- Documentation/devicetree/bindings/gpio/gpio.txt
-- Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
-
-  Example:
-	gpio at 1e780000 {
-		#gpio-cells = <2>;
-		compatible = "aspeed,ast2400-gpio";
-		gpio-controller;
-		interrupts = <20>;
-		reg = <0x1e780000 0x1000>;
-		interrupt-controller;
-	};

base-commit: d206a76d7d2726f3b096037f2079ce0bd3ba329b

Signature · 1 line
2.39.2
Reviewed-by on v6 1/1
#1 lore raw
Quoted 10 lines · Andrew Jeffery

Squash warnings such as:

```
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-galaxy100.dtb: /ahb/apb at 1e600000/gpio at 1e780000: failed to match any schema with compatible: ['aspeed,ast2400-gpio']
```

---
v6: Address more constraint feedback from Krzysztof:

    https://lore.kernel.org/all/f69ef2ad-8ace-40c8-b923-4dde20eda2ec at linaro.org/

You still have way too many examples. One is enough, two is still okay. We really do not want more of examples with minor differences.

Best regards,
Krzysztof

author maintainer
#2 lore raw
Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · Andrew Jeffery

Squash warnings such as:

```
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-galaxy100.dtb: /ahb/apb at 1e600000/gpio at 1e780000: failed to match any schema with compatible: ['aspeed,ast2400-gpio']
```
Quoted 7 lines
Quoted 4 lines

---
v6: Address more constraint feedback from Krzysztof:

    https://lore.kernel.org/all/f69ef2ad-8ace-40c8-b923-4dde20eda2ec at linaro.org/

You still have way too many examples. One is enough, two is still okay. We really do not want more of examples with minor differences.

Noted, I'll keep them to a minimum in the future.

Quoted 2 lines

Thanks for the feedback.

Andrew

#3 lore raw
Quoted 8 lines · On Thu, Feb 29, 2024 at 4:21?AM Andrew Jeffery <[email protected]>…
Quoted 3 lines · Krzysztof Kozlowski

You still have way too many examples. One is enough, two is still okay. We really do not want more of examples with minor differences.

Noted, I'll keep them to a minimum in the future.

As in: I'll still send a v7? I can trim the examples when applying, just tell me which ones to drop.

Bart

author maintainer
#4 lore raw
Quoted 5 lines · Bartosz Golaszewski
Quoted 3 lines · On Thu, Feb 29, 2024 at 4:21?AM Andrew Jeffery <[email protected]>…
Quoted 1 line · Krzysztof Kozlowski
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

You still have way too many examples. One is enough, two is still okay. We really do not want more of examples with minor differences.

Noted, I'll keep them to a minimum in the future.

As in: I'll still send a v7? I can trim the examples when applying, just tell me which ones to drop.

Ah, thanks. I wasn't planning to send a v7 given the R-b tag from Krzysztof for v6. I intended for "in the future" to mean for patches converting other bindings to DT schema. But if you're keen to trim some examples out I'd drop the aspeed,ast2400-gpio and aspeed,ast2500-gpio nodes, keeping just the aspeed,ast2600-gpio example.

Andrew

#5 lore raw
Quoted 16 lines · On Fri, Mar 1, 2024 at 12:23?AM Andrew Jeffery <[email protected]>…
Quoted 5 lines · Bartosz Golaszewski
Quoted 3 lines · On Thu, Feb 29, 2024 at 4:21?AM Andrew Jeffery <[email protected]>…
Quoted 1 line · Krzysztof Kozlowski
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

You still have way too many examples. One is enough, two is still okay. We really do not want more of examples with minor differences.

Noted, I'll keep them to a minimum in the future.

As in: I'll still send a v7? I can trim the examples when applying, just tell me which ones to drop.

Quoted 7 lines

Ah, thanks. I wasn't planning to send a v7 given the R-b tag from Krzysztof for v6. I intended for "in the future" to mean for patches converting other bindings to DT schema. But if you're keen to trim some examples out I'd drop the aspeed,ast2400-gpio and aspeed,ast2500-gpio nodes, keeping just the aspeed,ast2600-gpio example.

Andrew

It's ok, I applied it as is.

Bart

author maintainer
#6 lore raw
Quoted 24 lines · Bartosz Golaszewski
Quoted 22 lines · On Fri, Mar 1, 2024 at 12:23?AM Andrew Jeffery <[email protected]>…
Quoted 5 lines · Bartosz Golaszewski
Quoted 3 lines · On Thu, Feb 29, 2024 at 4:21?AM Andrew Jeffery <[email protected]>…
Quoted 1 line · Krzysztof Kozlowski
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

You still have way too many examples. One is enough, two is still okay. We really do not want more of examples with minor differences.

Noted, I'll keep them to a minimum in the future.

As in: I'll still send a v7? I can trim the examples when applying, just tell me which ones to drop.

Ah, thanks. I wasn't planning to send a v7 given the R-b tag from Krzysztof for v6. I intended for "in the future" to mean for patches converting other bindings to DT schema. But if you're keen to trim some examples out I'd drop the aspeed,ast2400-gpio and aspeed,ast2500-gpio nodes, keeping just the aspeed,ast2600-gpio example.

Quoted 3 lines
Quoted 1 line

Andrew

It's ok, I applied it as is.

Thanks!

Andrew