1 * STM32 GPIO and Pin Mux/Config controller
3 STMicroelectronics's STM32 MCUs intregrate a GPIO and Pin mux/config hardware
4 controller. It controls the input/output settings on the available pins and
5 also provides ability to multiplex and configure the output of various on-chip
6 controllers onto these pads.
10 - compatible: value should be one of the following:
11 "st,stm32f429-pinctrl"
12 "st,stm32f469-pinctrl"
13 "st,stm32f746-pinctrl"
14 "st,stm32f769-pinctrl"
15 "st,stm32h743-pinctrl"
16 "st,stm32mp157-pinctrl"
17 "st,stm32mp157-z-pinctrl"
18 - #address-cells: The value of this property must be 1
19 - #size-cells : The value of this property must be 1
20 - ranges : defines mapping between pin controller node (parent) to
21 gpio-bank node (children).
22 - pins-are-numbered: Specify the subnodes are using numbered pinmux to
25 GPIO controller/bank node:
27 - gpio-controller : Indicates this device is a GPIO controller
28 - #gpio-cells : Should be two.
29 The first cell is the pin number
30 The second one is the polarity:
33 - reg : The gpio address range, relative to the pinctrl range
34 - clocks : clock that drives this bank
35 - st,bank-name : Should be a name string for this bank as specified in
39 - reset: : Reference to the reset controller
40 - interrupt-parent: phandle of the interrupt parent to which the external
41 GPIO interrupts are forwarded to.
42 - st,syscfg: Should be phandle/offset/mask.
43 -The phandle to the syscon node which includes IRQ mux selection register.
44 -The offset of the IRQ mux selection register
45 -The field mask of IRQ mux, needed if different of 0xf.
46 - gpio-ranges: Define a dedicated mapping between a pin-controller and
47 a gpio controller. Format is <&phandle a b c> with:
48 -(phandle): phandle of pin-controller.
49 -(a): gpio base offset in range.
50 -(b): pin base offset in range.
51 -(c): gpio count in range
52 This entry has to be used either if there are holes inside a bank:
53 GPIOB0/B1/B2/B14/B15 (see example 2)
54 or if banks are not contiguous:
56 NOTE: If "gpio-ranges" is used for a gpio controller, all gpio-controller
57 have to use a "gpio-ranges" entry.
58 More details in Documentation/devicetree/bindings/gpio/gpio.txt.
59 - st,bank-ioport: should correspond to the EXTI IOport selection (EXTI line
60 used to select GPIOs as interrupts).
63 #include <dt-bindings/pinctrl/stm32f429-pinfunc.h>
69 compatible = "st,stm32f429-pinctrl";
70 ranges = <0 0x40020000 0x3000>;
73 gpioa: gpio@40020000 {
77 resets = <&reset_ahb1 0>;
78 st,bank-name = "GPIOA";
81 pin-functions nodes follow...
85 #include <dt-bindings/pinctrl/stm32f429-pinfunc.h>
88 pinctrl: pin-controller {
91 compatible = "st,stm32f429-pinctrl";
92 ranges = <0 0x40020000 0x3000>;
95 gpioa: gpio@40020000 {
99 resets = <&reset_ahb1 0>;
100 st,bank-name = "GPIOA";
101 gpio-ranges = <&pinctrl 0 0 16>;
104 gpiob: gpio@40020400 {
108 resets = <&reset_ahb1 0>;
109 st,bank-name = "GPIOB";
111 gpio-ranges = <&pinctrl 0 16 3>,
117 pin-functions nodes follow...
121 Contents of function subnode node:
122 ----------------------------------
124 A pinctrl node should contain at least one subnode representing the
125 pinctrl group available on the machine. Each subnode will list the
126 pins it needs, and how they should be configured, with regard to muxer
127 configuration, pullups, drive, output high/low and output speed.
130 pinmux = <PIN_NUMBER_PINMUX>;
135 - pinmux: integer array, represents gpio pin number and mux setting.
136 Supported pin number and mux varies for different SoCs, and are defined in
137 dt-bindings/pinctrl/<soc>-pinfunc.h directly.
138 These defines are calculated as:
139 ((port * 16 + line) << 8) | function
141 - port: The gpio port index (PA = 0, PB = 1, ..., PK = 11)
142 - line: The line offset within the port (PA0 = 0, PA1 = 1, ..., PA15 = 15)
143 - function: The function number, can be:
145 * 1 : Alternate Function 0
146 * 2 : Alternate Function 1
147 * 3 : Alternate Function 2
149 * 16 : Alternate Function 15
152 To simplify the usage, macro is available to generate "pinmux" field.
153 This macro is available here:
154 - include/dt-bindings/pinctrl/stm32-pinfunc.h
156 Some examples of using macro:
157 /* GPIO A9 set as alernate function 2 */
159 pinmux = <STM32_PINMUX('A', 9, AF2)>;
161 /* GPIO A9 set as GPIO */
163 pinmux = <STM32_PINMUX('A', 9, GPIO)>;
165 /* GPIO A9 set as analog */
167 pinmux = <STM32_PINMUX('A', 9, ANALOG)>;
171 - GENERIC_PINCONFIG: is the generic pinconfig options to use.
172 Available options are:
180 - slew-rate = <x>, with x being:
190 usart1_pins_a: usart1@0 {
192 pinmux = <STM32_PINMUX('A', 9, AF7)>;
198 pinmux = <STM32_PINMUX('A', 10, AF7)>;
205 pinctrl-0 = <&usart1_pins_a>;
206 pinctrl-names = "default";