xref: /linux/Documentation/devicetree/bindings/pinctrl/airoha,en7523-pinctrl.yaml (revision cf9610f9116d55c5a66ef9f1faecacabd93a9322)
1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/pinctrl/airoha,en7523-pinctrl.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Airoha EN7523 Pin Controller
8
9maintainers:
10  - Lorenzo Bianconi <lorenzo@kernel.org>
11
12description:
13  The Airoha's EN7523 Pin controller is used to control SoC pins.
14
15properties:
16  compatible:
17    const: airoha,en7523-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-ranges
43  - "#gpio-cells"
44  - interrupt-controller
45  - "#interrupt-cells"
46
47patternProperties:
48  '-pins$':
49    type: object
50
51    patternProperties:
52      '^mux(-|$)':
53        type: object
54
55        description:
56          pinmux configuration nodes.
57
58        $ref: /schemas/pinctrl/pinmux-node.yaml
59
60        properties:
61          function:
62            description:
63              A string containing the name of the function to mux to the group.
64            enum: [pon, tod_1pps, sipo, mdio, uart, i2c, jtag, pcm, spi,
65                   pcm_spi, i2s, gpio, pcie_reset, pwm, phy1_led0,
66                   phy2_led0, phy3_led0, phy4_led0, phy1_led1, phy2_led1,
67                   phy3_led1, phy4_led1]
68
69          groups:
70            description:
71              An array of strings. Each string contains the name of a group.
72
73        required:
74          - function
75          - groups
76
77        allOf:
78          - if:
79              properties:
80                function:
81                  const: pon
82            then:
83              properties:
84                groups:
85                  enum: [pon]
86          - if:
87              properties:
88                function:
89                  const: tod_1pps
90            then:
91              properties:
92                groups:
93                  enum: [pon_tod_1pps, gsw_tod_1pps]
94          - if:
95              properties:
96                function:
97                  const: sipo
98            then:
99              properties:
100                groups:
101                  enum: [sipo, sipo_rclk]
102          - if:
103              properties:
104                function:
105                  const: mdio
106            then:
107              properties:
108                groups:
109                  enum: [mdio]
110          - if:
111              properties:
112                function:
113                  const: uart
114            then:
115              properties:
116                groups:
117                  items:
118                    enum: [uart2, npu_uart]
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: i2s
170            then:
171              properties:
172                groups:
173                  enum: [i2s]
174          - if:
175              properties:
176                function:
177                  const: gpio
178            then:
179              properties:
180                groups:
181                  enum: [gpio28, gpio29]
182          - if:
183              properties:
184                function:
185                  const: pcie_reset
186            then:
187              properties:
188                groups:
189                  enum: [pcie_reset0, pcie_reset1]
190          - if:
191              properties:
192                function:
193                  const: pwm
194            then:
195              properties:
196                groups:
197                  enum: [gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6,
198                         gpio7, gpio8, gpio9, gpio10, gpio11, gpio12, gpio13,
199                         gpio14, gpio15, gpio16, gpio17, gpio18, gpio19,
200                         gpio20, gpio21, gpio22, gpio23, gpio24, gpio25,
201                         gpio26, gpio27, gpio28, gpio29]
202          - if:
203              properties:
204                function:
205                  const: phy1_led0
206            then:
207              properties:
208                groups:
209                  enum: [gpio22, gpio23, gpio24, gpio25]
210          - if:
211              properties:
212                function:
213                  const: phy2_led0
214            then:
215              properties:
216                groups:
217                  enum: [gpio22, gpio23, gpio24, gpio25]
218          - if:
219              properties:
220                function:
221                  const: phy3_led0
222            then:
223              properties:
224                groups:
225                  enum: [gpio22, gpio23, gpio24, gpio25]
226          - if:
227              properties:
228                function:
229                  const: phy4_led0
230            then:
231              properties:
232                groups:
233                  enum: [gpio22, gpio23, gpio24, gpio25]
234          - if:
235              properties:
236                function:
237                  const: phy1_led1
238            then:
239              properties:
240                groups:
241                  enum: [gpio7, gpio6, gpio5, gpio4]
242          - if:
243              properties:
244                function:
245                  const: phy2_led1
246            then:
247              properties:
248                groups:
249                  enum: [gpio7, gpio6, gpio5, gpio4]
250          - if:
251              properties:
252                function:
253                  const: phy3_led1
254            then:
255              properties:
256                groups:
257                  enum: [gpio7, gpio6, gpio5, gpio4]
258          - if:
259              properties:
260                function:
261                  const: phy4_led1
262            then:
263              properties:
264                groups:
265                  enum: [gpio7, gpio6, gpio5, gpio4]
266
267        additionalProperties: false
268
269      '^conf(-|$)':
270        type: object
271
272        description:
273          pinconf configuration nodes.
274
275        $ref: /schemas/pinctrl/pincfg-node.yaml
276
277        properties:
278          pins:
279            description:
280              An array of strings. Each string contains the name of a pin.
281            items:
282              enum: [i2c_sda, i2c_scl, spi_cs0, spi_clk, spi_mosi, spi_miso,
283                     uart1_txd, uart1_rxd, gpio0, gpio1, gpio2, gpio3, gpio4,
284                     gpio5, gpio6, gpio7, gpio8, gpio9, gpio10, gpio11, gpio12,
285                     gpio13, gpio14, gpio15, gpio16, gpio17, gpio18, gpio19,
286                     gpio20, gpio21, gpio22, gpio23, gpio24, gpio25, gpio26,
287                     gpio27, pcie_reset0, pcie_reset1]
288            minItems: 1
289            maxItems: 38
290
291          bias-disable: true
292
293          bias-pull-up: true
294
295          bias-pull-down: true
296
297          input-enable: true
298
299          output-enable: true
300
301          output-low: true
302
303          output-high: true
304
305          drive-open-drain: true
306
307          drive-strength:
308            description:
309              Selects the drive strength for MIO pins, in mA.
310            enum: [2, 4, 6, 8]
311
312        required:
313          - pins
314
315        additionalProperties: false
316
317    additionalProperties: false
318
319additionalProperties: false
320
321examples:
322  - |
323    #include <dt-bindings/interrupt-controller/arm-gic.h>
324
325    pinctrl {
326      compatible = "airoha,en7523-pinctrl";
327
328      interrupt-parent = <&gic>;
329      interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
330
331      gpio-controller;
332      #gpio-cells = <2>;
333
334      interrupt-controller;
335      #interrupt-cells = <2>;
336
337      gpio-ranges = <&pinctrl 0 12 30>;
338
339      pcie1-rst-pins {
340        conf {
341          pins = "pcie_reset1";
342          drive-open-drain = <1>;
343        };
344      };
345
346      pwm-pins {
347        mux {
348          function = "pwm";
349          groups = "gpio18";
350        };
351      };
352
353      spi-pins {
354        mux {
355          function = "spi";
356          groups = "spi_quad", "spi_cs1";
357        };
358      };
359
360      uart2-pins {
361        mux {
362          function = "uart";
363          groups = "uart2";
364        };
365      };
366
367      mdio-pins {
368        mux {
369          function = "mdio";
370          groups = "mdio";
371        };
372
373        conf {
374          pins = "gpio2";
375          output-enable;
376        };
377      };
378    };
379