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