1*4882a593Smuzhiyun* Mediatek MT8183 Pin Controller 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunThe Mediatek's Pin controller is used to control SoC pins. 4*4882a593Smuzhiyun 5*4882a593SmuzhiyunRequired properties: 6*4882a593Smuzhiyun- compatible: value should be one of the following. 7*4882a593Smuzhiyun "mediatek,mt8183-pinctrl", compatible with mt8183 pinctrl. 8*4882a593Smuzhiyun- gpio-controller : Marks the device node as a gpio controller. 9*4882a593Smuzhiyun- #gpio-cells: number of cells in GPIO specifier. Since the generic GPIO 10*4882a593Smuzhiyun binding is used, the amount of cells must be specified as 2. See the below 11*4882a593Smuzhiyun mentioned gpio binding representation for description of particular cells. 12*4882a593Smuzhiyun- gpio-ranges : gpio valid number range. 13*4882a593Smuzhiyun- reg: physical address base for gpio base registers. There are 10 GPIO 14*4882a593Smuzhiyun physical address base in mt8183. 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunOptional properties: 17*4882a593Smuzhiyun- reg-names: gpio base register names. There are 10 gpio base register 18*4882a593Smuzhiyun names in mt8183. They are "iocfg0", "iocfg1", "iocfg2", "iocfg3", "iocfg4", 19*4882a593Smuzhiyun "iocfg5", "iocfg6", "iocfg7", "iocfg8", "eint". 20*4882a593Smuzhiyun- interrupt-controller: Marks the device node as an interrupt controller 21*4882a593Smuzhiyun- #interrupt-cells: Should be two. 22*4882a593Smuzhiyun- interrupts : The interrupt outputs to sysirq. 23*4882a593Smuzhiyun 24*4882a593SmuzhiyunPlease refer to pinctrl-bindings.txt in this directory for details of the 25*4882a593Smuzhiyuncommon pinctrl bindings used by client devices. 26*4882a593Smuzhiyun 27*4882a593SmuzhiyunSubnode format 28*4882a593SmuzhiyunA pinctrl node should contain at least one subnodes representing the 29*4882a593Smuzhiyunpinctrl groups available on the machine. Each subnode will list the 30*4882a593Smuzhiyunpins it needs, and how they should be configured, with regard to muxer 31*4882a593Smuzhiyunconfiguration, pullups, drive strength, input enable/disable and input schmitt. 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun node { 34*4882a593Smuzhiyun pinmux = <PIN_NUMBER_PINMUX>; 35*4882a593Smuzhiyun GENERIC_PINCONFIG; 36*4882a593Smuzhiyun }; 37*4882a593Smuzhiyun 38*4882a593SmuzhiyunRequired properties: 39*4882a593Smuzhiyun- pinmux: integer array, represents gpio pin number and mux setting. 40*4882a593Smuzhiyun Supported pin number and mux varies for different SoCs, and are defined 41*4882a593Smuzhiyun as macros in boot/dts/<soc>-pinfunc.h directly. 42*4882a593Smuzhiyun 43*4882a593SmuzhiyunOptional properties: 44*4882a593Smuzhiyun- GENERIC_PINCONFIG: is the generic pinconfig options to use, bias-disable, 45*4882a593Smuzhiyun bias-pull-down, bias-pull-up, input-enable, input-disable, output-low, 46*4882a593Smuzhiyun output-high, input-schmitt-enable, input-schmitt-disable 47*4882a593Smuzhiyun and drive-strength are valid. 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun Some special pins have extra pull up strength, there are R0 and R1 pull-up 50*4882a593Smuzhiyun resistors available, but for user, it's only need to set R1R0 as 00, 01, 51*4882a593Smuzhiyun 10 or 11. So It needs config "mediatek,pull-up-adv" or 52*4882a593Smuzhiyun "mediatek,pull-down-adv" to support arguments for those special pins. 53*4882a593Smuzhiyun Valid arguments are from 0 to 3. 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun mediatek,tdsel: An integer describing the steps for output level shifter 56*4882a593Smuzhiyun duty cycle when asserted (high pulse width adjustment). Valid arguments 57*4882a593Smuzhiyun are from 0 to 15. 58*4882a593Smuzhiyun mediatek,rdsel: An integer describing the steps for input level shifter 59*4882a593Smuzhiyun duty cycle when asserted (high pulse width adjustment). Valid arguments 60*4882a593Smuzhiyun are from 0 to 63. 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun When config drive-strength, it can support some arguments, such as 63*4882a593Smuzhiyun MTK_DRIVE_4mA, MTK_DRIVE_6mA, etc. See dt-bindings/pinctrl/mt65xx.h. 64*4882a593Smuzhiyun It can only support 2/4/6/8/10/12/14/16mA in mt8183. 65*4882a593Smuzhiyun For I2C pins, there are existing generic driving setup and the specific 66*4882a593Smuzhiyun driving setup. I2C pins can only support 2/4/6/8/10/12/14/16mA driving 67*4882a593Smuzhiyun adjustment in generic driving setup. But in specific driving setup, 68*4882a593Smuzhiyun they can support 0.125/0.25/0.5/1mA adjustment. If we enable specific 69*4882a593Smuzhiyun driving setup for I2C pins, the existing generic driving setup will be 70*4882a593Smuzhiyun disabled. For some special features, we need the I2C pins specific 71*4882a593Smuzhiyun driving setup. The specific driving setup is controlled by E1E0EN. 72*4882a593Smuzhiyun So we need add extra vendor driving preperty instead of 73*4882a593Smuzhiyun the generic driving property. 74*4882a593Smuzhiyun We can add "mediatek,drive-strength-adv = <XXX>;" to describe the specific 75*4882a593Smuzhiyun driving setup property. "XXX" means the value of E1E0EN. EN is 0 or 1. 76*4882a593Smuzhiyun It is used to enable or disable the specific driving setup. 77*4882a593Smuzhiyun E1E0 is used to describe the detail strength specification of the I2C pin. 78*4882a593Smuzhiyun When E1=0/E0=0, the strength is 0.125mA. 79*4882a593Smuzhiyun When E1=0/E0=1, the strength is 0.25mA. 80*4882a593Smuzhiyun When E1=1/E0=0, the strength is 0.5mA. 81*4882a593Smuzhiyun When E1=1/E0=1, the strength is 1mA. 82*4882a593Smuzhiyun So the valid arguments of "mediatek,drive-strength-adv" are from 0 to 7. 83*4882a593Smuzhiyun 84*4882a593SmuzhiyunExamples: 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun#include "mt8183-pinfunc.h" 87*4882a593Smuzhiyun 88*4882a593Smuzhiyun... 89*4882a593Smuzhiyun{ 90*4882a593Smuzhiyun pio: pinctrl@10005000 { 91*4882a593Smuzhiyun compatible = "mediatek,mt8183-pinctrl"; 92*4882a593Smuzhiyun reg = <0 0x10005000 0 0x1000>, 93*4882a593Smuzhiyun <0 0x11f20000 0 0x1000>, 94*4882a593Smuzhiyun <0 0x11e80000 0 0x1000>, 95*4882a593Smuzhiyun <0 0x11e70000 0 0x1000>, 96*4882a593Smuzhiyun <0 0x11e90000 0 0x1000>, 97*4882a593Smuzhiyun <0 0x11d30000 0 0x1000>, 98*4882a593Smuzhiyun <0 0x11d20000 0 0x1000>, 99*4882a593Smuzhiyun <0 0x11c50000 0 0x1000>, 100*4882a593Smuzhiyun <0 0x11f30000 0 0x1000>, 101*4882a593Smuzhiyun <0 0x1000b000 0 0x1000>; 102*4882a593Smuzhiyun reg-names = "iocfg0", "iocfg1", "iocfg2", 103*4882a593Smuzhiyun "iocfg3", "iocfg4", "iocfg5", 104*4882a593Smuzhiyun "iocfg6", "iocfg7", "iocfg8", 105*4882a593Smuzhiyun "eint"; 106*4882a593Smuzhiyun gpio-controller; 107*4882a593Smuzhiyun #gpio-cells = <2>; 108*4882a593Smuzhiyun gpio-ranges = <&pio 0 0 192>; 109*4882a593Smuzhiyun interrupt-controller; 110*4882a593Smuzhiyun interrupts = <GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH>; 111*4882a593Smuzhiyun #interrupt-cells = <2>; 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun i2c0_pins_a: i2c0 { 114*4882a593Smuzhiyun pins1 { 115*4882a593Smuzhiyun pinmux = <PINMUX_GPIO48__FUNC_SCL5>, 116*4882a593Smuzhiyun <PINMUX_GPIO49__FUNC_SDA5>; 117*4882a593Smuzhiyun mediatek,pull-up-adv = <3>; 118*4882a593Smuzhiyun mediatek,drive-strength-adv = <7>; 119*4882a593Smuzhiyun }; 120*4882a593Smuzhiyun }; 121*4882a593Smuzhiyun 122*4882a593Smuzhiyun i2c1_pins_a: i2c1 { 123*4882a593Smuzhiyun pins { 124*4882a593Smuzhiyun pinmux = <PINMUX_GPIO50__FUNC_SCL3>, 125*4882a593Smuzhiyun <PINMUX_GPIO51__FUNC_SDA3>; 126*4882a593Smuzhiyun mediatek,pull-down-adv = <2>; 127*4882a593Smuzhiyun mediatek,drive-strength-adv = <4>; 128*4882a593Smuzhiyun }; 129*4882a593Smuzhiyun }; 130*4882a593Smuzhiyun ... 131*4882a593Smuzhiyun }; 132*4882a593Smuzhiyun}; 133