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