1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2c66ec88fSEmmanuel Vadot%YAML 1.2
3c66ec88fSEmmanuel Vadot---
4c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/pinctrl/mediatek,mt6779-pinctrl.yaml#
5c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6c66ec88fSEmmanuel Vadot
7fac71e4eSEmmanuel Vadottitle: MediaTek MT6779 Pin Controller
8c66ec88fSEmmanuel Vadot
9c66ec88fSEmmanuel Vadotmaintainers:
10c66ec88fSEmmanuel Vadot  - Andy Teng <andy.teng@mediatek.com>
118bab661aSEmmanuel Vadot  - Sean Wang <sean.wang@kernel.org>
12c66ec88fSEmmanuel Vadot
138bab661aSEmmanuel Vadotdescription:
14fac71e4eSEmmanuel Vadot  The MediaTek pin controller on MT6779 is used to control pin functions, pull
15fac71e4eSEmmanuel Vadot  up/down resistance and drive strength options.
16c66ec88fSEmmanuel Vadot
17c66ec88fSEmmanuel Vadotproperties:
18c66ec88fSEmmanuel Vadot  compatible:
198bab661aSEmmanuel Vadot    enum:
208bab661aSEmmanuel Vadot      - mediatek,mt6779-pinctrl
218bab661aSEmmanuel Vadot      - mediatek,mt6797-pinctrl
22c66ec88fSEmmanuel Vadot
23c66ec88fSEmmanuel Vadot  reg:
248bab661aSEmmanuel Vadot    description: Physical addresses for GPIO base(s) and EINT registers.
25c66ec88fSEmmanuel Vadot
268bab661aSEmmanuel Vadot  reg-names: true
27c66ec88fSEmmanuel Vadot
28c66ec88fSEmmanuel Vadot  gpio-controller: true
29c66ec88fSEmmanuel Vadot
30c66ec88fSEmmanuel Vadot  "#gpio-cells":
31c66ec88fSEmmanuel Vadot    const: 2
32fac71e4eSEmmanuel Vadot    description:
33fac71e4eSEmmanuel Vadot      Number of cells in GPIO specifier. Since the generic GPIO binding is used,
34fac71e4eSEmmanuel Vadot      the amount of cells must be specified as 2. See the below mentioned gpio
35fac71e4eSEmmanuel Vadot      binding representation for description of particular cells.
36c66ec88fSEmmanuel Vadot
37c66ec88fSEmmanuel Vadot  gpio-ranges:
38c66ec88fSEmmanuel Vadot    minItems: 1
39c66ec88fSEmmanuel Vadot    maxItems: 5
40fac71e4eSEmmanuel Vadot    description:
41c66ec88fSEmmanuel Vadot      GPIO valid number range.
42c66ec88fSEmmanuel Vadot
43c66ec88fSEmmanuel Vadot  interrupt-controller: true
44c66ec88fSEmmanuel Vadot
45c66ec88fSEmmanuel Vadot  interrupts:
46c66ec88fSEmmanuel Vadot    maxItems: 1
47fac71e4eSEmmanuel Vadot    description:
48c66ec88fSEmmanuel Vadot      Specifies the summary IRQ.
49c66ec88fSEmmanuel Vadot
50c66ec88fSEmmanuel Vadot  "#interrupt-cells":
51c66ec88fSEmmanuel Vadot    const: 2
52c66ec88fSEmmanuel Vadot
53c66ec88fSEmmanuel Vadotrequired:
54c66ec88fSEmmanuel Vadot  - compatible
55c66ec88fSEmmanuel Vadot  - reg
56c66ec88fSEmmanuel Vadot  - reg-names
57c66ec88fSEmmanuel Vadot  - gpio-controller
58c66ec88fSEmmanuel Vadot  - "#gpio-cells"
598bab661aSEmmanuel Vadot
608bab661aSEmmanuel VadotallOf:
61fac71e4eSEmmanuel Vadot  - $ref: pinctrl.yaml#
628bab661aSEmmanuel Vadot  - if:
638bab661aSEmmanuel Vadot      properties:
648bab661aSEmmanuel Vadot        compatible:
658bab661aSEmmanuel Vadot          contains:
668bab661aSEmmanuel Vadot            const: mediatek,mt6779-pinctrl
678bab661aSEmmanuel Vadot    then:
688bab661aSEmmanuel Vadot      properties:
698bab661aSEmmanuel Vadot        reg:
708bab661aSEmmanuel Vadot          minItems: 9
718bab661aSEmmanuel Vadot          maxItems: 9
728bab661aSEmmanuel Vadot
738bab661aSEmmanuel Vadot        reg-names:
748bab661aSEmmanuel Vadot          items:
758bab661aSEmmanuel Vadot            - const: gpio
768bab661aSEmmanuel Vadot            - const: iocfg_rm
778bab661aSEmmanuel Vadot            - const: iocfg_br
788bab661aSEmmanuel Vadot            - const: iocfg_lm
798bab661aSEmmanuel Vadot            - const: iocfg_lb
808bab661aSEmmanuel Vadot            - const: iocfg_rt
818bab661aSEmmanuel Vadot            - const: iocfg_lt
828bab661aSEmmanuel Vadot            - const: iocfg_tl
838bab661aSEmmanuel Vadot            - const: eint
848bab661aSEmmanuel Vadot  - if:
858bab661aSEmmanuel Vadot      properties:
868bab661aSEmmanuel Vadot        compatible:
878bab661aSEmmanuel Vadot          contains:
888bab661aSEmmanuel Vadot            const: mediatek,mt6797-pinctrl
898bab661aSEmmanuel Vadot    then:
908bab661aSEmmanuel Vadot      properties:
918bab661aSEmmanuel Vadot        reg:
928bab661aSEmmanuel Vadot          minItems: 5
938bab661aSEmmanuel Vadot          maxItems: 5
948bab661aSEmmanuel Vadot
958bab661aSEmmanuel Vadot        reg-names:
968bab661aSEmmanuel Vadot          items:
978bab661aSEmmanuel Vadot            - const: gpio
988bab661aSEmmanuel Vadot            - const: iocfgl
998bab661aSEmmanuel Vadot            - const: iocfgb
1008bab661aSEmmanuel Vadot            - const: iocfgr
1018bab661aSEmmanuel Vadot            - const: iocfgt
1028bab661aSEmmanuel Vadot  - if:
1038bab661aSEmmanuel Vadot      properties:
1048bab661aSEmmanuel Vadot        reg-names:
1058bab661aSEmmanuel Vadot          contains:
1068bab661aSEmmanuel Vadot            const: eint
1078bab661aSEmmanuel Vadot    then:
1088bab661aSEmmanuel Vadot      required:
109c66ec88fSEmmanuel Vadot        - interrupts
1108bab661aSEmmanuel Vadot        - interrupt-controller
111c66ec88fSEmmanuel Vadot        - "#interrupt-cells"
112c66ec88fSEmmanuel Vadot
113c66ec88fSEmmanuel VadotpatternProperties:
114c66ec88fSEmmanuel Vadot  '-[0-9]*$':
115c66ec88fSEmmanuel Vadot    type: object
1167ef62cebSEmmanuel Vadot    additionalProperties: false
1177ef62cebSEmmanuel Vadot
118c66ec88fSEmmanuel Vadot    patternProperties:
119c66ec88fSEmmanuel Vadot      '-pins*$':
120c66ec88fSEmmanuel Vadot        type: object
121fac71e4eSEmmanuel Vadot        description:
122c66ec88fSEmmanuel Vadot          A pinctrl node should contain at least one subnodes representing the
123c66ec88fSEmmanuel Vadot          pinctrl groups available on the machine. Each subnode will list the
124c66ec88fSEmmanuel Vadot          pins it needs, and how they should be configured, with regard to muxer
125fac71e4eSEmmanuel Vadot          configuration, pullups, drive strength, input enable/disable and input
126fac71e4eSEmmanuel Vadot          schmitt.
127fac71e4eSEmmanuel Vadot        $ref: /schemas/pinctrl/pincfg-node.yaml
128c66ec88fSEmmanuel Vadot
129c66ec88fSEmmanuel Vadot        properties:
130c66ec88fSEmmanuel Vadot          pinmux:
131c66ec88fSEmmanuel Vadot            description:
132fac71e4eSEmmanuel Vadot              Integer array, represents gpio pin number and mux setting.
133fac71e4eSEmmanuel Vadot              Supported pin number and mux varies for different SoCs, and are
134fac71e4eSEmmanuel Vadot              defined as macros in dt-bindings/pinctrl/<soc>-pinfunc.h directly.
135c66ec88fSEmmanuel Vadot
136c66ec88fSEmmanuel Vadot          bias-disable: true
137c66ec88fSEmmanuel Vadot
138c66ec88fSEmmanuel Vadot          bias-pull-up: true
139c66ec88fSEmmanuel Vadot
140c66ec88fSEmmanuel Vadot          bias-pull-down: true
141c66ec88fSEmmanuel Vadot
142c66ec88fSEmmanuel Vadot          input-enable: true
143c66ec88fSEmmanuel Vadot
144c66ec88fSEmmanuel Vadot          input-disable: true
145c66ec88fSEmmanuel Vadot
146c66ec88fSEmmanuel Vadot          output-low: true
147c66ec88fSEmmanuel Vadot
148c66ec88fSEmmanuel Vadot          output-high: true
149c66ec88fSEmmanuel Vadot
150c66ec88fSEmmanuel Vadot          input-schmitt-enable: true
151c66ec88fSEmmanuel Vadot
152c66ec88fSEmmanuel Vadot          input-schmitt-disable: true
153c66ec88fSEmmanuel Vadot
1548bab661aSEmmanuel Vadot          drive-strength:
1558bab661aSEmmanuel Vadot            enum: [2, 4, 8, 12, 16]
1568bab661aSEmmanuel Vadot
1578bab661aSEmmanuel Vadot          slew-rate:
1588bab661aSEmmanuel Vadot            enum: [0, 1]
1598bab661aSEmmanuel Vadot
160c66ec88fSEmmanuel Vadot          mediatek,pull-up-adv:
161c66ec88fSEmmanuel Vadot            description: |
162*aa1a8ff2SEmmanuel Vadot              Pull up settings for 2 pull resistors, R0 and R1. User can
163fac71e4eSEmmanuel Vadot              configure those special pins. Valid arguments are described as
164fac71e4eSEmmanuel Vadot              below:
165c66ec88fSEmmanuel Vadot              0: (R1, R0) = (0, 0) which means R1 disabled and R0 disabled.
166c66ec88fSEmmanuel Vadot              1: (R1, R0) = (0, 1) which means R1 disabled and R0 enabled.
167c66ec88fSEmmanuel Vadot              2: (R1, R0) = (1, 0) which means R1 enabled and R0 disabled.
168c66ec88fSEmmanuel Vadot              3: (R1, R0) = (1, 1) which means R1 enabled and R0 enabled.
169c66ec88fSEmmanuel Vadot            $ref: /schemas/types.yaml#/definitions/uint32
170c66ec88fSEmmanuel Vadot            enum: [0, 1, 2, 3]
171c66ec88fSEmmanuel Vadot
172c66ec88fSEmmanuel Vadot          mediatek,pull-down-adv:
173c66ec88fSEmmanuel Vadot            description: |
174c66ec88fSEmmanuel Vadot              Pull down settings for 2 pull resistors, R0 and R1. User can
175fac71e4eSEmmanuel Vadot              configure those special pins. Valid arguments are described as
176fac71e4eSEmmanuel Vadot              below:
177c66ec88fSEmmanuel Vadot              0: (R1, R0) = (0, 0) which means R1 disabled and R0 disabled.
178c66ec88fSEmmanuel Vadot              1: (R1, R0) = (0, 1) which means R1 disabled and R0 enabled.
179c66ec88fSEmmanuel Vadot              2: (R1, R0) = (1, 0) which means R1 enabled and R0 disabled.
180c66ec88fSEmmanuel Vadot              3: (R1, R0) = (1, 1) which means R1 enabled and R0 enabled.
181c66ec88fSEmmanuel Vadot            $ref: /schemas/types.yaml#/definitions/uint32
182c66ec88fSEmmanuel Vadot            enum: [0, 1, 2, 3]
183c66ec88fSEmmanuel Vadot
184c66ec88fSEmmanuel Vadot        required:
185c66ec88fSEmmanuel Vadot          - pinmux
186c66ec88fSEmmanuel Vadot
187c66ec88fSEmmanuel Vadot        additionalProperties: false
188c66ec88fSEmmanuel Vadot
189c66ec88fSEmmanuel VadotadditionalProperties: false
190c66ec88fSEmmanuel Vadot
191c66ec88fSEmmanuel Vadotexamples:
192c66ec88fSEmmanuel Vadot  - |
193c66ec88fSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
194c66ec88fSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
195c66ec88fSEmmanuel Vadot    #include <dt-bindings/pinctrl/mt6779-pinfunc.h>
196c66ec88fSEmmanuel Vadot
197c66ec88fSEmmanuel Vadot    soc {
198c66ec88fSEmmanuel Vadot        #address-cells = <2>;
199c66ec88fSEmmanuel Vadot        #size-cells = <2>;
200c66ec88fSEmmanuel Vadot
201c66ec88fSEmmanuel Vadot        pio: pinctrl@10005000 {
202c66ec88fSEmmanuel Vadot            compatible = "mediatek,mt6779-pinctrl";
203c66ec88fSEmmanuel Vadot            reg = <0 0x10005000 0 0x1000>,
204c66ec88fSEmmanuel Vadot                <0 0x11c20000 0 0x1000>,
205c66ec88fSEmmanuel Vadot                <0 0x11d10000 0 0x1000>,
206c66ec88fSEmmanuel Vadot                <0 0x11e20000 0 0x1000>,
207c66ec88fSEmmanuel Vadot                <0 0x11e70000 0 0x1000>,
208c66ec88fSEmmanuel Vadot                <0 0x11ea0000 0 0x1000>,
209c66ec88fSEmmanuel Vadot                <0 0x11f20000 0 0x1000>,
210c66ec88fSEmmanuel Vadot                <0 0x11f30000 0 0x1000>,
211c66ec88fSEmmanuel Vadot                <0 0x1000b000 0 0x1000>;
212c66ec88fSEmmanuel Vadot            reg-names = "gpio", "iocfg_rm",
213c66ec88fSEmmanuel Vadot              "iocfg_br", "iocfg_lm",
214c66ec88fSEmmanuel Vadot              "iocfg_lb", "iocfg_rt",
215c66ec88fSEmmanuel Vadot              "iocfg_lt", "iocfg_tl",
216c66ec88fSEmmanuel Vadot              "eint";
217c66ec88fSEmmanuel Vadot            gpio-controller;
218c66ec88fSEmmanuel Vadot            #gpio-cells = <2>;
219c66ec88fSEmmanuel Vadot            gpio-ranges = <&pio 0 0 210>;
220c66ec88fSEmmanuel Vadot            interrupt-controller;
221c66ec88fSEmmanuel Vadot            #interrupt-cells = <2>;
222c66ec88fSEmmanuel Vadot            interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_HIGH>;
223c66ec88fSEmmanuel Vadot
224c66ec88fSEmmanuel Vadot            mmc0_pins_default: mmc0-0 {
225c66ec88fSEmmanuel Vadot                cmd-dat-pins {
226c66ec88fSEmmanuel Vadot                    pinmux = <PINMUX_GPIO168__FUNC_MSDC0_DAT0>,
227c66ec88fSEmmanuel Vadot                        <PINMUX_GPIO172__FUNC_MSDC0_DAT1>,
228c66ec88fSEmmanuel Vadot                        <PINMUX_GPIO169__FUNC_MSDC0_DAT2>,
229c66ec88fSEmmanuel Vadot                        <PINMUX_GPIO177__FUNC_MSDC0_DAT3>,
230c66ec88fSEmmanuel Vadot                        <PINMUX_GPIO170__FUNC_MSDC0_DAT4>,
231c66ec88fSEmmanuel Vadot                        <PINMUX_GPIO173__FUNC_MSDC0_DAT5>,
232c66ec88fSEmmanuel Vadot                        <PINMUX_GPIO171__FUNC_MSDC0_DAT6>,
233c66ec88fSEmmanuel Vadot                        <PINMUX_GPIO174__FUNC_MSDC0_DAT7>,
234c66ec88fSEmmanuel Vadot                        <PINMUX_GPIO167__FUNC_MSDC0_CMD>;
235c66ec88fSEmmanuel Vadot                    input-enable;
236c66ec88fSEmmanuel Vadot                    mediatek,pull-up-adv = <1>;
237c66ec88fSEmmanuel Vadot                };
238c66ec88fSEmmanuel Vadot                clk-pins {
239c66ec88fSEmmanuel Vadot                    pinmux = <PINMUX_GPIO176__FUNC_MSDC0_CLK>;
240c66ec88fSEmmanuel Vadot                    mediatek,pull-down-adv = <2>;
241c66ec88fSEmmanuel Vadot                };
242c66ec88fSEmmanuel Vadot                rst-pins {
243c66ec88fSEmmanuel Vadot                    pinmux = <PINMUX_GPIO178__FUNC_MSDC0_RSTB>;
244c66ec88fSEmmanuel Vadot                    mediatek,pull-up-adv = <0>;
245c66ec88fSEmmanuel Vadot                };
246c66ec88fSEmmanuel Vadot            };
247c66ec88fSEmmanuel Vadot        };
248c66ec88fSEmmanuel Vadot
249c66ec88fSEmmanuel Vadot        mmc0 {
250c66ec88fSEmmanuel Vadot           pinctrl-0 = <&mmc0_pins_default>;
251c66ec88fSEmmanuel Vadot           pinctrl-names = "default";
252c66ec88fSEmmanuel Vadot        };
253c66ec88fSEmmanuel Vadot    };
254