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