xref: /freebsd/sys/contrib/device-tree/Bindings/pinctrl/airoha,en7581-pinctrl.yaml (revision 8ccc0d235c226d84112561d453c49904398d085c)
1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/pinctrl/airoha,en7581-pinctrl.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Airoha EN7581 Pin Controller
8
9maintainers:
10  - Lorenzo Bianconi <lorenzo@kernel.org>
11
12description:
13  The Airoha's EN7581 Pin controller is used to control SoC pins.
14
15properties:
16  compatible:
17    const: airoha,en7581-pinctrl
18
19  interrupts:
20    maxItems: 1
21
22  gpio-controller: true
23
24  '#gpio-cells':
25    const: 2
26
27  gpio-ranges:
28    maxItems: 1
29
30  interrupt-controller: true
31
32  '#interrupt-cells':
33    const: 2
34
35allOf:
36  - $ref: pinctrl.yaml#
37
38required:
39  - compatible
40  - interrupts
41  - gpio-controller
42  - "#gpio-cells"
43  - interrupt-controller
44  - "#interrupt-cells"
45
46patternProperties:
47  '-pins$':
48    type: object
49
50    patternProperties:
51      '^mux(-|$)':
52        type: object
53
54        description:
55          pinmux configuration nodes.
56
57        $ref: /schemas/pinctrl/pinmux-node.yaml
58
59        properties:
60          function:
61            description:
62              A string containing the name of the function to mux to the group.
63            enum: [pon, tod_1pps, sipo, mdio, uart, i2c, jtag, pcm, spi,
64                   pcm_spi, i2s, emmc, pnand, pcie_reset, pwm, phy1_led0,
65                   phy2_led0, phy3_led0, phy4_led0, phy1_led1, phy2_led1,
66                   phy3_led1, phy4_led1]
67
68          groups:
69            description:
70              An array of strings. Each string contains the name of a group.
71
72        required:
73          - function
74          - groups
75
76        allOf:
77          - if:
78              properties:
79                function:
80                  const: pon
81            then:
82              properties:
83                groups:
84                  enum: [pon]
85          - if:
86              properties:
87                function:
88                  const: tod_1pps
89            then:
90              properties:
91                groups:
92                  enum: [pon_tod_1pps, gsw_tod_1pps]
93          - if:
94              properties:
95                function:
96                  const: sipo
97            then:
98              properties:
99                groups:
100                  enum: [sipo, sipo_rclk]
101          - if:
102              properties:
103                function:
104                  const: mdio
105            then:
106              properties:
107                groups:
108                  enum: [mdio]
109          - if:
110              properties:
111                function:
112                  const: uart
113            then:
114              properties:
115                groups:
116                  items:
117                    enum: [uart2, uart2_cts_rts, hsuart, hsuart_cts_rts,
118                           uart4, uart5]
119                  maxItems: 2
120          - if:
121              properties:
122                function:
123                  const: i2c
124            then:
125              properties:
126                groups:
127                  enum: [i2c1]
128          - if:
129              properties:
130                function:
131                  const: jtag
132            then:
133              properties:
134                groups:
135                  enum: [jtag_udi, jtag_dfd]
136          - if:
137              properties:
138                function:
139                  const: pcm
140            then:
141              properties:
142                groups:
143                  enum: [pcm1, pcm2]
144          - if:
145              properties:
146                function:
147                  const: spi
148            then:
149              properties:
150                groups:
151                  items:
152                    enum: [spi_quad, spi_cs1]
153                  maxItems: 2
154          - if:
155              properties:
156                function:
157                  const: pcm_spi
158            then:
159              properties:
160                groups:
161                  items:
162                    enum: [pcm_spi, pcm_spi_int, pcm_spi_rst, pcm_spi_cs1,
163                           pcm_spi_cs2_p156, pcm_spi_cs2_p128, pcm_spi_cs3,
164                           pcm_spi_cs4]
165                  maxItems: 7
166          - if:
167              properties:
168                function:
169                  const: i2c
170            then:
171              properties:
172                groups:
173                  enum: [i2s]
174          - if:
175              properties:
176                function:
177                  const: emmc
178            then:
179              properties:
180                groups:
181                  enum: [emmc]
182          - if:
183              properties:
184                function:
185                  const: pnand
186            then:
187              properties:
188                groups:
189                  enum: [pnand]
190          - if:
191              properties:
192                function:
193                  const: pcie_reset
194            then:
195              properties:
196                groups:
197                  enum: [pcie_reset0, pcie_reset1, pcie_reset2]
198          - if:
199              properties:
200                function:
201                  const: pwm
202            then:
203              properties:
204                groups:
205                  enum: [gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6,
206                         gpio7, gpio8, gpio9, gpio10, gpio11, gpio12, gpio13,
207                         gpio14, gpio15, gpio16, gpio17, gpio18, gpio19,
208                         gpio20, gpio21, gpio22, gpio23, gpio24, gpio25,
209                         gpio26, gpio27, gpio28, gpio29, gpio30, gpio31,
210                         gpio36, gpio37, gpio38, gpio39, gpio40, gpio41,
211                         gpio42, gpio43, gpio44, gpio45, gpio46, gpio47]
212          - if:
213              properties:
214                function:
215                  const: phy1_led0
216            then:
217              properties:
218                groups:
219                  enum: [gpio33, gpio34, gpio35, gpio42]
220          - if:
221              properties:
222                function:
223                  const: phy2_led0
224            then:
225              properties:
226                groups:
227                  enum: [gpio33, gpio34, gpio35, gpio42]
228          - if:
229              properties:
230                function:
231                  const: phy3_led0
232            then:
233              properties:
234                groups:
235                  enum: [gpio33, gpio34, gpio35, gpio42]
236          - if:
237              properties:
238                function:
239                  const: phy4_led0
240            then:
241              properties:
242                groups:
243                  enum: [gpio33, gpio34, gpio35, gpio42]
244          - if:
245              properties:
246                function:
247                  const: phy1_led1
248            then:
249              properties:
250                groups:
251                  enum: [gpio43, gpio44, gpio45, gpio46]
252          - if:
253              properties:
254                function:
255                  const: phy2_led1
256            then:
257              properties:
258                groups:
259                  enum: [gpio43, gpio44, gpio45, gpio46]
260          - if:
261              properties:
262                function:
263                  const: phy3_led1
264            then:
265              properties:
266                groups:
267                  enum: [gpio43, gpio44, gpio45, gpio46]
268          - if:
269              properties:
270                function:
271                  const: phy4_led1
272            then:
273              properties:
274                groups:
275                  enum: [gpio43, gpio44, gpio45, gpio46]
276
277        additionalProperties: false
278
279      '^conf(-|$)':
280        type: object
281
282        description:
283          pinconf configuration nodes.
284
285        $ref: /schemas/pinctrl/pincfg-node.yaml
286
287        properties:
288          pins:
289            description:
290              An array of strings. Each string contains the name of a pin.
291            items:
292              enum: [uart1_txd, uart1_rxd, i2c_scl, i2c_sda, spi_cs0, spi_clk,
293                     spi_mosi, spi_miso, gpio0, gpio1, gpio2, gpio3, gpio4,
294                     gpio5, gpio6, gpio7, gpio8, gpio9, gpio10, gpio11, gpio12,
295                     gpio13, gpio14, gpio15, gpio16, gpio17, gpio18, gpio19,
296                     gpio20, gpio21, gpio22, gpio23, gpio24, gpio25, gpio26,
297                     gpio27, gpio28, gpio29, gpio30, gpio31, gpio32, gpio33,
298                     gpio34, gpio35, gpio36, gpio37, gpio38, gpio39, gpio40,
299                     gpio41, gpio42, gpio43, gpio44, gpio45, gpio46,
300                     pcie_reset0, pcie_reset1, pcie_reset2]
301            minItems: 1
302            maxItems: 58
303
304          bias-disable: true
305
306          bias-pull-up: true
307
308          bias-pull-down: true
309
310          input-enable: true
311
312          output-enable: true
313
314          output-low: true
315
316          output-high: true
317
318          drive-open-drain: true
319
320          drive-strength:
321            description:
322              Selects the drive strength for MIO pins, in mA.
323            enum: [2, 4, 6, 8]
324
325        required:
326          - pins
327
328        additionalProperties: false
329
330    additionalProperties: false
331
332additionalProperties: false
333
334examples:
335  - |
336    #include <dt-bindings/interrupt-controller/arm-gic.h>
337
338    pinctrl {
339      compatible = "airoha,en7581-pinctrl";
340
341      interrupt-parent = <&gic>;
342      interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
343
344      gpio-controller;
345      #gpio-cells = <2>;
346
347      interrupt-controller;
348      #interrupt-cells = <2>;
349
350      pcie1-rst-pins {
351        conf {
352          pins = "pcie_reset1";
353          drive-open-drain = <1>;
354        };
355      };
356
357      pwm-pins {
358        mux {
359          function = "pwm";
360          groups = "gpio18";
361        };
362      };
363
364      spi-pins {
365        mux {
366          function = "spi";
367          groups = "spi_quad", "spi_cs1";
368        };
369      };
370
371      uart2-pins {
372        mux {
373          function = "uart";
374          groups = "uart2", "uart2_cts_rts";
375        };
376      };
377
378      uar5-pins {
379        mux {
380          function = "uart";
381          groups = "uart5";
382        };
383      };
384
385      mmc-pins {
386        mux {
387          function = "emmc";
388          groups = "emmc";
389        };
390      };
391
392      mdio-pins {
393        mux {
394          function = "mdio";
395          groups = "mdio";
396        };
397
398        conf {
399          pins = "gpio2";
400          output-enable;
401        };
402      };
403    };
404