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