1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/pinctrl/mediatek,mt8186-pinctrl.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: MediaTek MT8186 Pin Controller
8
9maintainers:
10  - Sean Wang <sean.wang@mediatek.com>
11
12description:
13  The MediaTek's MT8186 Pin controller is used to control SoC pins.
14
15properties:
16  compatible:
17    const: mediatek,mt8186-pinctrl
18
19  gpio-controller: true
20
21  '#gpio-cells':
22    description:
23      Number of cells in GPIO specifier. Since the generic GPIO binding is used,
24      the amount of cells must be specified as 2. See the below mentioned gpio
25      binding representation for description of particular cells.
26    const: 2
27
28  gpio-ranges:
29    maxItems: 1
30
31  gpio-line-names: true
32
33  reg:
34    description:
35      Physical address base for GPIO base registers. There are 8 different GPIO
36      physical address base in mt8186.
37    maxItems: 8
38
39  reg-names:
40    description:
41      GPIO base register names.
42    items:
43      - const: iocfg0
44      - const: iocfg_lt
45      - const: iocfg_lm
46      - const: iocfg_lb
47      - const: iocfg_bl
48      - const: iocfg_rb
49      - const: iocfg_rt
50      - const: eint
51
52  interrupt-controller: true
53
54  '#interrupt-cells':
55    const: 2
56
57  interrupts:
58    description: The interrupt outputs to sysirq
59    maxItems: 1
60
61  mediatek,rsel-resistance-in-si-unit:
62    type: boolean
63    description:
64      Identifying i2c pins pull up/down type which is RSEL. It can support RSEL
65      define or si unit value(ohm) to set different resistance.
66
67# PIN CONFIGURATION NODES
68patternProperties:
69  '-pins$':
70    type: object
71    additionalProperties: false
72    patternProperties:
73      '^pins':
74        type: object
75        additionalProperties: false
76        description: |
77          A pinctrl node should contain at least one subnodes representing the
78          pinctrl groups available on the machine. Each subnode will list the
79          pins it needs, and how they should be configured, with regard to muxer
80          configuration, pullups, drive strength, input enable/disable and input
81          schmitt.
82          An example of using macro:
83          pincontroller {
84            /* GPIO0 set as multifunction GPIO0 */
85            gpio-pins {
86              pins {
87                pinmux = <PINMUX_GPIO0__FUNC_GPIO0>;
88              }
89            };
90            /* GPIO128 set as multifunction SDA0 */
91            i2c0-pins {
92              pins {
93                pinmux = <PINMUX_GPIO128__FUNC_SDA0>;
94              }
95            };
96          };
97        $ref: pinmux-node.yaml
98
99        properties:
100          pinmux:
101            description:
102              Integer array, represents gpio pin number and mux setting.
103              Supported pin number and mux varies for different SoCs, and are
104              defined as macros in dt-bindings/pinctrl/<soc>-pinfunc.h directly.
105
106          drive-strength:
107            enum: [2, 4, 6, 8, 10, 12, 14, 16]
108
109          drive-strength-microamp:
110            enum: [125, 250, 500, 1000]
111
112          bias-pull-down:
113            oneOf:
114              - type: boolean
115              - enum: [100, 101, 102, 103]
116                description: mt8186 pull down PUPD/R0/R1 type define value.
117              - enum: [200, 201, 202, 203]
118                description: mt8186 pull down RSEL type define value.
119              - enum: [75000, 5000]
120                description: mt8186 pull down RSEL type si unit value(ohm).
121            description: |
122              For pull down type is normal, it don't need add RSEL & R1R0 define
123              and resistance value.
124              For pull down type is PUPD/R0/R1 type, it can add R1R0 define to
125              set different resistance. It can support "MTK_PUPD_SET_R1R0_00" &
126              "MTK_PUPD_SET_R1R0_01" & "MTK_PUPD_SET_R1R0_10" &
127              "MTK_PUPD_SET_R1R0_11" define in mt8186.
128              For pull down type is RSEL, it can add RSEL define & resistance
129              value(ohm) to set different resistance by identifying property
130              "mediatek,rsel-resistance-in-si-unit".
131              It can support "MTK_PULL_SET_RSEL_000" & "MTK_PULL_SET_RSEL_001" &
132              "MTK_PULL_SET_RSEL_010" & "MTK_PULL_SET_RSEL_011" define in
133              mt8186. It can also support resistance value(ohm) "75000" & "5000"
134              in mt8186.
135              An example of using RSEL define:
136              pincontroller {
137                i2c0_pin {
138                  pins {
139                    pinmux = <PINMUX_GPIO128__FUNC_SDA0>;
140                    bias-pull-down = <MTK_PULL_SET_RSEL_001>;
141                  }
142                };
143              };
144              An example of using si unit resistance value(ohm):
145              &pio {
146                mediatek,rsel-resistance-in-si-unit;
147              }
148              pincontroller {
149                i2c0_pin {
150                  pins {
151                    pinmux = <PINMUX_GPIO128__FUNC_SDA0>;
152                    bias-pull-down = <75000>;
153                  }
154                };
155              };
156
157          bias-pull-up:
158            oneOf:
159              - type: boolean
160              - enum: [100, 101, 102, 103]
161                description: mt8186 pull up PUPD/R0/R1 type define value.
162              - enum: [200, 201, 202, 203]
163                description: mt8186 pull up RSEL type define value.
164              - enum: [1000, 5000, 10000, 75000]
165                description: mt8186 pull up RSEL type si unit value(ohm).
166            description: |
167              For pull up type is normal, it don't need add RSEL & R1R0 define
168              and resistance value.
169              For pull up type is PUPD/R0/R1 type, it can add R1R0 define to
170              set different resistance. It can support "MTK_PUPD_SET_R1R0_00" &
171              "MTK_PUPD_SET_R1R0_01" & "MTK_PUPD_SET_R1R0_10" &
172              "MTK_PUPD_SET_R1R0_11" define in mt8186.
173              For pull up type is RSEL, it can add RSEL define & resistance
174              value(ohm) to set different resistance by identifying property
175              "mediatek,rsel-resistance-in-si-unit".
176              It can support "MTK_PULL_SET_RSEL_000" & "MTK_PULL_SET_RSEL_001" &
177              "MTK_PULL_SET_RSEL_010" & "MTK_PULL_SET_RSEL_011" define in
178              mt8186. It can also support resistance value(ohm) "1000" & "5000"
179              & "10000" & "75000" in mt8186.
180              An example of using si unit resistance value(ohm):
181              &pio {
182                mediatek,rsel-resistance-in-si-unit;
183              }
184              pincontroller {
185                i2c0-pins {
186                  pins {
187                    pinmux = <PINMUX_GPIO128__FUNC_SDA0>;
188                    bias-pull-up = <1000>;
189                  }
190                };
191              };
192
193          bias-disable: true
194
195          output-high: true
196
197          output-low: true
198
199          input-enable: true
200
201          input-disable: true
202
203          input-schmitt-enable: true
204
205          input-schmitt-disable: true
206
207        required:
208          - pinmux
209
210required:
211  - compatible
212  - reg
213  - interrupts
214  - interrupt-controller
215  - '#interrupt-cells'
216  - gpio-controller
217  - '#gpio-cells'
218  - gpio-ranges
219
220additionalProperties: false
221
222examples:
223  - |
224    #include <dt-bindings/pinctrl/mt8186-pinfunc.h>
225    #include <dt-bindings/interrupt-controller/arm-gic.h>
226
227    pio: pinctrl@10005000 {
228      compatible = "mediatek,mt8186-pinctrl";
229      reg = <0x10005000 0x1000>,
230            <0x10002000 0x0200>,
231            <0x10002200 0x0200>,
232            <0x10002400 0x0200>,
233            <0x10002600 0x0200>,
234            <0x10002A00 0x0200>,
235            <0x10002c00 0x0200>,
236            <0x1000b000 0x1000>;
237      reg-names = "iocfg0", "iocfg_lt", "iocfg_lm",
238                  "iocfg_lb", "iocfg_bl", "iocfg_rb",
239                  "iocfg_rt", "eint";
240      gpio-controller;
241      #gpio-cells = <2>;
242      gpio-ranges = <&pio 0 0 185>;
243      interrupt-controller;
244      interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH 0>;
245      #interrupt-cells = <2>;
246
247      pio-pins {
248        pins {
249          pinmux = <PINMUX_GPIO0__FUNC_GPIO0>;
250          output-low;
251        };
252      };
253
254      spi0-pins {
255        pins-spi {
256          pinmux = <PINMUX_GPIO0__FUNC_SPI0_CLK_B>,
257                   <PINMUX_GPIO1__FUNC_SPI0_CSB_B>,
258                   <PINMUX_GPIO2__FUNC_SPI0_MO_B>;
259          bias-disable;
260        };
261        pins-spi-mi {
262          pinmux = <PINMUX_GPIO3__FUNC_SPI0_MI_B>;
263          bias-pull-down;
264        };
265      };
266
267      i2c0-pins {
268        pins {
269          pinmux = <PINMUX_GPIO127__FUNC_SCL0>,
270                   <PINMUX_GPIO128__FUNC_SDA0>;
271          bias-pull-up = <MTK_PULL_SET_RSEL_001>;
272          drive-strength-microamp = <1000>;
273        };
274      };
275    };
276