1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/gpio/aspeed,ast2400-gpio.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Aspeed GPIO controller
8
9maintainers:
10  - Andrew Jeffery <andrew@codeconstruct.com.au>
11
12properties:
13  compatible:
14    enum:
15      - aspeed,ast2400-gpio
16      - aspeed,ast2500-gpio
17      - aspeed,ast2600-gpio
18      - aspeed,ast2700-gpio
19
20  reg:
21    maxItems: 1
22
23  clocks:
24    maxItems: 1
25    description: The clock to use for debounce timings
26
27  gpio-controller: true
28  gpio-line-names:
29    minItems: 12
30    maxItems: 232
31
32  gpio-ranges: true
33
34  "#gpio-cells":
35    const: 2
36
37  interrupts:
38    maxItems: 1
39
40  interrupt-controller: true
41
42  "#interrupt-cells":
43    const: 2
44
45  ngpios:
46    minimum: 12
47    maximum: 232
48
49patternProperties:
50  "-hog(-[0-9]+)?$":
51    type: object
52    required:
53      - gpio-hog
54
55required:
56  - compatible
57  - reg
58  - interrupts
59  - interrupt-controller
60  - "#interrupt-cells"
61  - gpio-controller
62  - "#gpio-cells"
63
64allOf:
65  - if:
66      properties:
67        compatible:
68          contains:
69            const: aspeed,ast2400-gpio
70    then:
71      properties:
72        gpio-line-names:
73          minItems: 220
74          maxItems: 220
75        ngpios:
76          const: 220
77  - if:
78      properties:
79        compatible:
80          contains:
81            const: aspeed,ast2500-gpio
82    then:
83      properties:
84        gpio-line-names:
85          minItems: 232
86          maxItems: 232
87        ngpios:
88          const: 232
89  - if:
90      properties:
91        compatible:
92          contains:
93            const: aspeed,ast2600-gpio
94    then:
95      properties:
96        gpio-line-names:
97          minItems: 36
98          maxItems: 208
99        ngpios:
100          enum: [ 36, 208 ]
101      required:
102        - ngpios
103  - if:
104      properties:
105        compatible:
106          contains:
107            const: aspeed,ast2700-gpio
108    then:
109      properties:
110        gpio-line-names:
111          minItems: 12
112          maxItems: 216
113        ngpios:
114          enum: [ 12, 216 ]
115      required:
116        - ngpios
117
118additionalProperties: false
119
120examples:
121  - |
122    gpio@1e780000 {
123        compatible = "aspeed,ast2400-gpio";
124        reg = <0x1e780000 0x1000>;
125        interrupts = <20>;
126        interrupt-controller;
127        #interrupt-cells = <2>;
128        gpio-controller;
129        #gpio-cells = <2>;
130    };
131  - |
132    gpio: gpio@1e780000 {
133        compatible = "aspeed,ast2500-gpio";
134        reg = <0x1e780000 0x200>;
135        interrupts = <20>;
136        interrupt-controller;
137        #interrupt-cells = <2>;
138        gpio-controller;
139        #gpio-cells = <2>;
140        gpio-ranges = <&pinctrl 0 0 232>;
141    };
142  - |
143    #include <dt-bindings/clock/ast2600-clock.h>
144    #include <dt-bindings/interrupt-controller/arm-gic.h>
145    #include <dt-bindings/interrupt-controller/irq.h>
146    gpio0: gpio@1e780000 {
147        compatible = "aspeed,ast2600-gpio";
148        reg = <0x1e780000 0x400>;
149        clocks = <&syscon ASPEED_CLK_APB2>;
150        interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
151        interrupt-controller;
152        #interrupt-cells = <2>;
153        #gpio-cells = <2>;
154        gpio-controller;
155        gpio-ranges = <&pinctrl 0 0 208>;
156        ngpios = <208>;
157    };
158    gpio1: gpio@1e780800 {
159        compatible = "aspeed,ast2600-gpio";
160        reg = <0x1e780800 0x800>;
161        clocks = <&syscon ASPEED_CLK_APB1>;
162        interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
163        interrupt-controller;
164        #interrupt-cells = <2>;
165        gpio-controller;
166        #gpio-cells = <2>;
167        gpio-ranges = <&pinctrl 0 208 36>;
168        ngpios = <36>;
169    };
170