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 is the
24      pin number, the second cell is used to specify optional parameters which
25      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
64      pull down. The first is by RSEL definition value, another one is by
65      resistance value(ohm). This flag is used to identify if the method is
66      resistance(si unit) value.
67
68# PIN CONFIGURATION NODES
69patternProperties:
70  '-pins$':
71    type: object
72    additionalProperties: false
73
74    patternProperties:
75      '^pins':
76        type: object
77        $ref: /schemas/pinctrl/pincfg-node.yaml
78        additionalProperties: false
79        description:
80          A pinctrl node should contain at least one subnode representing the
81          pinctrl groups available on the machine. Each subnode will list the
82          pins it needs, and how they should be configured, with regard to muxer
83          configuration, pullups, drive strength, input enable/disable and input
84          schmitt.
85
86        properties:
87          pinmux:
88            description:
89              Integer array, represents gpio pin number and mux setting.
90              Supported pin number and mux varies for different SoCs, and are
91              defined as macros in dt-bindings/pinctrl/mediatek,mt8188-pinfunc.h
92              directly, for this SoC.
93
94          drive-strength:
95            enum: [2, 4, 6, 8, 10, 12, 14, 16]
96
97          drive-strength-microamp:
98            enum: [125, 250, 500, 1000]
99
100          bias-pull-down:
101            oneOf:
102              - type: boolean
103              - enum: [100, 101, 102, 103]
104                description: mt8188 pull down PUPD/R0/R1 type define value.
105              - enum: [200, 201, 202, 203, 204, 205, 206, 207]
106                description: mt8188 pull down RSEL type define value.
107              - enum: [75000, 5000]
108                description: mt8188 pull down RSEL type si unit value(ohm).
109            description: |
110              For pull down type is normal, it doesn't need add RSEL & R1R0
111              define and resistance value.
112              For pull down type is PUPD/R0/R1 type, it can add R1R0 define to
113              set different resistance. It can support "MTK_PUPD_SET_R1R0_00" &
114              "MTK_PUPD_SET_R1R0_01" & "MTK_PUPD_SET_R1R0_10" &
115              "MTK_PUPD_SET_R1R0_11" define in mt8188.
116              For pull down type is RSEL, it can add RSEL define & resistance
117              value(ohm) to set different resistance by identifying property
118              "mediatek,rsel-resistance-in-si-unit". It can support
119              "MTK_PULL_SET_RSEL_000" & "MTK_PULL_SET_RSEL_001" &
120              "MTK_PULL_SET_RSEL_010" & "MTK_PULL_SET_RSEL_011" &
121              "MTK_PULL_SET_RSEL_100" & "MTK_PULL_SET_RSEL_101" &
122              "MTK_PULL_SET_RSEL_110" & "MTK_PULL_SET_RSEL_111" define in
123              mt8188. It can also support resistance value(ohm) "75000" & "5000"
124              in mt8188.
125
126          bias-pull-up:
127            oneOf:
128              - type: boolean
129              - enum: [100, 101, 102, 103]
130                description: mt8188 pull up PUPD/R0/R1 type define value.
131              - enum: [200, 201, 202, 203, 204, 205, 206, 207]
132                description: mt8188 pull up RSEL type define value.
133              - enum: [1000, 1500, 2000, 3000, 4000, 5000, 10000, 75000]
134                description: mt8188 pull up RSEL type si unit value(ohm).
135            description: |
136              For pull up type is normal, it don't need add RSEL & R1R0 define
137              and resistance value.
138              For pull up type is PUPD/R0/R1 type, it can add R1R0 define to set
139              different resistance. It can support "MTK_PUPD_SET_R1R0_00" &
140              "MTK_PUPD_SET_R1R0_01" & "MTK_PUPD_SET_R1R0_10" &
141              "MTK_PUPD_SET_R1R0_11" define in mt8188.
142              For pull up type is RSEL, it can add RSEL define & resistance
143              value(ohm) to set different resistance by identifying property
144              "mediatek,rsel-resistance-in-si-unit". It can support
145              "MTK_PULL_SET_RSEL_000" & "MTK_PULL_SET_RSEL_001" &
146              "MTK_PULL_SET_RSEL_010" & "MTK_PULL_SET_RSEL_011" &
147              "MTK_PULL_SET_RSEL_100" & "MTK_PULL_SET_RSEL_101" &
148              "MTK_PULL_SET_RSEL_110" & "MTK_PULL_SET_RSEL_111" define in
149              mt8188. It can also support resistance value(ohm) "1000" & "1500"
150              & "2000" & "3000" & "4000" & "5000" & "10000" & "75000" in mt8188.
151
152          bias-disable: true
153
154          output-high: true
155
156          output-low: true
157
158          input-enable: true
159
160          input-disable: true
161
162          input-schmitt-enable: true
163
164          input-schmitt-disable: true
165
166        required:
167          - pinmux
168
169required:
170  - compatible
171  - reg
172  - interrupts
173  - interrupt-controller
174  - '#interrupt-cells'
175  - gpio-controller
176  - '#gpio-cells'
177  - gpio-ranges
178
179additionalProperties: false
180
181examples:
182  - |
183    #include <dt-bindings/pinctrl/mediatek,mt8188-pinfunc.h>
184    #include <dt-bindings/interrupt-controller/arm-gic.h>
185
186    pio: pinctrl@10005000 {
187        compatible = "mediatek,mt8188-pinctrl";
188        reg = <0x10005000 0x1000>,
189              <0x11c00000 0x1000>,
190              <0x11e10000 0x1000>,
191              <0x11e20000 0x1000>,
192              <0x11ea0000 0x1000>,
193              <0x1000b000 0x1000>;
194        reg-names = "iocfg0", "iocfg_rm",
195                    "iocfg_lt", "iocfg_lm", "iocfg_rt",
196                    "eint";
197        gpio-controller;
198        #gpio-cells = <2>;
199        gpio-ranges = <&pio 0 0 176>;
200        interrupt-controller;
201        interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH 0>;
202        #interrupt-cells = <2>;
203
204        pio-pins {
205            pins {
206                pinmux = <PINMUX_GPIO0__FUNC_B_GPIO0>;
207                output-low;
208            };
209        };
210
211        spi0-pins {
212            pins-spi {
213                pinmux = <PINMUX_GPIO75__FUNC_O_SPIM1_CSB>,
214                         <PINMUX_GPIO76__FUNC_O_SPIM1_CLK>,
215                         <PINMUX_GPIO77__FUNC_B0_SPIM1_MOSI>;
216                drive-strength = <6>;
217            };
218            pins-spi-mi {
219                pinmux = <PINMUX_GPIO78__FUNC_B0_SPIM1_MISO>;
220                bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
221            };
222        };
223
224        i2c0-pins {
225            pins {
226                pinmux = <PINMUX_GPIO55__FUNC_B1_SCL0>,
227                         <PINMUX_GPIO56__FUNC_B1_SDA0>;
228                bias-disable;
229                drive-strength-microamp = <1000>;
230            };
231        };
232    };
233