xref: /linux/Documentation/devicetree/bindings/pinctrl/raspberrypi,rp1-gpio.yaml (revision db4a3f0fbedb0398f77b9047e8b8bb2b49f355bb)
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/pinctrl/raspberrypi,rp1-gpio.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: RaspberryPi RP1 GPIO/Pinconf/Pinmux Controller submodule
8
9maintainers:
10  - A. della Porta <andrea.porta@suse.com>
11
12description:
13  The RP1 chipset is a Multi Function Device containing, among other
14  sub-peripherals, a gpio/pinconf/mux controller whose 54 pins are grouped
15  into 3 banks.
16  It works also as an interrupt controller for those gpios.
17
18properties:
19  compatible:
20    const: raspberrypi,rp1-gpio
21
22  reg:
23    maxItems: 3
24    description: One reg specifier for each one of the 3 pin banks.
25
26  '#gpio-cells':
27    description: The first cell is the pin number and the second cell is used
28      to specify the flags (see include/dt-bindings/gpio/gpio.h).
29    const: 2
30
31  gpio-controller: true
32
33  gpio-ranges:
34    maxItems: 1
35
36  gpio-line-names:
37    maxItems: 54
38
39  interrupts:
40    maxItems: 3
41    description: One interrupt specifier for each one of the 3 pin banks.
42
43  '#interrupt-cells':
44    description:
45      Specifies the Bank number [0, 1, 2] and Flags as defined in
46      include/dt-bindings/interrupt-controller/irq.h.
47    const: 2
48
49  interrupt-controller: true
50
51patternProperties:
52  '-state$':
53    oneOf:
54      - $ref: '#/$defs/raspberrypi-rp1-state'
55      - patternProperties:
56          '-pins$':
57            $ref: '#/$defs/raspberrypi-rp1-state'
58        additionalProperties: false
59
60$defs:
61  raspberrypi-rp1-state:
62    allOf:
63      - $ref: pincfg-node.yaml#
64      - $ref: pinmux-node.yaml#
65
66    description:
67      Pin controller client devices use pin configuration subnodes (children
68      and grandchildren) for desired pin configuration.
69      Client device subnodes use below standard properties.
70
71    properties:
72      pins:
73        description:
74          List of gpio pins affected by the properties specified in this
75          subnode (either this or "groups" must be specified).
76        items:
77          pattern: '^gpio([0-9]|[1-4][0-9]|5[0-3])$'
78
79      groups:
80        description:
81          List of groups affected by the properties specified in this
82          subnode (either this or "pins" must be specified).
83        items:
84          anyOf:
85            - pattern: '^gpio([0-9]|[1-4][0-9]|5[0-3])$'
86            - enum: [ uart0, uart0_ctrl, uart1, uart1_ctrl, uart2, uart2_ctrl,
87                      uart3, uart3_ctrl, uart4, uart4_ctrl, uart5_0,
88                      uart5_0_ctrl, uart5_1, uart5_1_ctrl, uart5_2,
89                      uart5_2_ctrl, uart5_3,
90                      sd0, sd1,
91                      i2s0, i2s0_dual, i2s0_quad, i2s1, i2s1_dual, i2s1_quad,
92                      i2s2_0, i2s2_0_dual, i2s2_1, i2s2_1_dual,
93                      i2c4_0, i2c4_1, i2c4_2, i2c4_3, i2c6_0, i2c6_1, i2c5_0,
94                      i2c5_1, i2c5_2, i2c5_3, i2c0_0, i2c0_1, i2c1_0, i2c1_1,
95                      i2c2_0, i2c2_1, i2c3_0, i2c3_1, i2c3_2,
96                      dpi_16bit, dpi_16bit_cpadhi, dpi_16bit_pad666,
97                      dpi_18bit, dpi_18bit_cpadhi, dpi_24bit,
98                      spi0, spi0_quad, spi1, spi2, spi3, spi4, spi5, spi6_0,
99                      spi6_1, spi7_0, spi7_1, spi8_0, spi8_1,
100                      aaud_0, aaud_1, aaud_2, aaud_3, aaud_4,
101                      vbus0_0, vbus0_1, vbus1, vbus2, vbus3,
102                      mic_0, mic_1, mic_2, mic_3,
103                      ir ]
104
105      function:
106        enum: [ alt0, alt1, alt2, alt3, alt4, gpio, alt6, alt7, alt8, none,
107                aaud, dcd0, dpi, dsi0_te_ext, dsi1_te_ext, dsr0, dtr0, gpclk0,
108                gpclk1, gpclk2, gpclk3, gpclk4, gpclk5, i2c0, i2c1, i2c2, i2c3,
109                i2c4, i2c5, i2c6, i2s0, i2s1, i2s2, ir, mic, pcie_clkreq_n,
110                pio, proc_rio, pwm0, pwm1, ri0, sd0, sd1, spi0, spi1, spi2,
111                spi3, spi4, spi5, spi6, spi7, spi8, uart0, uart1, uart2, uart3,
112                uart4, uart5, vbus0, vbus1, vbus2, vbus3 ]
113
114        description:
115          Specify the alternative function to be configured for the specified
116          pins.
117
118      bias-disable: true
119      bias-pull-down: true
120      bias-pull-up: true
121      input-enable: true
122      input-schmitt-enable: true
123      output-enable: true
124      output-high: true
125      output-low: true
126      slew-rate:
127        description: 0 is slow slew rate, 1 is fast slew rate
128        enum: [ 0, 1 ]
129      drive-strength:
130        enum: [ 2, 4, 8, 12 ]
131
132    required:
133      - function
134
135    oneOf:
136      - required: [ groups ]
137      - required: [ pins ]
138
139    additionalProperties: false
140
141allOf:
142  - $ref: pinctrl.yaml#
143
144required:
145  - reg
146  - compatible
147  - '#gpio-cells'
148  - gpio-controller
149  - interrupts
150  - '#interrupt-cells'
151  - interrupt-controller
152
153unevaluatedProperties: false
154
155examples:
156  - |
157    #include <dt-bindings/interrupt-controller/irq.h>
158
159    rp1 {
160        #address-cells = <2>;
161        #size-cells = <2>;
162
163        rp1_gpio: pinctrl@c0400d0000 {
164            reg = <0xc0 0x400d0000  0x0 0xc000>,
165                  <0xc0 0x400e0000  0x0 0xc000>,
166                  <0xc0 0x400f0000  0x0 0xc000>;
167            compatible = "raspberrypi,rp1-gpio";
168            gpio-controller;
169            #gpio-cells = <2>;
170            interrupt-controller;
171            #interrupt-cells = <2>;
172            interrupts = <0 IRQ_TYPE_LEVEL_HIGH>,
173                         <1 IRQ_TYPE_LEVEL_HIGH>,
174                         <2 IRQ_TYPE_LEVEL_HIGH>;
175            gpio-line-names =
176                   "ID_SDA", // GPIO0
177                   "ID_SCL", // GPIO1
178                   "GPIO2", "GPIO3", "GPIO4", "GPIO5", "GPIO6",
179                   "GPIO7", "GPIO8", "GPIO9", "GPIO10", "GPIO11",
180                   "GPIO12", "GPIO13", "GPIO14", "GPIO15", "GPIO16",
181                   "GPIO17", "GPIO18", "GPIO19", "GPIO20", "GPIO21",
182                   "GPIO22", "GPIO23", "GPIO24", "GPIO25", "GPIO26",
183                   "GPIO27",
184                   "PCIE_RP1_WAKE", // GPIO28
185                   "FAN_TACH", // GPIO29
186                   "HOST_SDA", // GPIO30
187                   "HOST_SCL", // GPIO31
188                   "ETH_RST_N", // GPIO32
189                   "", // GPIO33
190                   "CD0_IO0_MICCLK", // GPIO34
191                   "CD0_IO0_MICDAT0", // GPIO35
192                   "RP1_PCIE_CLKREQ_N", // GPIO36
193                   "", // GPIO37
194                   "CD0_SDA", // GPIO38
195                   "CD0_SCL", // GPIO39
196                   "CD1_SDA", // GPIO40
197                   "CD1_SCL", // GPIO41
198                   "USB_VBUS_EN", // GPIO42
199                   "USB_OC_N", // GPIO43
200                   "RP1_STAT_LED", // GPIO44
201                   "FAN_PWM", // GPIO45
202                   "CD1_IO0_MICCLK", // GPIO46
203                   "2712_WAKE", // GPIO47
204                   "CD1_IO1_MICDAT1", // GPIO48
205                   "EN_MAX_USB_CUR", // GPIO49
206                   "", // GPIO50
207                   "", // GPIO51
208                   "", // GPIO52
209                   ""; // GPIO53
210
211            rp1-i2s0-default-state {
212                function = "i2s0";
213                pins = "gpio18", "gpio19", "gpio20", "gpio21";
214                bias-disable;
215            };
216
217            rp1-uart0-default-state {
218                txd-pins {
219                    function = "uart0";
220                    pins = "gpio14";
221                    bias-disable;
222                };
223
224                rxd-pins {
225                    function = "uart0";
226                    pins = "gpio15";
227                    bias-pull-up;
228                };
229            };
230        };
231    };
232