1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/pinctrl/allwinner,sun4i-a10-pinctrl.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Allwinner A10 Pin Controller
8
9maintainers:
10  - Chen-Yu Tsai <wens@csie.org>
11  - Maxime Ripard <mripard@kernel.org>
12
13properties:
14  "#gpio-cells":
15    const: 3
16    description:
17      GPIO consumers must use three arguments, first the number of the
18      bank, then the pin number inside that bank, and finally the GPIO
19      flags.
20
21  "#interrupt-cells":
22    const: 3
23    description:
24      Interrupts consumers must use three arguments, first the number
25      of the bank, then the pin number inside that bank, and finally
26      the interrupts flags.
27
28  compatible:
29    enum:
30      - allwinner,sun4i-a10-pinctrl
31      - allwinner,sun5i-a10s-pinctrl
32      - allwinner,sun5i-a13-pinctrl
33      - allwinner,sun6i-a31-pinctrl
34      - allwinner,sun6i-a31-r-pinctrl
35      - allwinner,sun6i-a31s-pinctrl
36      - allwinner,sun7i-a20-pinctrl
37      - allwinner,sun8i-a23-pinctrl
38      - allwinner,sun8i-a23-r-pinctrl
39      - allwinner,sun8i-a33-pinctrl
40      - allwinner,sun8i-a83t-pinctrl
41      - allwinner,sun8i-a83t-r-pinctrl
42      - allwinner,sun8i-h3-pinctrl
43      - allwinner,sun8i-h3-r-pinctrl
44      - allwinner,sun8i-r40-pinctrl
45      - allwinner,sun8i-v3-pinctrl
46      - allwinner,sun8i-v3s-pinctrl
47      - allwinner,sun9i-a80-pinctrl
48      - allwinner,sun9i-a80-r-pinctrl
49      - allwinner,sun20i-d1-pinctrl
50      - allwinner,sun50i-a64-pinctrl
51      - allwinner,sun50i-a64-r-pinctrl
52      - allwinner,sun50i-a100-pinctrl
53      - allwinner,sun50i-a100-r-pinctrl
54      - allwinner,sun50i-h5-pinctrl
55      - allwinner,sun50i-h6-pinctrl
56      - allwinner,sun50i-h6-r-pinctrl
57      - allwinner,sun50i-h616-pinctrl
58      - allwinner,sun50i-h616-r-pinctrl
59      - allwinner,suniv-f1c100s-pinctrl
60      - nextthing,gr8-pinctrl
61
62  reg:
63    maxItems: 1
64
65  interrupts:
66    minItems: 1
67    maxItems: 8
68    description:
69      One interrupt per external interrupt bank supported on the
70      controller, sorted by bank number ascending order.
71
72  clocks:
73    items:
74      - description: Bus Clock
75      - description: High Frequency Oscillator
76      - description: Low Frequency Oscillator
77
78  clock-names:
79    items:
80      - const: apb
81      - const: hosc
82      - const: losc
83
84  gpio-controller: true
85  interrupt-controller: true
86  gpio-line-names: true
87
88  input-debounce:
89    description:
90      Debouncing periods in microseconds, one period per interrupt
91      bank found in the controller
92    $ref: /schemas/types.yaml#/definitions/uint32-array
93    minItems: 1
94    maxItems: 8
95
96patternProperties:
97  # It's pretty scary, but the basic idea is that:
98  #   - One node name can start with either s- or r- for PRCM nodes,
99  #   - Then, the name itself can be any repetition of <string>- (to
100  #     accomodate with nodes like uart4-rts-cts-pins), where each
101  #     string can be either starting with 'p' but in a string longer
102  #     than 3, or something that doesn't start with 'p',
103  #   - Then, the bank name is optional and will be between pa and pg,
104  #     pl or pm. Some pins groups that have several options will have
105  #     the pin numbers then,
106  #   - Finally, the name will end with either -pin or pins.
107
108  "^([rs]-)?(([a-z0-9]{3,}|[a-oq-z][a-z0-9]*?)?-)+?(p[a-ilm][0-9]*?-)??pins?$":
109    type: object
110
111    properties:
112      pins: true
113      function: true
114      bias-disable: true
115      bias-pull-up: true
116      bias-pull-down: true
117
118      drive-strength:
119        $ref: /schemas/types.yaml#/definitions/uint32
120        enum: [10, 20, 30, 40]
121
122    required:
123      - pins
124      - function
125
126    additionalProperties: false
127
128  "^vcc-p[a-ilm]-supply$":
129    description:
130      Power supplies for pin banks.
131
132required:
133  - "#gpio-cells"
134  - compatible
135  - reg
136  - clocks
137  - clock-names
138  - gpio-controller
139
140allOf:
141  # FIXME: We should have the pin bank supplies here, but not a lot of
142  # boards are defining it at the moment so it would generate a lot of
143  # warnings.
144
145  - $ref: "pinctrl.yaml#"
146  - if:
147      not:
148        properties:
149          compatible:
150            enum:
151              - allwinner,sun50i-h616-r-pinctrl
152
153    then:
154      required:
155        - "#interrupt-cells"
156        - interrupts
157        - interrupt-controller
158
159  - if:
160      properties:
161        compatible:
162          enum:
163            - allwinner,sun50i-h616-pinctrl
164
165    then:
166      properties:
167        interrupts:
168          minItems: 8
169
170  - if:
171      properties:
172        compatible:
173          enum:
174            - allwinner,sun50i-a100-pinctrl
175
176    then:
177      properties:
178        interrupts:
179          minItems: 7
180          maxItems: 7
181
182  - if:
183      properties:
184        compatible:
185          enum:
186            - allwinner,sun20i-d1-pinctrl
187
188    then:
189      properties:
190        interrupts:
191          minItems: 6
192          maxItems: 6
193
194  - if:
195      properties:
196        compatible:
197          enum:
198            - allwinner,sun9i-a80-pinctrl
199
200    then:
201      properties:
202        interrupts:
203          minItems: 5
204          maxItems: 5
205
206  - if:
207      properties:
208        compatible:
209          enum:
210            - allwinner,sun6i-a31-pinctrl
211            - allwinner,sun6i-a31s-pinctrl
212            - allwinner,sun50i-h6-pinctrl
213
214    then:
215      properties:
216        interrupts:
217          minItems: 4
218          maxItems: 4
219
220  - if:
221      properties:
222        compatible:
223          enum:
224            - allwinner,sun8i-a23-pinctrl
225            - allwinner,sun8i-a83t-pinctrl
226            - allwinner,sun50i-a64-pinctrl
227            - allwinner,sun50i-h5-pinctrl
228            - allwinner,suniv-f1c100s-pinctrl
229
230    then:
231      properties:
232        interrupts:
233          minItems: 3
234          maxItems: 3
235
236  - if:
237      properties:
238        compatible:
239          enum:
240            - allwinner,sun6i-a31-r-pinctrl
241            - allwinner,sun8i-a33-pinctrl
242            - allwinner,sun8i-h3-pinctrl
243            - allwinner,sun8i-v3-pinctrl
244            - allwinner,sun8i-v3s-pinctrl
245            - allwinner,sun9i-a80-r-pinctrl
246            - allwinner,sun50i-h6-r-pinctrl
247
248    then:
249      properties:
250        interrupts:
251          minItems: 2
252          maxItems: 2
253
254  - if:
255      properties:
256        compatible:
257          enum:
258            - allwinner,sun4i-a10-pinctrl
259            - allwinner,sun5i-a10s-pinctrl
260            - allwinner,sun5i-a13-pinctrl
261            - allwinner,sun7i-a20-pinctrl
262            - allwinner,sun8i-a23-r-pinctrl
263            - allwinner,sun8i-a83t-r-pinctrl
264            - allwinner,sun8i-h3-r-pinctrl
265            - allwinner,sun8i-r40-pinctrl
266            - allwinner,sun50i-a64-r-pinctrl
267            - allwinner,sun50i-a100-r-pinctrl
268            - nextthing,gr8-pinctrl
269
270    then:
271      properties:
272        interrupts:
273          minItems: 1
274          maxItems: 1
275
276additionalProperties: false
277
278examples:
279  - |
280    #include <dt-bindings/clock/sun5i-ccu.h>
281
282    pio: pinctrl@1c20800 {
283        compatible = "allwinner,sun5i-a13-pinctrl";
284        reg = <0x01c20800 0x400>;
285        interrupts = <28>;
286        clocks = <&ccu CLK_APB0_PIO>, <&osc24M>, <&osc32k>;
287        clock-names = "apb", "hosc", "losc";
288        gpio-controller;
289        interrupt-controller;
290        #interrupt-cells = <3>;
291        #gpio-cells = <3>;
292
293        uart1_pe_pins: uart1-pe-pins {
294            pins = "PE10", "PE11";
295            function = "uart1";
296        };
297
298        uart1_pg_pins: uart1-pg-pins {
299            pins = "PG3", "PG4";
300            function = "uart1";
301        };
302    };
303