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