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