1*4882a593Smuzhiyun*ST pin controller. 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunEach multi-function pin is controlled, driven and routed through the 4*4882a593SmuzhiyunPIO multiplexing block. Each pin supports GPIO functionality (ALT0) 5*4882a593Smuzhiyunand multiple alternate functions(ALT1 - ALTx) that directly connect 6*4882a593Smuzhiyunthe pin to different hardware blocks. 7*4882a593Smuzhiyun 8*4882a593SmuzhiyunWhen a pin is in GPIO mode, Output Enable (OE), Open Drain(OD), and 9*4882a593SmuzhiyunPull Up (PU) are driven by the related PIO block. 10*4882a593Smuzhiyun 11*4882a593SmuzhiyunST pinctrl driver controls PIO multiplexing block and also interacts with 12*4882a593Smuzhiyungpio driver to configure a pin. 13*4882a593Smuzhiyun 14*4882a593SmuzhiyunGPIO bank can have one of the two possible types of interrupt-wirings. 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunFirst type is via irqmux, single interrupt is used by multiple gpio banks. This 17*4882a593Smuzhiyunreduces number of overall interrupts numbers required. All these banks belong to 18*4882a593Smuzhiyuna single pincontroller. 19*4882a593Smuzhiyun _________ 20*4882a593Smuzhiyun | |----> [gpio-bank (n) ] 21*4882a593Smuzhiyun | |----> [gpio-bank (n + 1)] 22*4882a593Smuzhiyun [irqN]-- | irq-mux |----> [gpio-bank (n + 2)] 23*4882a593Smuzhiyun | |----> [gpio-bank (... )] 24*4882a593Smuzhiyun |_________|----> [gpio-bank (n + 7)] 25*4882a593Smuzhiyun 26*4882a593SmuzhiyunSecond type has a dedicated interrupt per gpio bank. 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun [irqN]----> [gpio-bank (n)] 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunPin controller node: 32*4882a593SmuzhiyunRequired properties: 33*4882a593Smuzhiyun- compatible : should be "st,stih407-<pio-block>-pinctrl" 34*4882a593Smuzhiyun- st,syscfg : Should be a phandle of the syscfg node. 35*4882a593Smuzhiyun- st,retime-pin-mask : Should be mask to specify which pins can be retimed. 36*4882a593Smuzhiyun If the property is not present, it is assumed that all the pins in the 37*4882a593Smuzhiyun bank are capable of retiming. Retiming is mainly used to improve the 38*4882a593Smuzhiyun IO timing margins of external synchronous interfaces. 39*4882a593Smuzhiyun- ranges : defines mapping between pin controller node (parent) to gpio-bank 40*4882a593Smuzhiyun node (children). 41*4882a593Smuzhiyun 42*4882a593SmuzhiyunOptional properties: 43*4882a593Smuzhiyun- interrupts : Interrupt number of the irqmux. If the interrupt is shared 44*4882a593Smuzhiyun with other gpio banks via irqmux. 45*4882a593Smuzhiyun a irqline and gpio banks. 46*4882a593Smuzhiyun- reg : irqmux memory resource. If irqmux is present. 47*4882a593Smuzhiyun- reg-names : irqmux resource should be named as "irqmux". 48*4882a593Smuzhiyun 49*4882a593SmuzhiyunGPIO controller/bank node. 50*4882a593SmuzhiyunRequired properties: 51*4882a593Smuzhiyun- gpio-controller : Indicates this device is a GPIO controller 52*4882a593Smuzhiyun- #gpio-cells : Must be two. 53*4882a593Smuzhiyun - First cell: specifies the pin number inside the controller 54*4882a593Smuzhiyun - Second cell: specifies whether the pin is logically inverted. 55*4882a593Smuzhiyun - 0 = active high 56*4882a593Smuzhiyun - 1 = active low 57*4882a593Smuzhiyun- st,bank-name : Should be a name string for this bank as specified in 58*4882a593Smuzhiyun datasheet. 59*4882a593Smuzhiyun 60*4882a593SmuzhiyunOptional properties: 61*4882a593Smuzhiyun- interrupts : Interrupt number for this gpio bank. If there is a dedicated 62*4882a593Smuzhiyun interrupt wired up for this gpio bank. 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun- interrupt-controller : Indicates this device is a interrupt controller. GPIO 65*4882a593Smuzhiyun bank can be an interrupt controller iff one of the interrupt type either via 66*4882a593Smuzhiyunirqmux or a dedicated interrupt per bank is specified. 67*4882a593Smuzhiyun 68*4882a593Smuzhiyun- #interrupt-cells: the value of this property should be 2. 69*4882a593Smuzhiyun - First Cell: represents the external gpio interrupt number local to the 70*4882a593Smuzhiyun gpio interrupt space of the controller. 71*4882a593Smuzhiyun - Second Cell: flags to identify the type of the interrupt 72*4882a593Smuzhiyun - 1 = rising edge triggered 73*4882a593Smuzhiyun - 2 = falling edge triggered 74*4882a593Smuzhiyun - 3 = rising and falling edge triggered 75*4882a593Smuzhiyun - 4 = high level triggered 76*4882a593Smuzhiyun - 8 = low level triggered 77*4882a593Smuzhiyunfor related macros look in: 78*4882a593Smuzhiyuninclude/dt-bindings/interrupt-controller/irq.h 79*4882a593Smuzhiyun 80*4882a593SmuzhiyunExample: 81*4882a593Smuzhiyun pin-controller-sbc { 82*4882a593Smuzhiyun #address-cells = <1>; 83*4882a593Smuzhiyun #size-cells = <1>; 84*4882a593Smuzhiyun compatible = "st,stih407-sbc-pinctrl"; 85*4882a593Smuzhiyun st,syscfg = <&syscfg_sbc>; 86*4882a593Smuzhiyun reg = <0x0961f080 0x4>; 87*4882a593Smuzhiyun reg-names = "irqmux"; 88*4882a593Smuzhiyun interrupts = <GIC_SPI 188 IRQ_TYPE_NONE>; 89*4882a593Smuzhiyun interrupt-names = "irqmux"; 90*4882a593Smuzhiyun ranges = <0 0x09610000 0x6000>; 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun pio0: gpio@9610000 { 93*4882a593Smuzhiyun gpio-controller; 94*4882a593Smuzhiyun #gpio-cells = <2>; 95*4882a593Smuzhiyun interrupt-controller; 96*4882a593Smuzhiyun #interrupt-cells = <2>; 97*4882a593Smuzhiyun reg = <0x0 0x100>; 98*4882a593Smuzhiyun st,bank-name = "PIO0"; 99*4882a593Smuzhiyun }; 100*4882a593Smuzhiyun ... 101*4882a593Smuzhiyun pin-functions nodes follow... 102*4882a593Smuzhiyun }; 103*4882a593Smuzhiyun 104*4882a593Smuzhiyun 105*4882a593SmuzhiyunContents of function subnode node: 106*4882a593Smuzhiyun---------------------- 107*4882a593SmuzhiyunRequired properties for pin configuration node: 108*4882a593Smuzhiyun- st,pins : Child node with list of pins with configuration. 109*4882a593Smuzhiyun 110*4882a593SmuzhiyunBelow is the format of how each pin conf should look like. 111*4882a593Smuzhiyun 112*4882a593Smuzhiyun<bank offset mux mode rt_type rt_delay rt_clk> 113*4882a593Smuzhiyun 114*4882a593SmuzhiyunEvery PIO is represented with 4-7 parameters depending on retime configuration. 115*4882a593SmuzhiyunEach parameter is explained as below. 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun-bank : Should be bank phandle to which this PIO belongs. 118*4882a593Smuzhiyun-offset : Offset in the PIO bank. 119*4882a593Smuzhiyun-mux : Should be alternate function number associated this pin. 120*4882a593Smuzhiyun Use same numbers from datasheet. 121*4882a593Smuzhiyun-mode :pin configuration is selected from one of the below values. 122*4882a593Smuzhiyun IN 123*4882a593Smuzhiyun IN_PU 124*4882a593Smuzhiyun OUT 125*4882a593Smuzhiyun BIDIR 126*4882a593Smuzhiyun BIDIR_PU 127*4882a593Smuzhiyun 128*4882a593Smuzhiyun-rt_type Retiming Configuration for the pin. 129*4882a593Smuzhiyun Possible retime configuration are: 130*4882a593Smuzhiyun 131*4882a593Smuzhiyun ------- ------------- 132*4882a593Smuzhiyun value args 133*4882a593Smuzhiyun ------- ------------- 134*4882a593Smuzhiyun NICLK <delay> <clk> 135*4882a593Smuzhiyun ICLK_IO <delay> <clk> 136*4882a593Smuzhiyun BYPASS <delay> 137*4882a593Smuzhiyun DE_IO <delay> <clk> 138*4882a593Smuzhiyun SE_ICLK_IO <delay> <clk> 139*4882a593Smuzhiyun SE_NICLK_IO <delay> <clk> 140*4882a593Smuzhiyun 141*4882a593Smuzhiyun- delay is retime delay in pico seconds as mentioned in data sheet. 142*4882a593Smuzhiyun 143*4882a593Smuzhiyun- rt_clk :clk to be use for retime. 144*4882a593Smuzhiyun Possible values are: 145*4882a593Smuzhiyun CLK_A 146*4882a593Smuzhiyun CLK_B 147*4882a593Smuzhiyun CLK_C 148*4882a593Smuzhiyun CLK_D 149*4882a593Smuzhiyun 150*4882a593SmuzhiyunExample of mmcclk pin which is a bi-direction pull pu with retime config 151*4882a593Smuzhiyunas non inverted clock retimed with CLK_B and delay of 0 pico seconds: 152*4882a593Smuzhiyun 153*4882a593Smuzhiyunpin-controller { 154*4882a593Smuzhiyun ... 155*4882a593Smuzhiyun mmc0 { 156*4882a593Smuzhiyun pinctrl_mmc: mmc { 157*4882a593Smuzhiyun st,pins { 158*4882a593Smuzhiyun mmcclk = <&PIO13 4 ALT4 BIDIR_PU NICLK 0 CLK_B>; 159*4882a593Smuzhiyun ... 160*4882a593Smuzhiyun }; 161*4882a593Smuzhiyun }; 162*4882a593Smuzhiyun ... 163*4882a593Smuzhiyun }; 164*4882a593Smuzhiyun}; 165*4882a593Smuzhiyun 166*4882a593Smuzhiyunsdhci0:sdhci@fe810000{ 167*4882a593Smuzhiyun ... 168*4882a593Smuzhiyun interrupt-parent = <&pio3>; 169*4882a593Smuzhiyun #interrupt-cells = <2>; 170*4882a593Smuzhiyun interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; /* Interrupt line via PIO3-3 */ 171*4882a593Smuzhiyun interrupt-names = "card-detect"; 172*4882a593Smuzhiyun pinctrl-names = "default"; 173*4882a593Smuzhiyun pinctrl-0 = <&pinctrl_mmc>; 174*4882a593Smuzhiyun}; 175