linux/Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml

# 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@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>;
    };