xref: /freebsd/sys/contrib/device-tree/Bindings/pinctrl/atmel,at91-pinctrl.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel Vadot* Atmel AT91 Pinmux Controller
2*c66ec88fSEmmanuel Vadot
3*c66ec88fSEmmanuel VadotThe AT91 Pinmux Controller, enables the IC
4*c66ec88fSEmmanuel Vadotto share one PAD to several functional blocks. The sharing is done by
5*c66ec88fSEmmanuel Vadotmultiplexing the PAD input/output signals. For each PAD there are up to
6*c66ec88fSEmmanuel Vadot8 muxing options (called periph modes). Since different modules require
7*c66ec88fSEmmanuel Vadotdifferent PAD settings (like pull up, keeper, etc) the controller controls
8*c66ec88fSEmmanuel Vadotalso the PAD settings parameters.
9*c66ec88fSEmmanuel Vadot
10*c66ec88fSEmmanuel VadotPlease refer to pinctrl-bindings.txt in this directory for details of the
11*c66ec88fSEmmanuel Vadotcommon pinctrl bindings used by client devices, including the meaning of the
12*c66ec88fSEmmanuel Vadotphrase "pin configuration node".
13*c66ec88fSEmmanuel Vadot
14*c66ec88fSEmmanuel VadotAtmel AT91 pin configuration node is a node of a group of pins which can be
15*c66ec88fSEmmanuel Vadotused for a specific device or function. This node represents both mux and config
16*c66ec88fSEmmanuel Vadotof the pins in that group. The 'pins' selects the function mode(also named pin
17*c66ec88fSEmmanuel Vadotmode) this pin can work on and the 'config' configures various pad settings
18*c66ec88fSEmmanuel Vadotsuch as pull-up, multi drive, etc.
19*c66ec88fSEmmanuel Vadot
20*c66ec88fSEmmanuel VadotRequired properties for iomux controller:
21*c66ec88fSEmmanuel Vadot- compatible: "atmel,at91rm9200-pinctrl" or "atmel,at91sam9x5-pinctrl"
22*c66ec88fSEmmanuel Vadot		or "atmel,sama5d3-pinctrl" or "microchip,sam9x60-pinctrl"
23*c66ec88fSEmmanuel Vadot- atmel,mux-mask: array of mask (periph per bank) to describe if a pin can be
24*c66ec88fSEmmanuel Vadot  configured in this periph mode. All the periph and bank need to be describe.
25*c66ec88fSEmmanuel Vadot
26*c66ec88fSEmmanuel VadotHow to create such array:
27*c66ec88fSEmmanuel Vadot
28*c66ec88fSEmmanuel VadotEach column will represent the possible peripheral of the pinctrl
29*c66ec88fSEmmanuel VadotEach line will represent a pio bank
30*c66ec88fSEmmanuel Vadot
31*c66ec88fSEmmanuel VadotTake an example on the 9260
32*c66ec88fSEmmanuel VadotPeripheral: 2 ( A and B)
33*c66ec88fSEmmanuel VadotBank: 3 (A, B and C)
34*c66ec88fSEmmanuel Vadot=>
35*c66ec88fSEmmanuel Vadot
36*c66ec88fSEmmanuel Vadot  /*    A         B     */
37*c66ec88fSEmmanuel Vadot  0xffffffff 0xffc00c3b  /* pioA */
38*c66ec88fSEmmanuel Vadot  0xffffffff 0x7fff3ccf  /* pioB */
39*c66ec88fSEmmanuel Vadot  0xffffffff 0x007fffff  /* pioC */
40*c66ec88fSEmmanuel Vadot
41*c66ec88fSEmmanuel VadotFor each peripheral/bank we will describe in a u32 if a pin can be
42*c66ec88fSEmmanuel Vadotconfigured in it by putting 1 to the pin bit (1 << pin)
43*c66ec88fSEmmanuel Vadot
44*c66ec88fSEmmanuel VadotLet's take the pioA on peripheral B
45*c66ec88fSEmmanuel VadotFrom the datasheet Table 10-2.
46*c66ec88fSEmmanuel VadotPeripheral B
47*c66ec88fSEmmanuel VadotPA0	MCDB0
48*c66ec88fSEmmanuel VadotPA1	MCCDB
49*c66ec88fSEmmanuel VadotPA2
50*c66ec88fSEmmanuel VadotPA3	MCDB3
51*c66ec88fSEmmanuel VadotPA4	MCDB2
52*c66ec88fSEmmanuel VadotPA5	MCDB1
53*c66ec88fSEmmanuel VadotPA6
54*c66ec88fSEmmanuel VadotPA7
55*c66ec88fSEmmanuel VadotPA8
56*c66ec88fSEmmanuel VadotPA9
57*c66ec88fSEmmanuel VadotPA10	ETX2
58*c66ec88fSEmmanuel VadotPA11	ETX3
59*c66ec88fSEmmanuel VadotPA12
60*c66ec88fSEmmanuel VadotPA13
61*c66ec88fSEmmanuel VadotPA14
62*c66ec88fSEmmanuel VadotPA15
63*c66ec88fSEmmanuel VadotPA16
64*c66ec88fSEmmanuel VadotPA17
65*c66ec88fSEmmanuel VadotPA18
66*c66ec88fSEmmanuel VadotPA19
67*c66ec88fSEmmanuel VadotPA20
68*c66ec88fSEmmanuel VadotPA21
69*c66ec88fSEmmanuel VadotPA22	ETXER
70*c66ec88fSEmmanuel VadotPA23	ETX2
71*c66ec88fSEmmanuel VadotPA24	ETX3
72*c66ec88fSEmmanuel VadotPA25	ERX2
73*c66ec88fSEmmanuel VadotPA26	ERX3
74*c66ec88fSEmmanuel VadotPA27	ERXCK
75*c66ec88fSEmmanuel VadotPA28	ECRS
76*c66ec88fSEmmanuel VadotPA29	ECOL
77*c66ec88fSEmmanuel VadotPA30	RXD4
78*c66ec88fSEmmanuel VadotPA31	TXD4
79*c66ec88fSEmmanuel Vadot
80*c66ec88fSEmmanuel Vadot=> 0xffc00c3b
81*c66ec88fSEmmanuel Vadot
82*c66ec88fSEmmanuel VadotRequired properties for pin configuration node:
83*c66ec88fSEmmanuel Vadot- atmel,pins: 4 integers array, represents a group of pins mux and config
84*c66ec88fSEmmanuel Vadot  setting. The format is atmel,pins = <PIN_BANK PIN_BANK_NUM PERIPH CONFIG>.
85*c66ec88fSEmmanuel Vadot  The PERIPH 0 means gpio, PERIPH 1 is periph A, PERIPH 2 is periph B...
86*c66ec88fSEmmanuel Vadot  PIN_BANK 0 is pioA, PIN_BANK 1 is pioB...
87*c66ec88fSEmmanuel Vadot
88*c66ec88fSEmmanuel VadotBits used for CONFIG:
89*c66ec88fSEmmanuel VadotPULL_UP		(1 << 0): indicate this pin needs a pull up.
90*c66ec88fSEmmanuel VadotMULTIDRIVE	(1 << 1): indicate this pin needs to be configured as multi-drive.
91*c66ec88fSEmmanuel Vadot			Multi-drive is equivalent to open-drain type output.
92*c66ec88fSEmmanuel VadotDEGLITCH	(1 << 2): indicate this pin needs deglitch.
93*c66ec88fSEmmanuel VadotPULL_DOWN	(1 << 3): indicate this pin needs a pull down.
94*c66ec88fSEmmanuel VadotDIS_SCHMIT	(1 << 4): indicate this pin needs to the disable schmitt trigger.
95*c66ec88fSEmmanuel VadotDRIVE_STRENGTH (3 << 5): indicate the drive strength of the pin using the
96*c66ec88fSEmmanuel Vadot			following values:
97*c66ec88fSEmmanuel Vadot				00 - No change (reset state value kept)
98*c66ec88fSEmmanuel Vadot				01 - Low
99*c66ec88fSEmmanuel Vadot				10 - Medium
100*c66ec88fSEmmanuel Vadot				11 - High
101*c66ec88fSEmmanuel VadotOUTPUT		(1 << 7): indicate this pin need to be configured as an output.
102*c66ec88fSEmmanuel VadotOUTPUT_VAL	(1 << 8): output val (1 = high, 0 = low)
103*c66ec88fSEmmanuel VadotSLEWRATE	(1 << 9): slew rate of the pin: 0 = disable, 1 = enable
104*c66ec88fSEmmanuel VadotDEBOUNCE	(1 << 16): indicate this pin needs debounce.
105*c66ec88fSEmmanuel VadotDEBOUNCE_VAL	(0x3fff << 17): debounce value.
106*c66ec88fSEmmanuel Vadot
107*c66ec88fSEmmanuel VadotNOTE:
108*c66ec88fSEmmanuel VadotSome requirements for using atmel,at91rm9200-pinctrl binding:
109*c66ec88fSEmmanuel Vadot1. We have pin function node defined under at91 controller node to represent
110*c66ec88fSEmmanuel Vadot   what pinmux functions this SoC supports.
111*c66ec88fSEmmanuel Vadot2. The driver can use the function node's name and pin configuration node's
112*c66ec88fSEmmanuel Vadot   name describe the pin function and group hierarchy.
113*c66ec88fSEmmanuel Vadot   For example, Linux at91 pinctrl driver takes the function node's name
114*c66ec88fSEmmanuel Vadot   as the function name and pin configuration node's name as group name to
115*c66ec88fSEmmanuel Vadot   create the map table.
116*c66ec88fSEmmanuel Vadot3. Each pin configuration node should have a phandle, devices can set pins
117*c66ec88fSEmmanuel Vadot   configurations by referring to the phandle of that pin configuration node.
118*c66ec88fSEmmanuel Vadot4. The gpio controller must be describe in the pinctrl simple-bus.
119*c66ec88fSEmmanuel Vadot
120*c66ec88fSEmmanuel VadotFor each bank the required properties are:
121*c66ec88fSEmmanuel Vadot- compatible: "atmel,at91sam9x5-gpio" or "atmel,at91rm9200-gpio" or
122*c66ec88fSEmmanuel Vadot  "microchip,sam9x60-gpio"
123*c66ec88fSEmmanuel Vadot- reg: physical base address and length of the controller's registers
124*c66ec88fSEmmanuel Vadot- interrupts: interrupt outputs from the controller
125*c66ec88fSEmmanuel Vadot- interrupt-controller: marks the device node as an interrupt controller
126*c66ec88fSEmmanuel Vadot- #interrupt-cells: should be 2; refer to ../interrupt-controller/interrupts.txt
127*c66ec88fSEmmanuel Vadot  for more details.
128*c66ec88fSEmmanuel Vadot- gpio-controller
129*c66ec88fSEmmanuel Vadot- #gpio-cells: should be 2; the first cell is the GPIO number and the second
130*c66ec88fSEmmanuel Vadot  cell specifies GPIO flags as defined in <dt-bindings/gpio/gpio.h>.
131*c66ec88fSEmmanuel Vadot- clocks: bank clock
132*c66ec88fSEmmanuel Vadot
133*c66ec88fSEmmanuel VadotExamples:
134*c66ec88fSEmmanuel Vadot
135*c66ec88fSEmmanuel Vadotpinctrl@fffff400 {
136*c66ec88fSEmmanuel Vadot	#address-cells = <1>;
137*c66ec88fSEmmanuel Vadot	#size-cells = <1>;
138*c66ec88fSEmmanuel Vadot	ranges;
139*c66ec88fSEmmanuel Vadot	compatible = "atmel,at91rm9200-pinctrl", "simple-bus";
140*c66ec88fSEmmanuel Vadot	reg = <0xfffff400 0x600>;
141*c66ec88fSEmmanuel Vadot
142*c66ec88fSEmmanuel Vadot	pioA: gpio@fffff400 {
143*c66ec88fSEmmanuel Vadot		compatible = "atmel,at91sam9x5-gpio";
144*c66ec88fSEmmanuel Vadot		reg = <0xfffff400 0x200>;
145*c66ec88fSEmmanuel Vadot		interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>;
146*c66ec88fSEmmanuel Vadot		#gpio-cells = <2>;
147*c66ec88fSEmmanuel Vadot		gpio-controller;
148*c66ec88fSEmmanuel Vadot		interrupt-controller;
149*c66ec88fSEmmanuel Vadot		#interrupt-cells = <2>;
150*c66ec88fSEmmanuel Vadot		clocks = <&pmc PMC_TYPE_PERIPHERAL 2>;
151*c66ec88fSEmmanuel Vadot	};
152*c66ec88fSEmmanuel Vadot
153*c66ec88fSEmmanuel Vadot	atmel,mux-mask = <
154*c66ec88fSEmmanuel Vadot	      /*    A         B     */
155*c66ec88fSEmmanuel Vadot	       0xffffffff 0xffc00c3b  /* pioA */
156*c66ec88fSEmmanuel Vadot	       0xffffffff 0x7fff3ccf  /* pioB */
157*c66ec88fSEmmanuel Vadot	       0xffffffff 0x007fffff  /* pioC */
158*c66ec88fSEmmanuel Vadot	      >;
159*c66ec88fSEmmanuel Vadot
160*c66ec88fSEmmanuel Vadot	/* shared pinctrl settings */
161*c66ec88fSEmmanuel Vadot	dbgu {
162*c66ec88fSEmmanuel Vadot		pinctrl_dbgu: dbgu-0 {
163*c66ec88fSEmmanuel Vadot			atmel,pins =
164*c66ec88fSEmmanuel Vadot				<1 14 0x1 0x0	/* PB14 periph A */
165*c66ec88fSEmmanuel Vadot				 1 15 0x1 0x1>;	/* PB15 periph A with pullup */
166*c66ec88fSEmmanuel Vadot		};
167*c66ec88fSEmmanuel Vadot	};
168*c66ec88fSEmmanuel Vadot};
169*c66ec88fSEmmanuel Vadot
170*c66ec88fSEmmanuel Vadotdbgu: serial@fffff200 {
171*c66ec88fSEmmanuel Vadot	compatible = "atmel,at91sam9260-usart";
172*c66ec88fSEmmanuel Vadot	reg = <0xfffff200 0x200>;
173*c66ec88fSEmmanuel Vadot	interrupts = <1 4 7>;
174*c66ec88fSEmmanuel Vadot	pinctrl-names = "default";
175*c66ec88fSEmmanuel Vadot	pinctrl-0 = <&pinctrl_dbgu>;
176*c66ec88fSEmmanuel Vadot};
177