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,mt8188-pinctrl.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: MediaTek MT8188 Pin Controller
8
9maintainers:
10  - Hui Liu <hui.liu@mediatek.com>
11
12description: |
13  The MediaTek's MT8188 Pin controller is used to control SoC pins.
14
15properties:
16  compatible:
17    const: mediatek,mt8188-pinctrl
18
19  gpio-controller: true
20
21  '#gpio-cells':
22    description: |
23      Number of cells in GPIO specifier, should be two. The first cell
24      is the pin number, the second cell is used to specify optional
25      parameters which are defined in <dt-bindings/gpio/gpio.h>.
26    const: 2
27
28  gpio-ranges:
29    maxItems: 1
30
31  gpio-line-names: true
32
33  reg:
34    items:
35      - description: gpio registers base address
36      - description: rm group io configuration registers base address
37      - description: lt group io configuration registers base address
38      - description: lm group io configuration registers base address
39      - description: rt group io configuration registers base address
40      - description: eint registers base address
41
42  reg-names:
43    items:
44      - const: iocfg0
45      - const: iocfg_rm
46      - const: iocfg_lt
47      - const: iocfg_lm
48      - const: iocfg_rt
49      - const: eint
50
51  interrupt-controller: true
52
53  '#interrupt-cells':
54    const: 2
55
56  interrupts:
57    description: The interrupt outputs to sysirq.
58    maxItems: 1
59
60  mediatek,rsel-resistance-in-si-unit:
61    type: boolean
62    description: |
63      We provide two methods to select the resistance for I2C when pull up or pull down.
64      The first is by RSEL definition value, another one is by resistance value(ohm).
65      This flag is used to identify if the method is resistance(si unit) value.
66
67# PIN CONFIGURATION NODES
68patternProperties:
69  '-pins$':
70    type: object
71    additionalProperties: false
72
73    patternProperties:
74      '^pins':
75        type: object
76        $ref: "/schemas/pinctrl/pincfg-node.yaml"
77        additionalProperties: false
78        description: |
79          A pinctrl node should contain at least one subnode representing the
80          pinctrl groups available on the machine. Each subnode will list the
81          pins it needs, and how they should be configured, with regard to muxer
82          configuration, pullups, drive strength, input enable/disable and
83          input schmitt.
84
85        properties:
86          pinmux:
87            description: |
88              Integer array, represents gpio pin number and mux setting.
89              Supported pin number and mux varies for different SoCs, and are
90              defined as macros in dt-bindings/pinctrl/mediatek,<soc>-pinfunc.h
91              directly.
92
93          drive-strength:
94            enum: [2, 4, 6, 8, 10, 12, 14, 16]
95
96          drive-strength-microamp:
97            enum: [125, 250, 500, 1000]
98
99          bias-pull-down:
100            oneOf:
101              - type: boolean
102              - enum: [100, 101, 102, 103]
103                description: mt8188 pull down PUPD/R0/R1 type define value.
104              - enum: [200, 201, 202, 203, 204, 205, 206, 207]
105                description: mt8188 pull down RSEL type define value.
106              - enum: [75000, 5000]
107                description: mt8188 pull down RSEL type si unit value(ohm).
108            description: |
109              For pull down type is normal, it doesn't need add RSEL & R1R0 define
110              and resistance value.
111              For pull down type is PUPD/R0/R1 type, it can add R1R0 define to
112              set different resistance. It can support "MTK_PUPD_SET_R1R0_00" &
113              "MTK_PUPD_SET_R1R0_01" & "MTK_PUPD_SET_R1R0_10" & "MTK_PUPD_SET_R1R0_11"
114              define in mt8188.
115              For pull down type is RSEL, it can add RSEL define & resistance value(ohm)
116              to set different resistance by identifying property "mediatek,rsel-resistance-in-si-unit".
117              It can support "MTK_PULL_SET_RSEL_000" & "MTK_PULL_SET_RSEL_001"
118              & "MTK_PULL_SET_RSEL_010" & "MTK_PULL_SET_RSEL_011" & "MTK_PULL_SET_RSEL_100"
119              & "MTK_PULL_SET_RSEL_101" & "MTK_PULL_SET_RSEL_110" & "MTK_PULL_SET_RSEL_111"
120              define in mt8188. It can also support resistance value(ohm) "75000" & "5000" in mt8188.
121
122          bias-pull-up:
123            oneOf:
124              - type: boolean
125              - enum: [100, 101, 102, 103]
126                description: mt8188 pull up PUPD/R0/R1 type define value.
127              - enum: [200, 201, 202, 203, 204, 205, 206, 207]
128                description: mt8188 pull up RSEL type define value.
129              - enum: [1000, 1500, 2000, 3000, 4000, 5000, 10000, 75000]
130                description: mt8188 pull up RSEL type si unit value(ohm).
131            description: |
132              For pull up type is normal, it don't need add RSEL & R1R0 define
133              and resistance value.
134              For pull up type is PUPD/R0/R1 type, it can add R1R0 define to
135              set different resistance. It can support "MTK_PUPD_SET_R1R0_00" &
136              "MTK_PUPD_SET_R1R0_01" & "MTK_PUPD_SET_R1R0_10" & "MTK_PUPD_SET_R1R0_11"
137              define in mt8188.
138              For pull up type is RSEL, it can add RSEL define & resistance value(ohm)
139              to set different resistance by identifying property "mediatek,rsel-resistance-in-si-unit".
140              It can support "MTK_PULL_SET_RSEL_000" & "MTK_PULL_SET_RSEL_001"
141              & "MTK_PULL_SET_RSEL_010" & "MTK_PULL_SET_RSEL_011" & "MTK_PULL_SET_RSEL_100"
142              & "MTK_PULL_SET_RSEL_101" & "MTK_PULL_SET_RSEL_110" & "MTK_PULL_SET_RSEL_111"
143              define in mt8188. It can also support resistance value(ohm)
144              "1000" & "1500" & "2000" & "3000" & "4000" & "5000" & "10000" & "75000" in mt8188.
145
146          bias-disable: true
147
148          output-high: true
149
150          output-low: true
151
152          input-enable: true
153
154          input-disable: true
155
156          input-schmitt-enable: true
157
158          input-schmitt-disable: true
159
160        required:
161          - pinmux
162
163required:
164  - compatible
165  - reg
166  - interrupts
167  - interrupt-controller
168  - '#interrupt-cells'
169  - gpio-controller
170  - '#gpio-cells'
171  - gpio-ranges
172
173additionalProperties: false
174
175examples:
176  - |
177    #include <dt-bindings/pinctrl/mediatek,mt8188-pinfunc.h>
178    #include <dt-bindings/interrupt-controller/arm-gic.h>
179
180    pio: pinctrl@10005000 {
181        compatible = "mediatek,mt8188-pinctrl";
182        reg = <0x10005000 0x1000>,
183              <0x11c00000 0x1000>,
184              <0x11e10000 0x1000>,
185              <0x11e20000 0x1000>,
186              <0x11ea0000 0x1000>,
187              <0x1000b000 0x1000>;
188        reg-names = "iocfg0", "iocfg_rm",
189                    "iocfg_lt", "iocfg_lm", "iocfg_rt",
190                    "eint";
191        gpio-controller;
192        #gpio-cells = <2>;
193        gpio-ranges = <&pio 0 0 176>;
194        interrupt-controller;
195        interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH 0>;
196        #interrupt-cells = <2>;
197
198        pio-pins {
199            pins {
200                pinmux = <PINMUX_GPIO0__FUNC_B_GPIO0>;
201                output-low;
202            };
203        };
204
205        spi0-pins {
206            pins-spi {
207                pinmux = <PINMUX_GPIO75__FUNC_O_SPIM1_CSB>,
208                         <PINMUX_GPIO76__FUNC_O_SPIM1_CLK>,
209                         <PINMUX_GPIO77__FUNC_B0_SPIM1_MOSI>;
210                drive-strength = <6>;
211            };
212            pins-spi-mi {
213                pinmux = <PINMUX_GPIO78__FUNC_B0_SPIM1_MISO>;
214                bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
215            };
216        };
217
218        i2c0-pins {
219            pins {
220                pinmux = <PINMUX_GPIO55__FUNC_B1_SCL0>,
221                         <PINMUX_GPIO56__FUNC_B1_SDA0>;
222                bias-disable;
223                drive-strength-microamp = <1000>;
224            };
225        };
226    };
227