1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/pinctrl/mediatek,mt76x8-pinctrl.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: MediaTek MT76X8 Pin Controller
8
9maintainers:
10  - Arınç ÜNAL <arinc.unal@arinc9.com>
11  - Sergio Paracuellos <sergio.paracuellos@gmail.com>
12
13description: |
14  MediaTek MT76X8 pin controller for MT7628 and MT7688 SoCs.
15  The pin controller can only set the muxing of pin groups. Muxing individual
16  pins is not supported. There is no pinconf support.
17
18properties:
19  compatible:
20    const: ralink,mt76x8-pinctrl
21
22patternProperties:
23  '-pins$':
24    type: object
25    additionalProperties: false
26
27    patternProperties:
28      '^(.*-)?pinmux$':
29        type: object
30        description: node for pinctrl.
31        $ref: pinmux-node.yaml#
32        additionalProperties: false
33
34        properties:
35          function:
36            description:
37              A string containing the name of the function to mux to the group.
38            enum: [antenna, debug, gpio, i2c, i2s, jtag, p0led_an, p0led_kn,
39                   p1led_an, p1led_kn, p2led_an, p2led_kn, p3led_an, p3led_kn,
40                   p4led_an, p4led_kn, pcie, pcm, perst, pwm, pwm0, pwm1,
41                   pwm_uart2, refclk, rsvd, sdxc, sdxc d5 d4, sdxc d6, sdxc d7,
42                   spi, spi cs1, spis, sw_r, uart0, uart1, uart2, utif, wdt,
43                   wled_an, wled_kn, -]
44
45          groups:
46            description:
47              An array of strings. Each string contains the name of a group.
48            maxItems: 1
49
50        required:
51          - groups
52          - function
53
54        allOf:
55          - if:
56              properties:
57                function:
58                  const: antenna
59            then:
60              properties:
61                groups:
62                  enum: [i2s]
63
64          - if:
65              properties:
66                function:
67                  const: debug
68            then:
69              properties:
70                groups:
71                  enum: [i2c]
72
73          - if:
74              properties:
75                function:
76                  const: gpio
77            then:
78              properties:
79                groups:
80                  enum: [gpio, i2c, i2s, p0led_an, p0led_kn, p1led_an, p1led_kn,
81                         p2led_an, p2led_kn, p3led_an, p3led_kn, p4led_an,
82                         p4led_kn, perst, pwm0, pwm1, refclk, sdmode, spi,
83                         spi cs1, spis, uart0, uart1, uart2, wdt, wled_an,
84                         wled_kn]
85
86          - if:
87              properties:
88                function:
89                  const: i2c
90            then:
91              properties:
92                groups:
93                  enum: [i2c]
94
95          - if:
96              properties:
97                function:
98                  const: i2s
99            then:
100              properties:
101                groups:
102                  enum: [i2s]
103
104          - if:
105              properties:
106                function:
107                  const: jtag
108            then:
109              properties:
110                groups:
111                  enum: [p0led_an, p0led_kn, p1led_an, p1led_kn, p2led_an,
112                         p2led_kn, p3led_an, p3led_kn, p4led_an, p4led_kn,
113                         sdmode]
114
115          - if:
116              properties:
117                function:
118                  const: p0led_an
119            then:
120              properties:
121                groups:
122                  enum: [p0led_an]
123
124          - if:
125              properties:
126                function:
127                  const: p0led_kn
128            then:
129              properties:
130                groups:
131                  enum: [p0led_kn]
132
133          - if:
134              properties:
135                function:
136                  const: p1led_an
137            then:
138              properties:
139                groups:
140                  enum: [p1led_an]
141
142          - if:
143              properties:
144                function:
145                  const: p1led_kn
146            then:
147              properties:
148                groups:
149                  enum: [p1led_kn]
150
151          - if:
152              properties:
153                function:
154                  const: p2led_an
155            then:
156              properties:
157                groups:
158                  enum: [p2led_an]
159
160          - if:
161              properties:
162                function:
163                  const: p2led_kn
164            then:
165              properties:
166                groups:
167                  enum: [p2led_kn]
168
169          - if:
170              properties:
171                function:
172                  const: p3led_an
173            then:
174              properties:
175                groups:
176                  enum: [p3led_an]
177
178          - if:
179              properties:
180                function:
181                  const: p3led_kn
182            then:
183              properties:
184                groups:
185                  enum: [p3led_kn]
186
187          - if:
188              properties:
189                function:
190                  const: p4led_an
191            then:
192              properties:
193                groups:
194                  enum: [p4led_an]
195
196          - if:
197              properties:
198                function:
199                  const: p4led_kn
200            then:
201              properties:
202                groups:
203                  enum: [p4led_kn]
204
205          - if:
206              properties:
207                function:
208                  const: pcie
209            then:
210              properties:
211                groups:
212                  enum: [gpio]
213
214          - if:
215              properties:
216                function:
217                  const: pcm
218            then:
219              properties:
220                groups:
221                  enum: [i2s]
222
223          - if:
224              properties:
225                function:
226                  const: perst
227            then:
228              properties:
229                groups:
230                  enum: [perst]
231
232          - if:
233              properties:
234                function:
235                  const: pwm
236            then:
237              properties:
238                groups:
239                  enum: [uart1, uart2]
240
241          - if:
242              properties:
243                function:
244                  const: pwm0
245            then:
246              properties:
247                groups:
248                  enum: [pwm0]
249
250          - if:
251              properties:
252                function:
253                  const: pwm1
254            then:
255              properties:
256                groups:
257                  enum: [pwm1]
258
259          - if:
260              properties:
261                function:
262                  const: pwm_uart2
263            then:
264              properties:
265                groups:
266                  enum: [spis]
267
268          - if:
269              properties:
270                function:
271                  const: refclk
272            then:
273              properties:
274                groups:
275                  enum: [gpio, refclk, spi cs1]
276
277          - if:
278              properties:
279                function:
280                  const: rsvd
281            then:
282              properties:
283                groups:
284                  enum: [p0led_an, p0led_kn, wled_an, wled_kn]
285
286          - if:
287              properties:
288                function:
289                  const: sdxc
290            then:
291              properties:
292                groups:
293                  enum: [sdmode]
294
295          - if:
296              properties:
297                function:
298                  const: sdxc d5 d4
299            then:
300              properties:
301                groups:
302                  enum: [uart2]
303
304          - if:
305              properties:
306                function:
307                  const: sdxc d6
308            then:
309              properties:
310                groups:
311                  enum: [pwm1]
312
313          - if:
314              properties:
315                function:
316                  const: sdxc d7
317            then:
318              properties:
319                groups:
320                  enum: [pwm0]
321
322          - if:
323              properties:
324                function:
325                  const: spi
326            then:
327              properties:
328                groups:
329                  enum: [spi]
330
331          - if:
332              properties:
333                function:
334                  const: spi cs1
335            then:
336              properties:
337                groups:
338                  enum: [spi cs1]
339
340          - if:
341              properties:
342                function:
343                  const: spis
344            then:
345              properties:
346                groups:
347                  enum: [spis]
348
349          - if:
350              properties:
351                function:
352                  const: sw_r
353            then:
354              properties:
355                groups:
356                  enum: [uart1]
357
358          - if:
359              properties:
360                function:
361                  const: uart0
362            then:
363              properties:
364                groups:
365                  enum: [uart0]
366
367          - if:
368              properties:
369                function:
370                  const: uart1
371            then:
372              properties:
373                groups:
374                  enum: [uart1]
375
376          - if:
377              properties:
378                function:
379                  const: uart2
380            then:
381              properties:
382                groups:
383                  enum: [uart2]
384
385          - if:
386              properties:
387                function:
388                  const: utif
389            then:
390              properties:
391                groups:
392                  enum: [p1led_an, p1led_kn, p2led_an, p2led_kn, p3led_an,
393                         p3led_kn, p4led_an, p4led_kn, pwm0, pwm1, sdmode, spis]
394
395          - if:
396              properties:
397                function:
398                  const: wdt
399            then:
400              properties:
401                groups:
402                  enum: [wdt]
403
404          - if:
405              properties:
406                function:
407                  const: wled_an
408            then:
409              properties:
410                groups:
411                  enum: [wled_an]
412
413          - if:
414              properties:
415                function:
416                  const: wled_kn
417            then:
418              properties:
419                groups:
420                  enum: [wled_kn]
421
422          - if:
423              properties:
424                function:
425                  const: "-"
426            then:
427              properties:
428                groups:
429                  enum: [i2c, spi cs1, uart0]
430
431allOf:
432  - $ref: pinctrl.yaml#
433
434required:
435  - compatible
436
437additionalProperties: false
438
439examples:
440  - |
441    pinctrl {
442      compatible = "ralink,mt76x8-pinctrl";
443
444      i2c_pins: i2c0-pins {
445        pinmux {
446          groups = "i2c";
447          function = "i2c";
448        };
449      };
450    };
451