Commit 177f954f authored by Andrew Jeffery's avatar Andrew Jeffery Committed by Bartosz Golaszewski
Browse files

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@1e600000/gpio@1e780000: failed to match any schema with compatible: ['aspeed,ast2400-gpio']
```

Signed-off-by: default avatarAndrew Jeffery <andrew@codeconstruct.com.au>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent 8122c7c6
Loading
Loading
Loading
Loading
+148 −0
Original line number Diff line number Diff line
# 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 <andrew@codeconstruct.com.au>

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@1e780000 {
        compatible = "aspeed,ast2400-gpio";
        reg = <0x1e780000 0x1000>;
        interrupts = <20>;
        interrupt-controller;
        #interrupt-cells = <2>;
        gpio-controller;
        #gpio-cells = <2>;
    };
  - |
    gpio: gpio@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@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@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>;
    };
+0 −39
Original line number Diff line number Diff line
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@1e780000 {
		#gpio-cells = <2>;
		compatible = "aspeed,ast2400-gpio";
		gpio-controller;
		interrupts = <20>;
		reg = <0x1e780000 0x1000>;
		interrupt-controller;
	};