dt-bindings: gpio: Convert Aspeed binding to YAML schema
Subsystems (3)
Andrew Jeffery
maintainerPATCH 1/1 dt-bindings: gpio: Convert Aspeed binding to YAML 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'] ```
--- .../bindings/gpio/aspeed,ast2400-gpio.yaml | 64 +++++++++++++++++++ .../devicetree/bindings/gpio/gpio-aspeed.txt | 39 ----------- 2 files changed, 64 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 +64 -0
@@ -0,0 +1,64 @@ +# 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]> + +allOf: + - $ref: /schemas/gpio/gpio.yaml# + - if: + properties: + compatible: + contains: + const: aspeed,ast2600-gpio + then: + required: + - ngpios + +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 + + interrupts: + maxItems: 1 + + interrupt-controller: true + + "#interrupt-cells": + const: 2 + +required: + - compatible + - reg + - interrupts + - interrupt-controller + - "#gpio-cells" + - gpio-controller + +unevaluatedProperties: false + +examples: + - | + gpio at 1e780000 { + compatible = "aspeed,ast2400-gpio"; + reg = <0x1e780000 0x1000>; + interrupts = <20>; + interrupt-controller; + #gpio-cells = <2>; + gpio-controller; + };
Documentation/devicetree/bindings/gpio/gpio-aspeed.txt deleted +0 -39
@@ -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: 6613476e225e090cc9aad49be7fa504e290dd33d
Signature · 1 line
2.39.2
Quoted 2 lines · Andrew Jeffery
Squash warnings such as:
Missing subject prefix: aspeed,ast2400-gpio
Quoted 5 lines
``` 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'] ```Signed-off-by Andrew Jeffery <[email protected]>
Thank you for your patch. There is something to discuss/improve.
Quoted 16 lines
--- .../bindings/gpio/aspeed,ast2400-gpio.yaml | 64 +++++++++++++++++++ .../devicetree/bindings/gpio/gpio-aspeed.txt | 39 ----------- 2 files changed, 64 insertions(+), 39 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-aspeed.txtDocumentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +3
-0@@ -0,0 +1,64 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +---
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml line 13
Quoted 10 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +10
-0+$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]> + +allOf: + - $ref: /schemas/gpio/gpio.yaml#
From where did you take it? None of the bindings have such code. Start from recent bindings in given category when writing new ones.
Please drop it.
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml line 21
Quoted 8 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +8
-0+ - if: + properties: + compatible: + contains: + const: aspeed,ast2600-gpio + then: + required: + - ngpios
Please put entire allOf: after required: block. That's the convention when it has something more than $ref, because we still want the most important parts at the top of the file.
Quoted 13 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +13
-0+ +properties: + compatible: + enum: + - aspeed,ast2400-gpio + - aspeed,ast2500-gpio + - aspeed,ast2600-gpio + + reg: + maxItems: 1 + + clocks: + maxItems: 1
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml line 44
Quoted 10 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +10
-0+ description: The clock to use for debounce timings + + interrupts: + maxItems: 1 + + interrupt-controller: true + + "#interrupt-cells": + const: 2 +
ngpios with some constraints
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml line 53
Quoted 9 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +9
-0+required: + - compatible + - reg + - interrupts + - interrupt-controller + - "#gpio-cells" + - gpio-controller + +unevaluatedProperties: false
Instead additionalProperties: false.
Best regards,
Krzysztof
Andrew Jeffery
maintainerHi Krzysztof, thanks for the feedback.
Quoted 37 lines · Krzysztof Kozlowski
Quoted 37 lines · Andrew Jeffery
Quoted 2 lines
Quoted 2 lines
Squash warnings such as:
Missing subject prefix: aspeed,ast2400-gpio
Quoted 5 lines
Quoted 5 lines
``` 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'] ```Signed-off-by Andrew Jeffery <[email protected]>Thank you for your patch. There is something to discuss/improve.
Quoted 21 lines
Quoted 21 lines
--- .../bindings/gpio/aspeed,ast2400-gpio.yaml | 64 +++++++++++++++++++ .../devicetree/bindings/gpio/gpio-aspeed.txt | 39 ----------- 2 files changed, 64 insertions(+), 39 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-aspeed.txtDocumentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +8
-0@@ -0,0 +1,64 @@ +# 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 +
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml line 13
Quoted 5 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +5
-0+maintainers: + - Andrew Jeffery <[email protected]> + +allOf: + - $ref: /schemas/gpio/gpio.yaml#From where did you take it? None of the bindings have such code. Start from recent bindings in given category when writing new ones.
I didn't take it from anywhere so much as try to apply some reasoning via the commentary in the example at [1]. Maybe I could have fought that approach by contrasting what I wrote to a wider set of existing binding documents (I did look at some and obviously didn't find anything similar).
Anyway reflecting on the misunderstanding, is the ref unnecessary because the gpio binding sets select: true[2] and so is applied to the node regardless?
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/example-schema.yaml?h=v6.7#n238
[2]: https://github.com/devicetree-org/dt-schema/blob/v2023.11/dtschema/schemas/gpio/gpio.yaml#L12
Quoted 2 lines
Quoted 2 lines
Please drop it.
Ack.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +8
-0+ - if: + properties: + compatible: + contains: + const: aspeed,ast2600-gpio + then: + required: + - ngpios
Quoted 3 lines
Quoted 3 lines
Please put entire allOf: after required: block. That's the convention when it has something more than $ref, because we still want the most important parts at the top of the file.
Ack.
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +17
-0+ +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 + + interrupts: + maxItems: 1
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml line 44
Quoted 6 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +6
-0+ + interrupt-controller: true + + "#interrupt-cells": + const: 2 +ngpios with some constraints
Is this just with regard to the constraints I have under allOf above? Or something further (constrain the values of ngpios for the various controllers across the Aspeed SoCs)?
Maybe I'll look at some more of the existing bindings for this as well...
Quoted 12 lines
Quoted 12 lines
Quoted 10 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml line 53
Quoted 10 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +9
-0+required: + - compatible + - reg + - interrupts + - interrupt-controller + - "#gpio-cells" + - gpio-controller + +unevaluatedProperties: falseInstead additionalProperties: false.
Ack - this is the same misunderstanding as the gpio schema ref discussed above.
Andrew
Quoted 26 lines · Andrew Jeffery
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +17
-0+ +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 + + interrupts: + maxItems: 1Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml line 44
Quoted 6 lines
Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file +6
-0+ + interrupt-controller: true + + "#interrupt-cells": + const: 2 +ngpios with some constraints
Quoted 1 line
Is this just with regard to the constraints I have under allOf above?
You miss ngpios.
Best regards,
Krzysztof