18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
28c2ecf20Sopenharmony_ci%YAML 1.2
38c2ecf20Sopenharmony_ci---
48c2ecf20Sopenharmony_ci$id: http://devicetree.org/schemas/pinctrl/mediatek,mt6779-pinctrl.yaml#
58c2ecf20Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cititle: Mediatek MT6779 Pin Controller Device Tree Bindings
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cimaintainers:
108c2ecf20Sopenharmony_ci  - Andy Teng <andy.teng@mediatek.com>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_cidescription: |+
138c2ecf20Sopenharmony_ci  The pin controller node should be the child of a syscon node with the
148c2ecf20Sopenharmony_ci  required property:
158c2ecf20Sopenharmony_ci  - compatible: "syscon"
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciproperties:
188c2ecf20Sopenharmony_ci  compatible:
198c2ecf20Sopenharmony_ci    const: mediatek,mt6779-pinctrl
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci  reg:
228c2ecf20Sopenharmony_ci    minItems: 9
238c2ecf20Sopenharmony_ci    maxItems: 9
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci  reg-names:
268c2ecf20Sopenharmony_ci    items:
278c2ecf20Sopenharmony_ci      - const: "gpio"
288c2ecf20Sopenharmony_ci      - const: "iocfg_rm"
298c2ecf20Sopenharmony_ci      - const: "iocfg_br"
308c2ecf20Sopenharmony_ci      - const: "iocfg_lm"
318c2ecf20Sopenharmony_ci      - const: "iocfg_lb"
328c2ecf20Sopenharmony_ci      - const: "iocfg_rt"
338c2ecf20Sopenharmony_ci      - const: "iocfg_lt"
348c2ecf20Sopenharmony_ci      - const: "iocfg_tl"
358c2ecf20Sopenharmony_ci      - const: "eint"
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci  gpio-controller: true
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci  "#gpio-cells":
408c2ecf20Sopenharmony_ci    const: 2
418c2ecf20Sopenharmony_ci    description: |
428c2ecf20Sopenharmony_ci      Number of cells in GPIO specifier. Since the generic GPIO
438c2ecf20Sopenharmony_ci      binding is used, the amount of cells must be specified as 2. See the below
448c2ecf20Sopenharmony_ci      mentioned gpio binding representation for description of particular cells.
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci  gpio-ranges:
478c2ecf20Sopenharmony_ci    minItems: 1
488c2ecf20Sopenharmony_ci    maxItems: 5
498c2ecf20Sopenharmony_ci    description: |
508c2ecf20Sopenharmony_ci      GPIO valid number range.
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci  interrupt-controller: true
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci  interrupts:
558c2ecf20Sopenharmony_ci    maxItems: 1
568c2ecf20Sopenharmony_ci    description: |
578c2ecf20Sopenharmony_ci      Specifies the summary IRQ.
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci  "#interrupt-cells":
608c2ecf20Sopenharmony_ci    const: 2
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_cirequired:
638c2ecf20Sopenharmony_ci  - compatible
648c2ecf20Sopenharmony_ci  - reg
658c2ecf20Sopenharmony_ci  - reg-names
668c2ecf20Sopenharmony_ci  - gpio-controller
678c2ecf20Sopenharmony_ci  - "#gpio-cells"
688c2ecf20Sopenharmony_ci  - gpio-ranges
698c2ecf20Sopenharmony_ci  - interrupt-controller
708c2ecf20Sopenharmony_ci  - interrupts
718c2ecf20Sopenharmony_ci  - "#interrupt-cells"
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cipatternProperties:
748c2ecf20Sopenharmony_ci  '-[0-9]*$':
758c2ecf20Sopenharmony_ci    type: object
768c2ecf20Sopenharmony_ci    patternProperties:
778c2ecf20Sopenharmony_ci      '-pins*$':
788c2ecf20Sopenharmony_ci        type: object
798c2ecf20Sopenharmony_ci        description: |
808c2ecf20Sopenharmony_ci          A pinctrl node should contain at least one subnodes representing the
818c2ecf20Sopenharmony_ci          pinctrl groups available on the machine. Each subnode will list the
828c2ecf20Sopenharmony_ci          pins it needs, and how they should be configured, with regard to muxer
838c2ecf20Sopenharmony_ci          configuration, pullups, drive strength, input enable/disable and input schmitt.
848c2ecf20Sopenharmony_ci        $ref: "/schemas/pinctrl/pincfg-node.yaml"
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci        properties:
878c2ecf20Sopenharmony_ci          pinmux:
888c2ecf20Sopenharmony_ci            description:
898c2ecf20Sopenharmony_ci              integer array, represents gpio pin number and mux setting.
908c2ecf20Sopenharmony_ci              Supported pin number and mux varies for different SoCs, and are defined
918c2ecf20Sopenharmony_ci              as macros in boot/dts/<soc>-pinfunc.h directly.
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci          bias-disable: true
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci          bias-pull-up: true
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci          bias-pull-down: true
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci          input-enable: true
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci          input-disable: true
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci          output-low: true
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci          output-high: true
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci          input-schmitt-enable: true
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci          input-schmitt-disable: true
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci          mediatek,pull-up-adv:
1128c2ecf20Sopenharmony_ci            description: |
1138c2ecf20Sopenharmony_ci              Pull up setings for 2 pull resistors, R0 and R1. User can
1148c2ecf20Sopenharmony_ci              configure those special pins. Valid arguments are described as below:
1158c2ecf20Sopenharmony_ci              0: (R1, R0) = (0, 0) which means R1 disabled and R0 disabled.
1168c2ecf20Sopenharmony_ci              1: (R1, R0) = (0, 1) which means R1 disabled and R0 enabled.
1178c2ecf20Sopenharmony_ci              2: (R1, R0) = (1, 0) which means R1 enabled and R0 disabled.
1188c2ecf20Sopenharmony_ci              3: (R1, R0) = (1, 1) which means R1 enabled and R0 enabled.
1198c2ecf20Sopenharmony_ci            $ref: /schemas/types.yaml#/definitions/uint32
1208c2ecf20Sopenharmony_ci            enum: [0, 1, 2, 3]
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci          mediatek,pull-down-adv:
1238c2ecf20Sopenharmony_ci            description: |
1248c2ecf20Sopenharmony_ci              Pull down settings for 2 pull resistors, R0 and R1. User can
1258c2ecf20Sopenharmony_ci              configure those special pins. Valid arguments are described as below:
1268c2ecf20Sopenharmony_ci              0: (R1, R0) = (0, 0) which means R1 disabled and R0 disabled.
1278c2ecf20Sopenharmony_ci              1: (R1, R0) = (0, 1) which means R1 disabled and R0 enabled.
1288c2ecf20Sopenharmony_ci              2: (R1, R0) = (1, 0) which means R1 enabled and R0 disabled.
1298c2ecf20Sopenharmony_ci              3: (R1, R0) = (1, 1) which means R1 enabled and R0 enabled.
1308c2ecf20Sopenharmony_ci            $ref: /schemas/types.yaml#/definitions/uint32
1318c2ecf20Sopenharmony_ci            enum: [0, 1, 2, 3]
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci        required:
1348c2ecf20Sopenharmony_ci          - pinmux
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci        additionalProperties: false
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ciadditionalProperties: false
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ciexamples:
1418c2ecf20Sopenharmony_ci  - |
1428c2ecf20Sopenharmony_ci    #include <dt-bindings/interrupt-controller/irq.h>
1438c2ecf20Sopenharmony_ci    #include <dt-bindings/interrupt-controller/arm-gic.h>
1448c2ecf20Sopenharmony_ci    #include <dt-bindings/pinctrl/mt6779-pinfunc.h>
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci    soc {
1478c2ecf20Sopenharmony_ci        #address-cells = <2>;
1488c2ecf20Sopenharmony_ci        #size-cells = <2>;
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci        pio: pinctrl@10005000 {
1518c2ecf20Sopenharmony_ci            compatible = "mediatek,mt6779-pinctrl";
1528c2ecf20Sopenharmony_ci            reg = <0 0x10005000 0 0x1000>,
1538c2ecf20Sopenharmony_ci                <0 0x11c20000 0 0x1000>,
1548c2ecf20Sopenharmony_ci                <0 0x11d10000 0 0x1000>,
1558c2ecf20Sopenharmony_ci                <0 0x11e20000 0 0x1000>,
1568c2ecf20Sopenharmony_ci                <0 0x11e70000 0 0x1000>,
1578c2ecf20Sopenharmony_ci                <0 0x11ea0000 0 0x1000>,
1588c2ecf20Sopenharmony_ci                <0 0x11f20000 0 0x1000>,
1598c2ecf20Sopenharmony_ci                <0 0x11f30000 0 0x1000>,
1608c2ecf20Sopenharmony_ci                <0 0x1000b000 0 0x1000>;
1618c2ecf20Sopenharmony_ci            reg-names = "gpio", "iocfg_rm",
1628c2ecf20Sopenharmony_ci              "iocfg_br", "iocfg_lm",
1638c2ecf20Sopenharmony_ci              "iocfg_lb", "iocfg_rt",
1648c2ecf20Sopenharmony_ci              "iocfg_lt", "iocfg_tl",
1658c2ecf20Sopenharmony_ci              "eint";
1668c2ecf20Sopenharmony_ci            gpio-controller;
1678c2ecf20Sopenharmony_ci            #gpio-cells = <2>;
1688c2ecf20Sopenharmony_ci            gpio-ranges = <&pio 0 0 210>;
1698c2ecf20Sopenharmony_ci            interrupt-controller;
1708c2ecf20Sopenharmony_ci            #interrupt-cells = <2>;
1718c2ecf20Sopenharmony_ci            interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_HIGH>;
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci            mmc0_pins_default: mmc0-0 {
1748c2ecf20Sopenharmony_ci                cmd-dat-pins {
1758c2ecf20Sopenharmony_ci                    pinmux = <PINMUX_GPIO168__FUNC_MSDC0_DAT0>,
1768c2ecf20Sopenharmony_ci                        <PINMUX_GPIO172__FUNC_MSDC0_DAT1>,
1778c2ecf20Sopenharmony_ci                        <PINMUX_GPIO169__FUNC_MSDC0_DAT2>,
1788c2ecf20Sopenharmony_ci                        <PINMUX_GPIO177__FUNC_MSDC0_DAT3>,
1798c2ecf20Sopenharmony_ci                        <PINMUX_GPIO170__FUNC_MSDC0_DAT4>,
1808c2ecf20Sopenharmony_ci                        <PINMUX_GPIO173__FUNC_MSDC0_DAT5>,
1818c2ecf20Sopenharmony_ci                        <PINMUX_GPIO171__FUNC_MSDC0_DAT6>,
1828c2ecf20Sopenharmony_ci                        <PINMUX_GPIO174__FUNC_MSDC0_DAT7>,
1838c2ecf20Sopenharmony_ci                        <PINMUX_GPIO167__FUNC_MSDC0_CMD>;
1848c2ecf20Sopenharmony_ci                    input-enable;
1858c2ecf20Sopenharmony_ci                    mediatek,pull-up-adv = <1>;
1868c2ecf20Sopenharmony_ci                };
1878c2ecf20Sopenharmony_ci                clk-pins {
1888c2ecf20Sopenharmony_ci                    pinmux = <PINMUX_GPIO176__FUNC_MSDC0_CLK>;
1898c2ecf20Sopenharmony_ci                    mediatek,pull-down-adv = <2>;
1908c2ecf20Sopenharmony_ci                };
1918c2ecf20Sopenharmony_ci                rst-pins {
1928c2ecf20Sopenharmony_ci                    pinmux = <PINMUX_GPIO178__FUNC_MSDC0_RSTB>;
1938c2ecf20Sopenharmony_ci                    mediatek,pull-up-adv = <0>;
1948c2ecf20Sopenharmony_ci                };
1958c2ecf20Sopenharmony_ci            };
1968c2ecf20Sopenharmony_ci        };
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci        mmc0 {
1998c2ecf20Sopenharmony_ci           pinctrl-0 = <&mmc0_pins_default>;
2008c2ecf20Sopenharmony_ci           pinctrl-names = "default";
2018c2ecf20Sopenharmony_ci        };
2028c2ecf20Sopenharmony_ci    };
203