1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/pinctrl/ralink,mt7620-pinctrl.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Ralink MT7620 Pin Controller
8
9maintainers:
10  - Arınç ÜNAL <arinc.unal@arinc9.com>
11  - Sergio Paracuellos <sergio.paracuellos@gmail.com>
12
13description:
14  Ralink MT7620 pin controller for MT7620, 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,mt7620-pinctrl
21
22patternProperties:
23  '-pins$':
24    type: object
25    patternProperties:
26      '^(.*-)?pinmux$':
27        type: object
28        description: node for pinctrl.
29        $ref: pinmux-node.yaml#
30
31        properties:
32          function:
33            description:
34              A string containing the name of the function to mux to the group.
35            anyOf:
36              - description: For MT7620 SoC
37                enum: [ephy, gpio, gpio i2s, gpio uartf, i2c, i2s uartf, mdio, nand, pa,
38                       pcie refclk, pcie rst, pcm gpio, pcm i2s, pcm uartf, refclk,
39                       rgmii1, rgmii2, sd, spi, spi refclk, uartf, uartlite, wdt refclk,
40                       wdt rst, wled]
41
42              - description: For MT7628 and MT7688 SoCs
43                enum: [antenna, debug, gpio, i2c, i2s, jtag, p0led_an, p0led_kn,
44                       p1led_an, p1led_kn, p2led_an, p2led_kn, p3led_an, p3led_kn,
45                       p4led_an, p4led_kn, pcie, pcm, perst, pwm, pwm0, pwm1, pwm_uart2,
46                       refclk, rsvd, sdxc, sdxc d5 d4, sdxc d6, sdxc d7, spi, spi cs1,
47                       spis, sw_r, uart0, uart1, uart2, utif, wdt, wled_an, wled_kn, -]
48
49          groups:
50            description:
51              An array of strings. Each string contains the name of a group.
52            maxItems: 1
53
54        required:
55          - groups
56          - function
57
58        allOf:
59          - if:
60              properties:
61                function:
62                  const: antenna
63            then:
64              properties:
65                groups:
66                  enum: [i2s]
67
68          - if:
69              properties:
70                function:
71                  const: debug
72            then:
73              properties:
74                groups:
75                  enum: [i2c]
76
77          - if:
78              properties:
79                function:
80                  const: ephy
81            then:
82              properties:
83                groups:
84                  enum: [ephy]
85
86          - if:
87              properties:
88                function:
89                  const: gpio
90            then:
91              properties:
92                groups:
93                  anyOf:
94                    - description: For MT7620 SoC
95                      enum: [ephy, i2c, mdio, nd_sd, pa, pcie, rgmii1, rgmii2,
96                             spi, spi refclk, uartf, uartlite, wdt, wled]
97
98                    - description: For MT7628 and MT7688 SoCs
99                      enum: [gpio, i2c, i2s, p0led_an, p0led_kn, p1led_an,
100                             p1led_kn, p2led_an, p2led_kn, p3led_an, p3led_kn,
101                             p4led_an, p4led_kn, perst, pwm0, pwm1, refclk,
102                             sdmode, spi, spi cs1, spis, uart0, uart1, uart2,
103                             wdt, wled_an, wled_kn]
104
105          - if:
106              properties:
107                function:
108                  const: gpio i2s
109            then:
110              properties:
111                groups:
112                  enum: [uartf]
113
114          - if:
115              properties:
116                function:
117                  const: gpio uartf
118            then:
119              properties:
120                groups:
121                  enum: [uartf]
122
123          - if:
124              properties:
125                function:
126                  const: i2c
127            then:
128              properties:
129                groups:
130                  enum: [i2c]
131
132          - if:
133              properties:
134                function:
135                  const: i2s
136            then:
137              properties:
138                groups:
139                  enum: [i2s]
140
141          - if:
142              properties:
143                function:
144                  const: i2s uartf
145            then:
146              properties:
147                groups:
148                  enum: [uartf]
149
150          - if:
151              properties:
152                function:
153                  const: jtag
154            then:
155              properties:
156                groups:
157                  enum: [p0led_an, p0led_kn, p1led_an, p1led_kn, p2led_an,
158                         p2led_kn, p3led_an, p3led_kn, p4led_an, p4led_kn,
159                         sdmode]
160
161          - if:
162              properties:
163                function:
164                  const: mdio
165            then:
166              properties:
167                groups:
168                  enum: [mdio]
169
170          - if:
171              properties:
172                function:
173                  const: nand
174            then:
175              properties:
176                groups:
177                  enum: [nd_sd]
178
179          - if:
180              properties:
181                function:
182                  const: p0led_an
183            then:
184              properties:
185                groups:
186                  enum: [p0led_an]
187
188          - if:
189              properties:
190                function:
191                  const: p0led_kn
192            then:
193              properties:
194                groups:
195                  enum: [p0led_kn]
196
197          - if:
198              properties:
199                function:
200                  const: p1led_an
201            then:
202              properties:
203                groups:
204                  enum: [p1led_an]
205
206          - if:
207              properties:
208                function:
209                  const: p1led_kn
210            then:
211              properties:
212                groups:
213                  enum: [p1led_kn]
214
215          - if:
216              properties:
217                function:
218                  const: p2led_an
219            then:
220              properties:
221                groups:
222                  enum: [p2led_an]
223
224          - if:
225              properties:
226                function:
227                  const: p2led_kn
228            then:
229              properties:
230                groups:
231                  enum: [p2led_kn]
232
233          - if:
234              properties:
235                function:
236                  const: p3led_an
237            then:
238              properties:
239                groups:
240                  enum: [p3led_an]
241
242          - if:
243              properties:
244                function:
245                  const: p3led_kn
246            then:
247              properties:
248                groups:
249                  enum: [p3led_kn]
250
251          - if:
252              properties:
253                function:
254                  const: p4led_an
255            then:
256              properties:
257                groups:
258                  enum: [p4led_an]
259
260          - if:
261              properties:
262                function:
263                  const: p4led_kn
264            then:
265              properties:
266                groups:
267                  enum: [p4led_kn]
268
269          - if:
270              properties:
271                function:
272                  const: pa
273            then:
274              properties:
275                groups:
276                  enum: [pa]
277
278          - if:
279              properties:
280                function:
281                  const: pcie
282            then:
283              properties:
284                groups:
285                  enum: [gpio]
286
287          - if:
288              properties:
289                function:
290                  const: pcie refclk
291            then:
292              properties:
293                groups:
294                  enum: [pcie]
295
296          - if:
297              properties:
298                function:
299                  const: pcie rst
300            then:
301              properties:
302                groups:
303                  enum: [pcie]
304
305          - if:
306              properties:
307                function:
308                  const: pcm
309            then:
310              properties:
311                groups:
312                  enum: [i2s]
313
314          - if:
315              properties:
316                function:
317                  const: pcm gpio
318            then:
319              properties:
320                groups:
321                  enum: [uartf]
322
323          - if:
324              properties:
325                function:
326                  const: pcm i2s
327            then:
328              properties:
329                groups:
330                  enum: [uartf]
331
332          - if:
333              properties:
334                function:
335                  const: pcm uartf
336            then:
337              properties:
338                groups:
339                  enum: [uartf]
340
341          - if:
342              properties:
343                function:
344                  const: perst
345            then:
346              properties:
347                groups:
348                  enum: [perst]
349
350          - if:
351              properties:
352                function:
353                  const: pwm
354            then:
355              properties:
356                groups:
357                  enum: [uart1, uart2]
358
359          - if:
360              properties:
361                function:
362                  const: pwm0
363            then:
364              properties:
365                groups:
366                  enum: [pwm0]
367
368          - if:
369              properties:
370                function:
371                  const: pwm1
372            then:
373              properties:
374                groups:
375                  enum: [pwm1]
376
377          - if:
378              properties:
379                function:
380                  const: pwm_uart2
381            then:
382              properties:
383                groups:
384                  enum: [spis]
385
386          - if:
387              properties:
388                function:
389                  const: refclk
390            then:
391              properties:
392                groups:
393                  anyOf:
394                    - description: For MT7620 SoC
395                      enum: [mdio]
396
397                    - description: For MT7628 and MT7688 SoCs
398                      enum: [gpio, refclk, spi cs1]
399
400          - if:
401              properties:
402                function:
403                  const: rgmii1
404            then:
405              properties:
406                groups:
407                  enum: [rgmii1]
408
409          - if:
410              properties:
411                function:
412                  const: rgmii2
413            then:
414              properties:
415                groups:
416                  enum: [rgmii2]
417
418          - if:
419              properties:
420                function:
421                  const: rsvd
422            then:
423              properties:
424                groups:
425                  enum: [p0led_an, p0led_kn, wled_an, wled_kn]
426
427          - if:
428              properties:
429                function:
430                  const: sd
431            then:
432              properties:
433                groups:
434                  enum: [nd_sd]
435
436          - if:
437              properties:
438                function:
439                  const: sdxc
440            then:
441              properties:
442                groups:
443                  enum: [sdmode]
444
445          - if:
446              properties:
447                function:
448                  const: sdxc d5 d4
449            then:
450              properties:
451                groups:
452                  enum: [uart2]
453
454          - if:
455              properties:
456                function:
457                  const: sdxc d6
458            then:
459              properties:
460                groups:
461                  enum: [pwm1]
462
463          - if:
464              properties:
465                function:
466                  const: sdxc d7
467            then:
468              properties:
469                groups:
470                  enum: [pwm0]
471
472          - if:
473              properties:
474                function:
475                  const: spi
476            then:
477              properties:
478                groups:
479                  enum: [spi]
480
481          - if:
482              properties:
483                function:
484                  const: spi cs1
485            then:
486              properties:
487                groups:
488                  enum: [spi cs1]
489
490          - if:
491              properties:
492                function:
493                  const: spi refclk
494            then:
495              properties:
496                groups:
497                  enum: [spi refclk]
498
499          - if:
500              properties:
501                function:
502                  const: spis
503            then:
504              properties:
505                groups:
506                  enum: [spis]
507
508          - if:
509              properties:
510                function:
511                  const: sw_r
512            then:
513              properties:
514                groups:
515                  enum: [uart1]
516
517          - if:
518              properties:
519                function:
520                  const: uart0
521            then:
522              properties:
523                groups:
524                  enum: [uart0]
525
526          - if:
527              properties:
528                function:
529                  const: uart1
530            then:
531              properties:
532                groups:
533                  enum: [uart1]
534
535          - if:
536              properties:
537                function:
538                  const: uart2
539            then:
540              properties:
541                groups:
542                  enum: [uart2]
543
544          - if:
545              properties:
546                function:
547                  const: uartf
548            then:
549              properties:
550                groups:
551                  enum: [uartf]
552
553          - if:
554              properties:
555                function:
556                  const: uartlite
557            then:
558              properties:
559                groups:
560                  enum: [uartlite]
561
562          - if:
563              properties:
564                function:
565                  const: utif
566            then:
567              properties:
568                groups:
569                  enum: [p1led_an, p1led_kn, p2led_an, p2led_kn, p3led_an,
570                         p3led_kn, p4led_an, p4led_kn, pwm0, pwm1, sdmode, spis]
571
572          - if:
573              properties:
574                function:
575                  const: wdt
576            then:
577              properties:
578                groups:
579                  enum: [wdt]
580
581          - if:
582              properties:
583                function:
584                  const: wdt refclk
585            then:
586              properties:
587                groups:
588                  enum: [wdt]
589
590          - if:
591              properties:
592                function:
593                  const: wdt rst
594            then:
595              properties:
596                groups:
597                  enum: [wdt]
598
599          - if:
600              properties:
601                function:
602                  const: wled
603            then:
604              properties:
605                groups:
606                  enum: [wled]
607
608          - if:
609              properties:
610                function:
611                  const: wled_an
612            then:
613              properties:
614                groups:
615                  enum: [wled_an]
616
617          - if:
618              properties:
619                function:
620                  const: wled_kn
621            then:
622              properties:
623                groups:
624                  enum: [wled_kn]
625
626          - if:
627              properties:
628                function:
629                  const: "-"
630            then:
631              properties:
632                groups:
633                  enum: [i2c, spi cs1, uart0]
634
635        additionalProperties: false
636
637    additionalProperties: false
638
639allOf:
640  - $ref: "pinctrl.yaml#"
641
642required:
643  - compatible
644
645additionalProperties: false
646
647examples:
648  - |
649    pinctrl {
650      compatible = "ralink,mt7620-pinctrl";
651
652      i2c_pins: i2c0-pins {
653        pinmux {
654          groups = "i2c";
655          function = "i2c";
656        };
657      };
658    };
659