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,stm32h743-pinctrl"
15 "st,stm32mp157-pinctrl"
16 "st,stm32mp157-z-pinctrl"
17 - #address-cells: The value of this property must be 1
18 - #size-cells : The value of this property must be 1
19 - ranges : defines mapping between pin controller node (parent) to
20 gpio-bank node (children).
21 - pins-are-numbered: Specify the subnodes are using numbered pinmux to
24 GPIO controller/bank node:
26 - gpio-controller : Indicates this device is a GPIO controller
27 - #gpio-cells : Should be two.
28 The first cell is the pin number
29 The second one is the polarity:
32 - reg : The gpio address range, relative to the pinctrl range
33 - clocks : clock that drives this bank
34 - st,bank-name : Should be a name string for this bank as specified in
38 - reset: : Reference to the reset controller
39 - interrupt-parent: phandle of the interrupt parent to which the external
40 GPIO interrupts are forwarded to.
41 - st,syscfg: Should be phandle/offset pair. The phandle to the syscon node
42 which includes IRQ mux selection register, and the offset of the IRQ mux
44 - gpio-ranges: Define a dedicated mapping between a pin-controller and
45 a gpio controller. Format is <&phandle a b c> with:
46 -(phandle): phandle of pin-controller.
47 -(a): gpio base offset in range.
48 -(b): pin base offset in range.
49 -(c): gpio count in range
50 This entry has to be used either if there are holes inside a bank:
51 GPIOB0/B1/B2/B14/B15 (see example 2)
52 or if banks are not contiguous:
54 NOTE: If "gpio-ranges" is used for a gpio controller, all gpio-controller
55 have to use a "gpio-ranges" entry.
56 More details in Documentation/devicetree/bindings/gpio/gpio.txt.
59 #include <dt-bindings/pinctrl/stm32f429-pinfunc.h>
65 compatible = "st,stm32f429-pinctrl";
66 ranges = <0 0x40020000 0x3000>;
69 gpioa: gpio@40020000 {
73 resets = <&reset_ahb1 0>;
74 st,bank-name = "GPIOA";
77 pin-functions nodes follow...
81 #include <dt-bindings/pinctrl/stm32f429-pinfunc.h>
84 pinctrl: pin-controller {
87 compatible = "st,stm32f429-pinctrl";
88 ranges = <0 0x40020000 0x3000>;
91 gpioa: gpio@40020000 {
95 resets = <&reset_ahb1 0>;
96 st,bank-name = "GPIOA";
97 gpio-ranges = <&pinctrl 0 0 16>;
100 gpiob: gpio@40020400 {
104 resets = <&reset_ahb1 0>;
105 st,bank-name = "GPIOB";
107 gpio-ranges = <&pinctrl 0 16 3>,
113 pin-functions nodes follow...
117 Contents of function subnode node:
118 ----------------------------------
120 A pinctrl node should contain at least one subnode representing the
121 pinctrl group available on the machine. Each subnode will list the
122 pins it needs, and how they should be configured, with regard to muxer
123 configuration, pullups, drive, output high/low and output speed.
126 pinmux = <PIN_NUMBER_PINMUX>;
131 - pinmux: integer array, represents gpio pin number and mux setting.
132 Supported pin number and mux varies for different SoCs, and are defined in
133 dt-bindings/pinctrl/<soc>-pinfunc.h directly.
134 These defines are calculated as:
135 ((port * 16 + line) << 8) | function
137 - port: The gpio port index (PA = 0, PB = 1, ..., PK = 11)
138 - line: The line offset within the port (PA0 = 0, PA1 = 1, ..., PA15 = 15)
139 - function: The function number, can be:
141 * 1 : Alternate Function 0
142 * 2 : Alternate Function 1
143 * 3 : Alternate Function 2
145 * 16 : Alternate Function 15
148 To simplify the usage, macro is available to generate "pinmux" field.
149 This macro is available here:
150 - include/dt-bindings/pinctrl/stm32-pinfunc.h
152 Some examples of using macro:
153 /* GPIO A9 set as alernate function 2 */
155 pinmux = <STM32_PINMUX('A', 9, AF2)>;
157 /* GPIO A9 set as GPIO */
159 pinmux = <STM32_PINMUX('A', 9, GPIO)>;
161 /* GPIO A9 set as analog */
163 pinmux = <STM32_PINMUX('A', 9, ANALOG)>;
167 - GENERIC_PINCONFIG: is the generic pinconfig options to use.
168 Available options are:
176 - slew-rate = <x>, with x being:
186 usart1_pins_a: usart1@0 {
188 pinmux = <STM32_PINMUX('A', 9, AF7)>;
194 pinmux = <STM32_PINMUX('A', 10, AF7)>;
201 pinctrl-0 = <&usart1_pins_a>;
202 pinctrl-names = "default";