xref: /freebsd/sys/contrib/device-tree/Bindings/pinctrl/pinctrl-mt8186.yaml (revision 7ef62cebc2f965b0f640263e179276928885e33d)
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  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
65      RSEL 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
81          input 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
105              directly.
106
107          drive-strength:
108            enum: [2, 4, 6, 8, 10, 12, 14, 16]
109
110          drive-strength-microamp:
111            enum: [125, 250, 500, 1000]
112
113          bias-pull-down:
114            oneOf:
115              - type: boolean
116              - enum: [100, 101, 102, 103]
117                description: mt8186 pull down PUPD/R0/R1 type define value.
118              - enum: [200, 201, 202, 203]
119                description: mt8186 pull down RSEL type define value.
120              - enum: [75000, 5000]
121                description: mt8186 pull down RSEL type si unit value(ohm).
122            description: |
123              For pull down type is normal, it don't need add RSEL & R1R0 define
124              and resistance value.
125              For pull down type is PUPD/R0/R1 type, it can add R1R0 define to
126              set different resistance. It can support "MTK_PUPD_SET_R1R0_00" &
127              "MTK_PUPD_SET_R1R0_01" & "MTK_PUPD_SET_R1R0_10" &
128              "MTK_PUPD_SET_R1R0_11" define in mt8186.
129              For pull down type is RSEL, it can add RSEL define & resistance
130              value(ohm) to set different resistance by identifying property
131              "mediatek,rsel-resistance-in-si-unit".
132              It can support "MTK_PULL_SET_RSEL_000" & "MTK_PULL_SET_RSEL_001"
133              & "MTK_PULL_SET_RSEL_010" & "MTK_PULL_SET_RSEL_011"
134              define in mt8186. It can also support resistance value(ohm)
135              "75000" & "5000" in mt8186.
136              An example of using RSEL define:
137              pincontroller {
138                i2c0_pin {
139                  pins {
140                    pinmux = <PINMUX_GPIO128__FUNC_SDA0>;
141                    bias-pull-down = <MTK_PULL_SET_RSEL_001>;
142                  }
143                };
144              };
145              An example of using si unit resistance value(ohm):
146              &pio {
147                mediatek,rsel-resistance-in-si-unit;
148              }
149              pincontroller {
150                i2c0_pin {
151                  pins {
152                    pinmux = <PINMUX_GPIO128__FUNC_SDA0>;
153                    bias-pull-down = <75000>;
154                  }
155                };
156              };
157
158          bias-pull-up:
159            oneOf:
160              - type: boolean
161              - enum: [100, 101, 102, 103]
162                description: mt8186 pull up PUPD/R0/R1 type define value.
163              - enum: [200, 201, 202, 203]
164                description: mt8186 pull up RSEL type define value.
165              - enum: [1000, 5000, 10000, 75000]
166                description: mt8186 pull up RSEL type si unit value(ohm).
167            description: |
168              For pull up type is normal, it don't need add RSEL & R1R0 define
169              and resistance value.
170              For pull up type is PUPD/R0/R1 type, it can add R1R0 define to
171              set different resistance. It can support "MTK_PUPD_SET_R1R0_00" &
172              "MTK_PUPD_SET_R1R0_01" & "MTK_PUPD_SET_R1R0_10" &
173              "MTK_PUPD_SET_R1R0_11" define in mt8186.
174              For pull up type is RSEL, it can add RSEL define & resistance
175              value(ohm) to set different resistance by identifying property
176              "mediatek,rsel-resistance-in-si-unit".
177              It can support "MTK_PULL_SET_RSEL_000" & "MTK_PULL_SET_RSEL_001"
178              & "MTK_PULL_SET_RSEL_010" & "MTK_PULL_SET_RSEL_011"
179              define in mt8186. It can also support resistance value(ohm)
180              "1000" & "5000" & "10000" & "75000" in mt8186.
181              An example of using si unit resistance value(ohm):
182              &pio {
183                mediatek,rsel-resistance-in-si-unit;
184              }
185              pincontroller {
186                i2c0-pins {
187                  pins {
188                    pinmux = <PINMUX_GPIO128__FUNC_SDA0>;
189                    bias-pull-up = <1000>;
190                  }
191                };
192              };
193
194          bias-disable: true
195
196          output-high: true
197
198          output-low: true
199
200          input-enable: true
201
202          input-disable: true
203
204          input-schmitt-enable: true
205
206          input-schmitt-disable: true
207
208        required:
209          - pinmux
210
211required:
212  - compatible
213  - reg
214  - interrupts
215  - interrupt-controller
216  - '#interrupt-cells'
217  - gpio-controller
218  - '#gpio-cells'
219  - gpio-ranges
220
221additionalProperties: false
222
223examples:
224  - |
225    #include <dt-bindings/pinctrl/mt8186-pinfunc.h>
226    #include <dt-bindings/interrupt-controller/arm-gic.h>
227
228    pio: pinctrl@10005000 {
229      compatible = "mediatek,mt8186-pinctrl";
230      reg = <0x10005000 0x1000>,
231            <0x10002000 0x0200>,
232            <0x10002200 0x0200>,
233            <0x10002400 0x0200>,
234            <0x10002600 0x0200>,
235            <0x10002A00 0x0200>,
236            <0x10002c00 0x0200>,
237            <0x1000b000 0x1000>;
238      reg-names = "iocfg0", "iocfg_lt", "iocfg_lm",
239                  "iocfg_lb", "iocfg_bl", "iocfg_rb",
240                  "iocfg_rt", "eint";
241      gpio-controller;
242      #gpio-cells = <2>;
243      gpio-ranges = <&pio 0 0 185>;
244      interrupt-controller;
245      interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH 0>;
246      #interrupt-cells = <2>;
247
248      pio-pins {
249        pins {
250          pinmux = <PINMUX_GPIO0__FUNC_GPIO0>;
251          output-low;
252        };
253      };
254
255      spi0-pins {
256        pins-spi {
257          pinmux = <PINMUX_GPIO0__FUNC_SPI0_CLK_B>,
258                   <PINMUX_GPIO1__FUNC_SPI0_CSB_B>,
259                   <PINMUX_GPIO2__FUNC_SPI0_MO_B>;
260          bias-disable;
261        };
262        pins-spi-mi {
263          pinmux = <PINMUX_GPIO3__FUNC_SPI0_MI_B>;
264          bias-pull-down;
265        };
266      };
267
268      i2c0-pins {
269        pins {
270          pinmux = <PINMUX_GPIO127__FUNC_SCL0>,
271                   <PINMUX_GPIO128__FUNC_SDA0>;
272          bias-pull-up = <MTK_PULL_SET_RSEL_001>;
273          drive-strength-microamp = <1000>;
274        };
275      };
276    };
277