1*4882a593Smuzhiyun* STM32 GPIO and Pin Mux/Config controller 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunSTMicroelectronics's STM32 MCUs intregrate a GPIO and Pin mux/config hardware 4*4882a593Smuzhiyuncontroller. It controls the input/output settings on the available pins and 5*4882a593Smuzhiyunalso provides ability to multiplex and configure the output of various on-chip 6*4882a593Smuzhiyuncontrollers onto these pads. 7*4882a593Smuzhiyun 8*4882a593SmuzhiyunPin controller node: 9*4882a593SmuzhiyunRequired properies: 10*4882a593Smuzhiyun - compatible: value should be one of the following: 11*4882a593Smuzhiyun (a) "st,stm32f429-pinctrl" 12*4882a593Smuzhiyun (b) "st,stm32f746-pinctrl" 13*4882a593Smuzhiyun - #address-cells: The value of this property must be 1 14*4882a593Smuzhiyun - #size-cells : The value of this property must be 1 15*4882a593Smuzhiyun - ranges : defines mapping between pin controller node (parent) to 16*4882a593Smuzhiyun gpio-bank node (children). 17*4882a593Smuzhiyun - pins-are-numbered: Specify the subnodes are using numbered pinmux to 18*4882a593Smuzhiyun specify pins. 19*4882a593Smuzhiyun 20*4882a593SmuzhiyunGPIO controller/bank node: 21*4882a593SmuzhiyunRequired properties: 22*4882a593Smuzhiyun - gpio-controller : Indicates this device is a GPIO controller 23*4882a593Smuzhiyun - #gpio-cells : Should be two. 24*4882a593Smuzhiyun The first cell is the pin number 25*4882a593Smuzhiyun The second one is the polarity: 26*4882a593Smuzhiyun - 0 for active high 27*4882a593Smuzhiyun - 1 for active low 28*4882a593Smuzhiyun - reg : The gpio address range, relative to the pinctrl range 29*4882a593Smuzhiyun - clocks : clock that drives this bank 30*4882a593Smuzhiyun - st,bank-name : Should be a name string for this bank as specified in 31*4882a593Smuzhiyun the datasheet 32*4882a593Smuzhiyun 33*4882a593SmuzhiyunOptional properties: 34*4882a593Smuzhiyun - reset: : Reference to the reset controller 35*4882a593Smuzhiyun - interrupt-parent: phandle of the interrupt parent to which the external 36*4882a593Smuzhiyun GPIO interrupts are forwarded to. 37*4882a593Smuzhiyun - st,syscfg: Should be phandle/offset pair. The phandle to the syscon node 38*4882a593Smuzhiyun which includes IRQ mux selection register, and the offset of the IRQ mux 39*4882a593Smuzhiyun selection register. 40*4882a593Smuzhiyun 41*4882a593SmuzhiyunExample: 42*4882a593Smuzhiyun#include <dt-bindings/pinctrl/stm32f429-pinfunc.h> 43*4882a593Smuzhiyun... 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun pin-controller { 46*4882a593Smuzhiyun #address-cells = <1>; 47*4882a593Smuzhiyun #size-cells = <1>; 48*4882a593Smuzhiyun compatible = "st,stm32f429-pinctrl"; 49*4882a593Smuzhiyun ranges = <0 0x40020000 0x3000>; 50*4882a593Smuzhiyun pins-are-numbered; 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun gpioa: gpio@40020000 { 53*4882a593Smuzhiyun gpio-controller; 54*4882a593Smuzhiyun #gpio-cells = <2>; 55*4882a593Smuzhiyun reg = <0x0 0x400>; 56*4882a593Smuzhiyun resets = <&reset_ahb1 0>; 57*4882a593Smuzhiyun st,bank-name = "GPIOA"; 58*4882a593Smuzhiyun }; 59*4882a593Smuzhiyun ... 60*4882a593Smuzhiyun pin-functions nodes follow... 61*4882a593Smuzhiyun }; 62*4882a593Smuzhiyun 63*4882a593SmuzhiyunContents of function subnode node: 64*4882a593Smuzhiyun---------------------------------- 65*4882a593SmuzhiyunSubnode format 66*4882a593SmuzhiyunA pinctrl node should contain at least one subnode representing the 67*4882a593Smuzhiyunpinctrl group available on the machine. Each subnode will list the 68*4882a593Smuzhiyunpins it needs, and how they should be configured, with regard to muxer 69*4882a593Smuzhiyunconfiguration, pullups, drive, output high/low and output speed. 70*4882a593Smuzhiyun 71*4882a593Smuzhiyun node { 72*4882a593Smuzhiyun pinmux = <PIN_NUMBER_PINMUX>; 73*4882a593Smuzhiyun GENERIC_PINCONFIG; 74*4882a593Smuzhiyun }; 75*4882a593Smuzhiyun 76*4882a593SmuzhiyunRequired properties: 77*4882a593Smuzhiyun- pinmux: integer array, represents gpio pin number and mux setting. 78*4882a593Smuzhiyun Supported pin number and mux varies for different SoCs, and are defined in 79*4882a593Smuzhiyun dt-bindings/pinctrl/<soc>-pinfunc.h directly. 80*4882a593Smuzhiyun These defines are calculated as: 81*4882a593Smuzhiyun ((port * 16 + line) << 8) | function 82*4882a593Smuzhiyun With: 83*4882a593Smuzhiyun - port: The gpio port index (PA = 0, PB = 1, ..., PK = 11) 84*4882a593Smuzhiyun - line: The line offset within the port (PA0 = 0, PA1 = 1, ..., PA15 = 15) 85*4882a593Smuzhiyun - function: The function number, can be: 86*4882a593Smuzhiyun * 0 : GPIO IN 87*4882a593Smuzhiyun * 1 : Alternate Function 0 88*4882a593Smuzhiyun * 2 : Alternate Function 1 89*4882a593Smuzhiyun * 3 : Alternate Function 2 90*4882a593Smuzhiyun * ... 91*4882a593Smuzhiyun * 16 : Alternate Function 15 92*4882a593Smuzhiyun * 17 : Analog 93*4882a593Smuzhiyun * 18 : GPIO OUT 94*4882a593Smuzhiyun 95*4882a593SmuzhiyunOptional properties: 96*4882a593Smuzhiyun- GENERIC_PINCONFIG: is the generic pinconfig options to use. 97*4882a593Smuzhiyun Available options are: 98*4882a593Smuzhiyun - bias-disable, 99*4882a593Smuzhiyun - bias-pull-down, 100*4882a593Smuzhiyun - bias-pull-up, 101*4882a593Smuzhiyun - drive-push-pull, 102*4882a593Smuzhiyun - drive-open-drain, 103*4882a593Smuzhiyun - output-low 104*4882a593Smuzhiyun - output-high 105*4882a593Smuzhiyun - slew-rate = <x>, with x being: 106*4882a593Smuzhiyun < 0 > : Low speed 107*4882a593Smuzhiyun < 1 > : Medium speed 108*4882a593Smuzhiyun < 2 > : Fast speed 109*4882a593Smuzhiyun < 3 > : High speed 110*4882a593Smuzhiyun 111*4882a593SmuzhiyunExample: 112*4882a593Smuzhiyun 113*4882a593Smuzhiyunpin-controller { 114*4882a593Smuzhiyun... 115*4882a593Smuzhiyun usart1_pins_a: usart1@0 { 116*4882a593Smuzhiyun pins1 { 117*4882a593Smuzhiyun pinmux = <STM32F429_PA9_FUNC_USART1_TX>; 118*4882a593Smuzhiyun bias-disable; 119*4882a593Smuzhiyun drive-push-pull; 120*4882a593Smuzhiyun slew-rate = <0>; 121*4882a593Smuzhiyun }; 122*4882a593Smuzhiyun pins2 { 123*4882a593Smuzhiyun pinmux = <STM32F429_PA10_FUNC_USART1_RX>; 124*4882a593Smuzhiyun bias-disable; 125*4882a593Smuzhiyun }; 126*4882a593Smuzhiyun }; 127*4882a593Smuzhiyun}; 128*4882a593Smuzhiyun 129*4882a593Smuzhiyun&usart1 { 130*4882a593Smuzhiyun pinctrl-0 = <&usart1_pins_a>; 131*4882a593Smuzhiyun pinctrl-names = "default"; 132*4882a593Smuzhiyun status = "okay"; 133*4882a593Smuzhiyun}; 134