xref: /freebsd/sys/contrib/device-tree/Bindings/pinctrl/mediatek,mt6795-pinctrl.yaml (revision aa1a8ff2d6dbc51ef058f46f3db5a8bb77967145)
1fac71e4eSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2fac71e4eSEmmanuel Vadot%YAML 1.2
3fac71e4eSEmmanuel Vadot---
4fac71e4eSEmmanuel Vadot$id: http://devicetree.org/schemas/pinctrl/mediatek,mt6795-pinctrl.yaml#
5fac71e4eSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6fac71e4eSEmmanuel Vadot
7fac71e4eSEmmanuel Vadottitle: MediaTek MT6795 Pin Controller
8fac71e4eSEmmanuel Vadot
9fac71e4eSEmmanuel Vadotmaintainers:
10fac71e4eSEmmanuel Vadot  - AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
11fac71e4eSEmmanuel Vadot  - Sean Wang <sean.wang@kernel.org>
12fac71e4eSEmmanuel Vadot
13fac71e4eSEmmanuel Vadotdescription:
14fac71e4eSEmmanuel Vadot  The MediaTek's MT6795 Pin controller is used to control SoC pins.
15fac71e4eSEmmanuel Vadot
16fac71e4eSEmmanuel Vadotproperties:
17fac71e4eSEmmanuel Vadot  compatible:
18fac71e4eSEmmanuel Vadot    const: mediatek,mt6795-pinctrl
19fac71e4eSEmmanuel Vadot
20fac71e4eSEmmanuel Vadot  gpio-controller: true
21fac71e4eSEmmanuel Vadot
22fac71e4eSEmmanuel Vadot  '#gpio-cells':
23fac71e4eSEmmanuel Vadot    description:
24fac71e4eSEmmanuel Vadot      Number of cells in GPIO specifier. Since the generic GPIO binding is used,
25fac71e4eSEmmanuel Vadot      the amount of cells must be specified as 2. See the below mentioned gpio
26fac71e4eSEmmanuel Vadot      binding representation for description of particular cells.
27fac71e4eSEmmanuel Vadot    const: 2
28fac71e4eSEmmanuel Vadot
29fac71e4eSEmmanuel Vadot  gpio-ranges:
30fac71e4eSEmmanuel Vadot    description: GPIO valid number range.
31fac71e4eSEmmanuel Vadot    maxItems: 1
32fac71e4eSEmmanuel Vadot
33fac71e4eSEmmanuel Vadot  reg:
34fac71e4eSEmmanuel Vadot    description:
35fac71e4eSEmmanuel Vadot      Physical address base for GPIO base and eint registers.
36fac71e4eSEmmanuel Vadot    minItems: 2
37fac71e4eSEmmanuel Vadot
38fac71e4eSEmmanuel Vadot  reg-names:
39fac71e4eSEmmanuel Vadot    items:
40fac71e4eSEmmanuel Vadot      - const: base
41fac71e4eSEmmanuel Vadot      - const: eint
42fac71e4eSEmmanuel Vadot
43fac71e4eSEmmanuel Vadot  interrupt-controller: true
44fac71e4eSEmmanuel Vadot
45fac71e4eSEmmanuel Vadot  '#interrupt-cells':
46fac71e4eSEmmanuel Vadot    const: 2
47fac71e4eSEmmanuel Vadot
48fac71e4eSEmmanuel Vadot  interrupts:
49fac71e4eSEmmanuel Vadot    description: Interrupt outputs to the system interrupt controller (sysirq).
50fac71e4eSEmmanuel Vadot    minItems: 1
51fac71e4eSEmmanuel Vadot    items:
52fac71e4eSEmmanuel Vadot      - description: EINT interrupt
53fac71e4eSEmmanuel Vadot      - description: EINT event_b interrupt
54fac71e4eSEmmanuel Vadot
55fac71e4eSEmmanuel Vadot# PIN CONFIGURATION NODES
56fac71e4eSEmmanuel VadotpatternProperties:
57fac71e4eSEmmanuel Vadot  '-pins$':
58fac71e4eSEmmanuel Vadot    type: object
59fac71e4eSEmmanuel Vadot    additionalProperties: false
60fac71e4eSEmmanuel Vadot    patternProperties:
61fac71e4eSEmmanuel Vadot      '^pins':
62fac71e4eSEmmanuel Vadot        type: object
63fac71e4eSEmmanuel Vadot        additionalProperties: false
64fac71e4eSEmmanuel Vadot        description: |
65fac71e4eSEmmanuel Vadot          A pinctrl node should contain at least one subnodes representing the
66fac71e4eSEmmanuel Vadot          pinctrl groups available on the machine. Each subnode will list the
67fac71e4eSEmmanuel Vadot          pins it needs, and how they should be configured, with regard to muxer
68fac71e4eSEmmanuel Vadot          configuration, pullups, drive strength, input enable/disable and input
69fac71e4eSEmmanuel Vadot          schmitt.
70fac71e4eSEmmanuel Vadot          An example of using macro:
71fac71e4eSEmmanuel Vadot          pincontroller {
72fac71e4eSEmmanuel Vadot            /* GPIO0 set as multifunction GPIO0 */
73fac71e4eSEmmanuel Vadot            gpio-pins {
74fac71e4eSEmmanuel Vadot              pins {
75fac71e4eSEmmanuel Vadot                pinmux = <PINMUX_GPIO0__FUNC_GPIO0>;
76fac71e4eSEmmanuel Vadot              }
77fac71e4eSEmmanuel Vadot            };
78fac71e4eSEmmanuel Vadot            /* GPIO45 set as multifunction SDA0 */
79fac71e4eSEmmanuel Vadot            i2c0-pins {
80fac71e4eSEmmanuel Vadot              pins {
81fac71e4eSEmmanuel Vadot                pinmux = <PINMUX_GPIO45__FUNC_SDA0>;
82fac71e4eSEmmanuel Vadot              }
83fac71e4eSEmmanuel Vadot            };
84fac71e4eSEmmanuel Vadot          };
85fac71e4eSEmmanuel Vadot        $ref: pinmux-node.yaml
86fac71e4eSEmmanuel Vadot
87fac71e4eSEmmanuel Vadot        properties:
88fac71e4eSEmmanuel Vadot          pinmux:
89fac71e4eSEmmanuel Vadot            description:
90fac71e4eSEmmanuel Vadot              Integer array, represents gpio pin number and mux setting.
91fac71e4eSEmmanuel Vadot              Supported pin number and mux varies for different SoCs, and are
92fac71e4eSEmmanuel Vadot              defined as macros in dt-bindings/pinctrl/<soc>-pinfunc.h directly.
93fac71e4eSEmmanuel Vadot
94fac71e4eSEmmanuel Vadot          drive-strength:
95fac71e4eSEmmanuel Vadot            enum: [2, 4, 6, 8, 10, 12, 14, 16]
96fac71e4eSEmmanuel Vadot
97fac71e4eSEmmanuel Vadot          bias-pull-down:
98fac71e4eSEmmanuel Vadot            oneOf:
99fac71e4eSEmmanuel Vadot              - type: boolean
100fac71e4eSEmmanuel Vadot              - enum: [100, 101, 102, 103]
101fac71e4eSEmmanuel Vadot                description: mt6795 pull down PUPD/R0/R1 type define value.
102fac71e4eSEmmanuel Vadot            description:
103fac71e4eSEmmanuel Vadot              For normal pull down type, it is not necessary to specify R1R0
104fac71e4eSEmmanuel Vadot              values; When pull down type is PUPD/R0/R1, adding R1R0 defines
105fac71e4eSEmmanuel Vadot              will set different resistance values.
106fac71e4eSEmmanuel Vadot
107fac71e4eSEmmanuel Vadot          bias-pull-up:
108fac71e4eSEmmanuel Vadot            oneOf:
109fac71e4eSEmmanuel Vadot              - type: boolean
110fac71e4eSEmmanuel Vadot              - enum: [100, 101, 102, 103]
111fac71e4eSEmmanuel Vadot                description: mt6795 pull up PUPD/R0/R1 type define value.
112fac71e4eSEmmanuel Vadot            description:
113fac71e4eSEmmanuel Vadot              For normal pull up type, it is not necessary to specify R1R0
114fac71e4eSEmmanuel Vadot              values; When pull up type is PUPD/R0/R1, adding R1R0 defines will
115fac71e4eSEmmanuel Vadot              set different resistance values.
116fac71e4eSEmmanuel Vadot
117fac71e4eSEmmanuel Vadot          bias-disable: true
118fac71e4eSEmmanuel Vadot
119fac71e4eSEmmanuel Vadot          output-high: true
120fac71e4eSEmmanuel Vadot
121fac71e4eSEmmanuel Vadot          output-low: true
122fac71e4eSEmmanuel Vadot
123fac71e4eSEmmanuel Vadot          input-enable: true
124fac71e4eSEmmanuel Vadot
125fac71e4eSEmmanuel Vadot          input-disable: true
126fac71e4eSEmmanuel Vadot
127fac71e4eSEmmanuel Vadot          input-schmitt-enable: true
128fac71e4eSEmmanuel Vadot
129fac71e4eSEmmanuel Vadot          input-schmitt-disable: true
130fac71e4eSEmmanuel Vadot
131fac71e4eSEmmanuel Vadot          mediatek,pull-up-adv:
132fac71e4eSEmmanuel Vadot            description: |
133*aa1a8ff2SEmmanuel Vadot              Pull up settings for 2 pull resistors, R0 and R1. User can
134fac71e4eSEmmanuel Vadot              configure those special pins. Valid arguments are described as
135fac71e4eSEmmanuel Vadot              below:
136fac71e4eSEmmanuel Vadot              0: (R1, R0) = (0, 0) which means R1 disabled and R0 disabled.
137fac71e4eSEmmanuel Vadot              1: (R1, R0) = (0, 1) which means R1 disabled and R0 enabled.
138fac71e4eSEmmanuel Vadot              2: (R1, R0) = (1, 0) which means R1 enabled and R0 disabled.
139fac71e4eSEmmanuel Vadot              3: (R1, R0) = (1, 1) which means R1 enabled and R0 enabled.
140fac71e4eSEmmanuel Vadot            $ref: /schemas/types.yaml#/definitions/uint32
141fac71e4eSEmmanuel Vadot            enum: [0, 1, 2, 3]
142fac71e4eSEmmanuel Vadot
143fac71e4eSEmmanuel Vadot          mediatek,pull-down-adv:
144fac71e4eSEmmanuel Vadot            description: |
145fac71e4eSEmmanuel Vadot              Pull down settings for 2 pull resistors, R0 and R1. User can
146fac71e4eSEmmanuel Vadot              configure those special pins. Valid arguments are described as
147fac71e4eSEmmanuel Vadot              below:
148fac71e4eSEmmanuel Vadot              0: (R1, R0) = (0, 0) which means R1 disabled and R0 disabled.
149fac71e4eSEmmanuel Vadot              1: (R1, R0) = (0, 1) which means R1 disabled and R0 enabled.
150fac71e4eSEmmanuel Vadot              2: (R1, R0) = (1, 0) which means R1 enabled and R0 disabled.
151fac71e4eSEmmanuel Vadot              3: (R1, R0) = (1, 1) which means R1 enabled and R0 enabled.
152fac71e4eSEmmanuel Vadot            $ref: /schemas/types.yaml#/definitions/uint32
153fac71e4eSEmmanuel Vadot            enum: [0, 1, 2, 3]
154fac71e4eSEmmanuel Vadot
155fac71e4eSEmmanuel Vadot        required:
156fac71e4eSEmmanuel Vadot          - pinmux
157fac71e4eSEmmanuel Vadot
158fac71e4eSEmmanuel VadotallOf:
159fac71e4eSEmmanuel Vadot  - $ref: pinctrl.yaml#
160fac71e4eSEmmanuel Vadot
161fac71e4eSEmmanuel Vadotrequired:
162fac71e4eSEmmanuel Vadot  - compatible
163fac71e4eSEmmanuel Vadot  - reg
164fac71e4eSEmmanuel Vadot  - reg-names
165fac71e4eSEmmanuel Vadot  - interrupts
166fac71e4eSEmmanuel Vadot  - interrupt-controller
167fac71e4eSEmmanuel Vadot  - '#interrupt-cells'
168fac71e4eSEmmanuel Vadot  - gpio-controller
169fac71e4eSEmmanuel Vadot  - '#gpio-cells'
170fac71e4eSEmmanuel Vadot  - gpio-ranges
171fac71e4eSEmmanuel Vadot
172fac71e4eSEmmanuel VadotadditionalProperties: false
173fac71e4eSEmmanuel Vadot
174fac71e4eSEmmanuel Vadotexamples:
175fac71e4eSEmmanuel Vadot  - |
176fac71e4eSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
177fac71e4eSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
178fac71e4eSEmmanuel Vadot    #include <dt-bindings/pinctrl/mt6795-pinfunc.h>
179fac71e4eSEmmanuel Vadot
180fac71e4eSEmmanuel Vadot    soc {
181fac71e4eSEmmanuel Vadot        #address-cells = <2>;
182fac71e4eSEmmanuel Vadot        #size-cells = <2>;
183fac71e4eSEmmanuel Vadot
184fac71e4eSEmmanuel Vadot        pio: pinctrl@10005000 {
185fac71e4eSEmmanuel Vadot            compatible = "mediatek,mt6795-pinctrl";
186fac71e4eSEmmanuel Vadot            reg = <0 0x10005000 0 0x1000>, <0 0x1000b000 0 0x1000>;
187fac71e4eSEmmanuel Vadot            reg-names = "base", "eint";
188fac71e4eSEmmanuel Vadot            gpio-controller;
189fac71e4eSEmmanuel Vadot            #gpio-cells = <2>;
190fac71e4eSEmmanuel Vadot            gpio-ranges = <&pio 0 0 196>;
191fac71e4eSEmmanuel Vadot            interrupt-controller;
192fac71e4eSEmmanuel Vadot            interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>;
193fac71e4eSEmmanuel Vadot            #interrupt-cells = <2>;
194fac71e4eSEmmanuel Vadot
195fac71e4eSEmmanuel Vadot            i2c0-pins {
196fac71e4eSEmmanuel Vadot                pins-sda-scl {
197fac71e4eSEmmanuel Vadot                    pinmux = <PINMUX_GPIO45__FUNC_SDA0>,
198fac71e4eSEmmanuel Vadot                             <PINMUX_GPIO46__FUNC_SCL0>;
199fac71e4eSEmmanuel Vadot                };
200fac71e4eSEmmanuel Vadot            };
201fac71e4eSEmmanuel Vadot
202fac71e4eSEmmanuel Vadot            mmc0-pins {
203fac71e4eSEmmanuel Vadot                pins-cmd-dat {
204fac71e4eSEmmanuel Vadot                    pinmux = <PINMUX_GPIO154__FUNC_MSDC0_DAT0>,
205fac71e4eSEmmanuel Vadot                             <PINMUX_GPIO155__FUNC_MSDC0_DAT1>,
206fac71e4eSEmmanuel Vadot                             <PINMUX_GPIO156__FUNC_MSDC0_DAT2>,
207fac71e4eSEmmanuel Vadot                             <PINMUX_GPIO157__FUNC_MSDC0_DAT3>,
208fac71e4eSEmmanuel Vadot                             <PINMUX_GPIO158__FUNC_MSDC0_DAT4>,
209fac71e4eSEmmanuel Vadot                             <PINMUX_GPIO159__FUNC_MSDC0_DAT5>,
210fac71e4eSEmmanuel Vadot                             <PINMUX_GPIO160__FUNC_MSDC0_DAT6>,
211fac71e4eSEmmanuel Vadot                             <PINMUX_GPIO161__FUNC_MSDC0_DAT7>,
212fac71e4eSEmmanuel Vadot                             <PINMUX_GPIO162__FUNC_MSDC0_CMD>;
213fac71e4eSEmmanuel Vadot                    input-enable;
214fac71e4eSEmmanuel Vadot                    bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
215fac71e4eSEmmanuel Vadot                };
216fac71e4eSEmmanuel Vadot
217fac71e4eSEmmanuel Vadot                pins-clk {
218fac71e4eSEmmanuel Vadot                    pinmux = <PINMUX_GPIO163__FUNC_MSDC0_CLK>;
219fac71e4eSEmmanuel Vadot                    bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
220fac71e4eSEmmanuel Vadot                };
221fac71e4eSEmmanuel Vadot
222fac71e4eSEmmanuel Vadot                pins-rst {
223fac71e4eSEmmanuel Vadot                    pinmux = <PINMUX_GPIO165__FUNC_MSDC0_RSTB>;
224fac71e4eSEmmanuel Vadot                    bias-pull-up = <MTK_PUPD_SET_R1R0_10>;
225fac71e4eSEmmanuel Vadot                };
226fac71e4eSEmmanuel Vadot            };
227fac71e4eSEmmanuel Vadot        };
228fac71e4eSEmmanuel Vadot    };
229