1c66ec88fSEmmanuel Vadot* Mediatek MT65XX Pin Controller 2c66ec88fSEmmanuel Vadot 3c66ec88fSEmmanuel VadotThe Mediatek's Pin controller is used to control SoC pins. 4c66ec88fSEmmanuel Vadot 5c66ec88fSEmmanuel VadotRequired properties: 6c66ec88fSEmmanuel Vadot- compatible: value should be one of the following. 7c66ec88fSEmmanuel Vadot "mediatek,mt2701-pinctrl", compatible with mt2701 pinctrl. 8c66ec88fSEmmanuel Vadot "mediatek,mt2712-pinctrl", compatible with mt2712 pinctrl. 9c66ec88fSEmmanuel Vadot "mediatek,mt6397-pinctrl", compatible with mt6397 pinctrl. 10c66ec88fSEmmanuel Vadot "mediatek,mt7623-pinctrl", compatible with mt7623 pinctrl. 11c66ec88fSEmmanuel Vadot "mediatek,mt8127-pinctrl", compatible with mt8127 pinctrl. 12c66ec88fSEmmanuel Vadot "mediatek,mt8135-pinctrl", compatible with mt8135 pinctrl. 136be33864SEmmanuel Vadot "mediatek,mt8167-pinctrl", compatible with mt8167 pinctrl. 14c66ec88fSEmmanuel Vadot "mediatek,mt8173-pinctrl", compatible with mt8173 pinctrl. 15*5956d97fSEmmanuel Vadot "mediatek,mt8365-pinctrl", compatible with mt8365 pinctrl. 16c66ec88fSEmmanuel Vadot "mediatek,mt8516-pinctrl", compatible with mt8516 pinctrl. 17c66ec88fSEmmanuel Vadot- pins-are-numbered: Specify the subnodes are using numbered pinmux to 18c66ec88fSEmmanuel Vadot specify pins. 19c66ec88fSEmmanuel Vadot- gpio-controller : Marks the device node as a gpio controller. 20c66ec88fSEmmanuel Vadot- #gpio-cells: number of cells in GPIO specifier. Since the generic GPIO 21c66ec88fSEmmanuel Vadot binding is used, the amount of cells must be specified as 2. See the below 22c66ec88fSEmmanuel Vadot mentioned gpio binding representation for description of particular cells. 23c66ec88fSEmmanuel Vadot 24c66ec88fSEmmanuel Vadot Eg: <&pio 6 0> 25c66ec88fSEmmanuel Vadot <[phandle of the gpio controller node] 26c66ec88fSEmmanuel Vadot [line number within the gpio controller] 27c66ec88fSEmmanuel Vadot [flags]> 28c66ec88fSEmmanuel Vadot 29c66ec88fSEmmanuel Vadot Values for gpio specifier: 30c66ec88fSEmmanuel Vadot - Line number: is a value between 0 to 202. 31c66ec88fSEmmanuel Vadot - Flags: bit field of flags, as defined in <dt-bindings/gpio/gpio.h>. 32c66ec88fSEmmanuel Vadot Only the following flags are supported: 33c66ec88fSEmmanuel Vadot 0 - GPIO_ACTIVE_HIGH 34c66ec88fSEmmanuel Vadot 1 - GPIO_ACTIVE_LOW 35c66ec88fSEmmanuel Vadot 36c66ec88fSEmmanuel VadotOptional properties: 37c66ec88fSEmmanuel Vadot- mediatek,pctl-regmap: Should be a phandle of the syscfg node. 38c66ec88fSEmmanuel Vadot- reg: physicall address base for EINT registers 39c66ec88fSEmmanuel Vadot- interrupt-controller: Marks the device node as an interrupt controller 40c66ec88fSEmmanuel Vadot- #interrupt-cells: Should be two. 41c66ec88fSEmmanuel Vadot- interrupts : The interrupt outputs from the controller. 42c66ec88fSEmmanuel Vadot 43c66ec88fSEmmanuel VadotPlease refer to pinctrl-bindings.txt in this directory for details of the 44c66ec88fSEmmanuel Vadotcommon pinctrl bindings used by client devices. 45c66ec88fSEmmanuel Vadot 46c66ec88fSEmmanuel VadotSubnode format 47c66ec88fSEmmanuel VadotA pinctrl node should contain at least one subnodes representing the 48c66ec88fSEmmanuel Vadotpinctrl groups available on the machine. Each subnode will list the 49c66ec88fSEmmanuel Vadotpins it needs, and how they should be configured, with regard to muxer 50c66ec88fSEmmanuel Vadotconfiguration, pullups, drive strength, input enable/disable and input schmitt. 51c66ec88fSEmmanuel Vadot 52c66ec88fSEmmanuel Vadot node { 53c66ec88fSEmmanuel Vadot pinmux = <PIN_NUMBER_PINMUX>; 54c66ec88fSEmmanuel Vadot GENERIC_PINCONFIG; 55c66ec88fSEmmanuel Vadot }; 56c66ec88fSEmmanuel Vadot 57c66ec88fSEmmanuel VadotRequired properties: 58c66ec88fSEmmanuel Vadot- pinmux: integer array, represents gpio pin number and mux setting. 59c66ec88fSEmmanuel Vadot Supported pin number and mux varies for different SoCs, and are defined 60c66ec88fSEmmanuel Vadot as macros in boot/dts/<soc>-pinfunc.h directly. 61c66ec88fSEmmanuel Vadot 62c66ec88fSEmmanuel VadotOptional properties: 63c66ec88fSEmmanuel Vadot- GENERIC_PINCONFIG: is the generic pinconfig options to use, bias-disable, 64c66ec88fSEmmanuel Vadot bias-pull-down, bias-pull-up, input-enable, input-disable, output-low, output-high, 65c66ec88fSEmmanuel Vadot input-schmitt-enable, input-schmitt-disable and drive-strength are valid. 66c66ec88fSEmmanuel Vadot 67c66ec88fSEmmanuel Vadot Some special pins have extra pull up strength, there are R0 and R1 pull-up 68c66ec88fSEmmanuel Vadot resistors available, but for user, it's only need to set R1R0 as 00, 01, 10 or 11. 69c66ec88fSEmmanuel Vadot So when config bias-pull-up, it support arguments for those special pins. 70c66ec88fSEmmanuel Vadot Some macros have been defined for this usage, such as MTK_PUPD_SET_R1R0_00. 71c66ec88fSEmmanuel Vadot See dt-bindings/pinctrl/mt65xx.h. 72c66ec88fSEmmanuel Vadot 73c66ec88fSEmmanuel Vadot When config drive-strength, it can support some arguments, such as 74c66ec88fSEmmanuel Vadot MTK_DRIVE_4mA, MTK_DRIVE_6mA, etc. See dt-bindings/pinctrl/mt65xx.h. 75c66ec88fSEmmanuel Vadot 76c66ec88fSEmmanuel VadotExamples: 77c66ec88fSEmmanuel Vadot 78c66ec88fSEmmanuel Vadot#include "mt8135-pinfunc.h" 79c66ec88fSEmmanuel Vadot 80c66ec88fSEmmanuel Vadot... 81c66ec88fSEmmanuel Vadot{ 82c66ec88fSEmmanuel Vadot syscfg_pctl_a: syscfg-pctl-a@10005000 { 83c66ec88fSEmmanuel Vadot compatible = "mediatek,mt8135-pctl-a-syscfg", "syscon"; 84c66ec88fSEmmanuel Vadot reg = <0 0x10005000 0 0x1000>; 85c66ec88fSEmmanuel Vadot }; 86c66ec88fSEmmanuel Vadot 87c66ec88fSEmmanuel Vadot syscfg_pctl_b: syscfg-pctl-b@1020c020 { 88c66ec88fSEmmanuel Vadot compatible = "mediatek,mt8135-pctl-b-syscfg", "syscon"; 89c66ec88fSEmmanuel Vadot reg = <0 0x1020C020 0 0x1000>; 90c66ec88fSEmmanuel Vadot }; 91c66ec88fSEmmanuel Vadot 92c66ec88fSEmmanuel Vadot pinctrl@1c20800 { 93c66ec88fSEmmanuel Vadot compatible = "mediatek,mt8135-pinctrl"; 94c66ec88fSEmmanuel Vadot reg = <0 0x1000B000 0 0x1000>; 955def4c47SEmmanuel Vadot mediatek,pctl-regmap = <&syscfg_pctl_a>, <&syscfg_pctl_b>; 96c66ec88fSEmmanuel Vadot pins-are-numbered; 97c66ec88fSEmmanuel Vadot gpio-controller; 98c66ec88fSEmmanuel Vadot #gpio-cells = <2>; 99c66ec88fSEmmanuel Vadot interrupt-controller; 100c66ec88fSEmmanuel Vadot #interrupt-cells = <2>; 101c66ec88fSEmmanuel Vadot interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>, 102c66ec88fSEmmanuel Vadot <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>, 103c66ec88fSEmmanuel Vadot <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>; 104c66ec88fSEmmanuel Vadot 105c66ec88fSEmmanuel Vadot i2c0_pins_a: i2c0@0 { 106c66ec88fSEmmanuel Vadot pins1 { 107c66ec88fSEmmanuel Vadot pinmux = <MT8135_PIN_100_SDA0__FUNC_SDA0>, 108c66ec88fSEmmanuel Vadot <MT8135_PIN_101_SCL0__FUNC_SCL0>; 109c66ec88fSEmmanuel Vadot bias-disable; 110c66ec88fSEmmanuel Vadot }; 111c66ec88fSEmmanuel Vadot }; 112c66ec88fSEmmanuel Vadot 113c66ec88fSEmmanuel Vadot i2c1_pins_a: i2c1@0 { 114c66ec88fSEmmanuel Vadot pins { 115c66ec88fSEmmanuel Vadot pinmux = <MT8135_PIN_195_SDA1__FUNC_SDA1>, 116c66ec88fSEmmanuel Vadot <MT8135_PIN_196_SCL1__FUNC_SCL1>; 117c66ec88fSEmmanuel Vadot bias-pull-up = <55>; 118c66ec88fSEmmanuel Vadot }; 119c66ec88fSEmmanuel Vadot }; 120c66ec88fSEmmanuel Vadot 121c66ec88fSEmmanuel Vadot i2c2_pins_a: i2c2@0 { 122c66ec88fSEmmanuel Vadot pins1 { 123c66ec88fSEmmanuel Vadot pinmux = <MT8135_PIN_193_SDA2__FUNC_SDA2>; 124c66ec88fSEmmanuel Vadot bias-pull-down; 125c66ec88fSEmmanuel Vadot }; 126c66ec88fSEmmanuel Vadot 127c66ec88fSEmmanuel Vadot pins2 { 128c66ec88fSEmmanuel Vadot pinmux = <MT8135_PIN_49_WATCHDOG__FUNC_GPIO49>; 129c66ec88fSEmmanuel Vadot bias-pull-up; 130c66ec88fSEmmanuel Vadot }; 131c66ec88fSEmmanuel Vadot }; 132c66ec88fSEmmanuel Vadot 133c66ec88fSEmmanuel Vadot i2c3_pins_a: i2c3@0 { 134c66ec88fSEmmanuel Vadot pins1 { 135c66ec88fSEmmanuel Vadot pinmux = <MT8135_PIN_40_DAC_CLK__FUNC_GPIO40>, 136c66ec88fSEmmanuel Vadot <MT8135_PIN_41_DAC_WS__FUNC_GPIO41>; 137c66ec88fSEmmanuel Vadot bias-pull-up = <55>; 138c66ec88fSEmmanuel Vadot }; 139c66ec88fSEmmanuel Vadot 140c66ec88fSEmmanuel Vadot pins2 { 141c66ec88fSEmmanuel Vadot pinmux = <MT8135_PIN_35_SCL3__FUNC_SCL3>, 142c66ec88fSEmmanuel Vadot <MT8135_PIN_36_SDA3__FUNC_SDA3>; 143c66ec88fSEmmanuel Vadot output-low; 144c66ec88fSEmmanuel Vadot bias-pull-up = <55>; 145c66ec88fSEmmanuel Vadot }; 146c66ec88fSEmmanuel Vadot 147c66ec88fSEmmanuel Vadot pins3 { 148c66ec88fSEmmanuel Vadot pinmux = <MT8135_PIN_57_JTCK__FUNC_GPIO57>, 149c66ec88fSEmmanuel Vadot <MT8135_PIN_60_JTDI__FUNC_JTDI>; 150c66ec88fSEmmanuel Vadot drive-strength = <32>; 151c66ec88fSEmmanuel Vadot }; 152c66ec88fSEmmanuel Vadot }; 153c66ec88fSEmmanuel Vadot 154c66ec88fSEmmanuel Vadot ... 155c66ec88fSEmmanuel Vadot } 156c66ec88fSEmmanuel Vadot}; 157