diff mbox series

[4/5] dt-bindings: gpio: convert Atmel GPIO to json-schema

Message ID 20240624100431.191172-5-manikandan.m@microchip.com
State New
Headers show
Series Convert Atmel PIO3 Pinctrl and GPIO bindings to yaml | expand

Commit Message

Manikandan Muralidharan June 24, 2024, 10:04 a.m. UTC
Convert the Atmel GPIO controller binding document to DT schema format
using json-schema.

Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
---
 .../bindings/gpio/atmel,at91rm9200-gpio.yaml  | 78 +++++++++++++++++++
 .../devicetree/bindings/gpio/gpio_atmel.txt   | 31 --------
 2 files changed, 78 insertions(+), 31 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
 delete mode 100644 Documentation/devicetree/bindings/gpio/gpio_atmel.txt

Comments

Rob Herring (Arm) June 24, 2024, 11:24 a.m. UTC | #1
On Mon, 24 Jun 2024 15:34:30 +0530, Manikandan Muralidharan wrote:
> Convert the Atmel GPIO controller binding document to DT schema format
> using json-schema.
> 
> Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
> ---
>  .../bindings/gpio/atmel,at91rm9200-gpio.yaml  | 78 +++++++++++++++++++
>  .../devicetree/bindings/gpio/gpio_atmel.txt   | 31 --------
>  2 files changed, 78 insertions(+), 31 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
>  delete mode 100644 Documentation/devicetree/bindings/gpio/gpio_atmel.txt
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.example.dtb: gpio@fffff400: compatible: 'oneOf' conditional failed, one must be fixed:
	['atmel,at91rm9200-gpio'] is too short
	'atmel,at91rm9200-gpio' is not one of ['atmel,at91sam9x5-gpio', 'microchip,sam9x60-gpio']
	'atmel,at91rm9200-gpio' is not one of ['microchip,sam9x7-gpio']
	from schema $id: http://devicetree.org/schemas/gpio/atmel,at91rm9200-gpio.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240624100431.191172-5-manikandan.m@microchip.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Conor Dooley June 24, 2024, 4:22 p.m. UTC | #2
On Mon, Jun 24, 2024 at 03:34:30PM +0530, Manikandan Muralidharan wrote:
> Convert the Atmel GPIO controller binding document to DT schema format
> using json-schema.

This should mention that there are additional compatible strings added.
> 
> Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
> ---
>  .../bindings/gpio/atmel,at91rm9200-gpio.yaml  | 78 +++++++++++++++++++
>  .../devicetree/bindings/gpio/gpio_atmel.txt   | 31 --------
>  2 files changed, 78 insertions(+), 31 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
>  delete mode 100644 Documentation/devicetree/bindings/gpio/gpio_atmel.txt
> 
> diff --git a/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
> new file mode 100644
> index 000000000000..3ace7ba687fc
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
> @@ -0,0 +1,78 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/gpio/atmel,at91rm9200-gpio.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Microchip GPIO controller (PIO)
> +
> +maintainers:
> +  - Manikandan Muralidharan <manikandan.m@microchip.com>
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - items:
> +          - enum:
> +              - atmel,at91sam9x5-gpio
> +              - microchip,sam9x60-gpio
> +          - const: atmel,at91rm9200-gpio

This is definitely wrong, cos it disallows having
"atmel,at91rm9200-gpio" on it's own.

> +      - items:
> +          - enum:
> +              - microchip,sam9x7-gpio
> +          - const: microchip,sam9x60-gpio
> +          - const: atmel,at91rm9200-gpio
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  interrupt-controller: true
> +
> +  "#interrupt-cells":
> +    const: 2
> +
> +  gpio-controller: true
> +  gpio-line-names: true
> +
> +  "#gpio-cells":
> +    const: 2
> +
> +  clocks:
> +    maxItems: 1
> +
> +  "#gpio-lines":
> +    description:
> +      Number of gpio, 32 by default if absent

default: 32

> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - interrupt-controller
> +  - "#interrupt-cells"
> +  - gpio-controller
> +  - "#gpio-cells"
> +  - clocks
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/clock/at91.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    pioA: gpio@fffff400 {

The label here isn't needed.

Thanks,
Conor.

> +            compatible = "atmel,at91rm9200-gpio";
> +            reg = <0xfffff400 0x200>;
> +            interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>;
> +            #gpio-cells = <2>;
> +            gpio-controller;
> +            interrupt-controller;
> +            #interrupt-cells = <2>;
> +            clocks = <&pmc PMC_TYPE_PERIPHERAL 2>;
> +    };
> +...
> diff --git a/Documentation/devicetree/bindings/gpio/gpio_atmel.txt b/Documentation/devicetree/bindings/gpio/gpio_atmel.txt
> deleted file mode 100644
> index 29416f9c3220..000000000000
> --- a/Documentation/devicetree/bindings/gpio/gpio_atmel.txt
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -* Atmel GPIO controller (PIO)
> -
> -Required properties:
> -- compatible: "atmel,<chip>-gpio", where <chip> is at91rm9200 or at91sam9x5.
> -- reg: Should contain GPIO controller registers location and length
> -- interrupts: Should be the port interrupt shared by all the pins.
> -- #gpio-cells: Should be two.  The first cell is the pin number and
> -  the second cell is used to specify optional parameters to declare if the GPIO
> -  is active high or low. See gpio.txt.
> -- gpio-controller: Marks the device node as a GPIO controller.
> -- interrupt-controller: Marks the device node as an interrupt controller.
> -- #interrupt-cells: Should be two. The first cell is the pin number and the
> -  second cell is used to specify irq type flags, see the two cell description
> -  in interrupt-controller/interrupts.txt for details.
> -
> -optional properties:
> -- #gpio-lines: Number of gpio if absent 32.
> -
> -
> -Example:
> -	pioA: gpio@fffff200 {
> -		compatible = "atmel,at91rm9200-gpio";
> -		reg = <0xfffff200 0x100>;
> -		interrupts = <2 4>;
> -		#gpio-cells = <2>;
> -		gpio-controller;
> -		#gpio-lines = <19>;
> -		interrupt-controller;
> -		#interrupt-cells = <2>;
> -	};
> -
> -- 
> 2.25.1
>
Manikandan Muralidharan June 25, 2024, 3:24 a.m. UTC | #3
Hi Rob,

Thank you.
I get these errors after upgrading the dt-schema.I will fix them and 
re-submit the patches.

On 24/06/24 4:54 pm, Rob Herring (Arm) wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Mon, 24 Jun 2024 15:34:30 +0530, Manikandan Muralidharan wrote:
>> Convert the Atmel GPIO controller binding document to DT schema format
>> using json-schema.
>>
>> Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
>> ---
>>   .../bindings/gpio/atmel,at91rm9200-gpio.yaml  | 78 +++++++++++++++++++
>>   .../devicetree/bindings/gpio/gpio_atmel.txt   | 31 --------
>>   2 files changed, 78 insertions(+), 31 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
>>   delete mode 100644 Documentation/devicetree/bindings/gpio/gpio_atmel.txt
>>
> 
> My bot found errors running 'make dt_binding_check' on your patch:
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.example.dtb: gpio@fffff400: compatible: 'oneOf' conditional failed, one must be fixed:
>          ['atmel,at91rm9200-gpio'] is too short
>          'atmel,at91rm9200-gpio' is not one of ['atmel,at91sam9x5-gpio', 'microchip,sam9x60-gpio']
>          'atmel,at91rm9200-gpio' is not one of ['microchip,sam9x7-gpio']
>          from schema $id: http://devicetree.org/schemas/gpio/atmel,at91rm9200-gpio.yaml#
> 
> doc reference errors (make refcheckdocs):
> 
> See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240624100431.191172-5-manikandan.m@microchip.com
> 
> The base for the series is generally the latest rc1. A different dependency
> should be noted in *this* patch.
> 
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
> 
> pip3 install dtschema --upgrade
> 
> Please check and re-submit after running the above command yourself. Note
> that DT_SCHEMA_FILES can be set to your schema file to speed up checking
> your schema. However, it must be unset to test all examples with your schema.
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
new file mode 100644
index 000000000000..3ace7ba687fc
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/atmel,at91rm9200-gpio.yaml
@@ -0,0 +1,78 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/atmel,at91rm9200-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip GPIO controller (PIO)
+
+maintainers:
+  - Manikandan Muralidharan <manikandan.m@microchip.com>
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - atmel,at91sam9x5-gpio
+              - microchip,sam9x60-gpio
+          - const: atmel,at91rm9200-gpio
+      - items:
+          - enum:
+              - microchip,sam9x7-gpio
+          - const: microchip,sam9x60-gpio
+          - const: atmel,at91rm9200-gpio
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
+  gpio-controller: true
+  gpio-line-names: true
+
+  "#gpio-cells":
+    const: 2
+
+  clocks:
+    maxItems: 1
+
+  "#gpio-lines":
+    description:
+      Number of gpio, 32 by default if absent
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-controller
+  - "#interrupt-cells"
+  - gpio-controller
+  - "#gpio-cells"
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/at91.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    pioA: gpio@fffff400 {
+            compatible = "atmel,at91rm9200-gpio";
+            reg = <0xfffff400 0x200>;
+            interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>;
+            #gpio-cells = <2>;
+            gpio-controller;
+            interrupt-controller;
+            #interrupt-cells = <2>;
+            clocks = <&pmc PMC_TYPE_PERIPHERAL 2>;
+    };
+...
diff --git a/Documentation/devicetree/bindings/gpio/gpio_atmel.txt b/Documentation/devicetree/bindings/gpio/gpio_atmel.txt
deleted file mode 100644
index 29416f9c3220..000000000000
--- a/Documentation/devicetree/bindings/gpio/gpio_atmel.txt
+++ /dev/null
@@ -1,31 +0,0 @@ 
-* Atmel GPIO controller (PIO)
-
-Required properties:
-- compatible: "atmel,<chip>-gpio", where <chip> is at91rm9200 or at91sam9x5.
-- reg: Should contain GPIO controller registers location and length
-- interrupts: Should be the port interrupt shared by all the pins.
-- #gpio-cells: Should be two.  The first cell is the pin number and
-  the second cell is used to specify optional parameters to declare if the GPIO
-  is active high or low. See gpio.txt.
-- gpio-controller: Marks the device node as a GPIO controller.
-- interrupt-controller: Marks the device node as an interrupt controller.
-- #interrupt-cells: Should be two. The first cell is the pin number and the
-  second cell is used to specify irq type flags, see the two cell description
-  in interrupt-controller/interrupts.txt for details.
-
-optional properties:
-- #gpio-lines: Number of gpio if absent 32.
-
-
-Example:
-	pioA: gpio@fffff200 {
-		compatible = "atmel,at91rm9200-gpio";
-		reg = <0xfffff200 0x100>;
-		interrupts = <2 4>;
-		#gpio-cells = <2>;
-		gpio-controller;
-		#gpio-lines = <19>;
-		interrupt-controller;
-		#interrupt-cells = <2>;
-	};
-