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