blob: 4598a47aa0cd130d1a01ab78027c867fb8a5f971 [file] [log] [blame]
Thomas Abraham30574f02012-09-07 06:07:19 +09001Samsung GPIO and Pin Mux/Config controller
2
3Samsung's ARM based SoC's integrates a GPIO and Pin mux/config hardware
4controller. It controls the input/output settings on the available pads/pins
5and also provides ability to multiplex and configure the output of various
6on-chip controllers onto these pads.
7
8Required Properties:
9- compatible: should be one of the following.
Kukjin Kimb533c862013-01-02 16:05:42 -080010 - "samsung,exynos4210-pinctrl": for Exynos4210 compatible pin-controller.
11 - "samsung,exynos4x12-pinctrl": for Exynos4x12 compatible pin-controller.
12 - "samsung,exynos5250-pinctrl": for Exynos5250 compatible pin-controller.
Thomas Abraham30574f02012-09-07 06:07:19 +090013
14- reg: Base address of the pin controller hardware module and length of
15 the address space it occupies.
16
Tomasz Figab33ef912012-10-11 10:11:21 +020017- Pin banks as child nodes: Pin banks of the controller are represented by child
18 nodes of the controller node. Bank name is taken from name of the node. Each
19 bank node must contain following properties:
20
21 - gpio-controller: identifies the node as a gpio controller and pin bank.
22 - #gpio-cells: number of cells in GPIO specifier. Since the generic GPIO
23 binding is used, the amount of cells must be specified as 2. See generic
24 GPIO binding documentation for description of particular cells.
Thomas Abraham30574f02012-09-07 06:07:19 +090025
26- Pin mux/config groups as child nodes: The pin mux (selecting pin function
27 mode) and pin config (pull up/down, driver strength) settings are represented
28 as child nodes of the pin-controller node. There should be atleast one
29 child node and there is no limit on the count of these child nodes.
30
31 The child node should contain a list of pin(s) on which a particular pin
32 function selection or pin configuration (or both) have to applied. This
33 list of pins is specified using the property name "samsung,pins". There
34 should be atleast one pin specfied for this property and there is no upper
35 limit on the count of pins that can be specified. The pins are specified
36 using pin names which are derived from the hardware manual of the SoC. As
37 an example, the pins in GPA0 bank of the pin controller can be represented
38 as "gpa0-0", "gpa0-1", "gpa0-2" and so on. The names should be in lower case.
39 The format of the pin names should be (as per the hardware manual)
40 "[pin bank name]-[pin number within the bank]".
41
42 The pin function selection that should be applied on the pins listed in the
43 child node is specified using the "samsung,pin-function" property. The value
44 of this property that should be applied to each of the pins listed in the
45 "samsung,pins" property should be picked from the hardware manual of the SoC
46 for the specified pin group. This property is optional in the child node if
47 no specific function selection is desired for the pins listed in the child
48 node. The value of this property is used as-is to program the pin-controller
49 function selector register of the pin-bank.
50
51 The child node can also optionally specify one or more of the pin
52 configuration that should be applied on all the pins listed in the
53 "samsung,pins" property of the child node. The following pin configuration
54 properties are supported.
55
56 - samsung,pin-pud: Pull up/down configuration.
57 - samsung,pin-drv: Drive strength configuration.
58 - samsung,pin-pud-pdn: Pull up/down configuration in power down mode.
59 - samsung,pin-drv-pdn: Drive strength configuration in power down mode.
60
61 The values specified by these config properties should be derived from the
62 hardware manual and these values are programmed as-is into the pin
63 pull up/down and driver strength register of the pin-controller.
64
65 Note: A child should include atleast a pin function selection property or
66 pin configuration property (one or more) or both.
67
68 The client nodes that require a particular pin function selection and/or
69 pin configuration should use the bindings listed in the "pinctrl-bindings.txt"
70 file.
71
72External GPIO and Wakeup Interrupts:
73
74The controller supports two types of external interrupts over gpio. The first
75is the external gpio interrupt and second is the external wakeup interrupts.
76The difference between the two is that the external wakeup interrupts can be
77used as system wakeup events.
78
79A. External GPIO Interrupts: For supporting external gpio interrupts, the
80 following properties should be specified in the pin-controller device node.
81
Tomasz Figab33ef912012-10-11 10:11:21 +020082 - interrupt-parent: phandle of the interrupt parent to which the external
83 GPIO interrupts are forwarded to.
84 - interrupts: interrupt specifier for the controller. The format and value of
85 the interrupt specifier depends on the interrupt parent for the controller.
86
87 In addition, following properties must be present in node of every bank
88 of pins supporting GPIO interrupts:
89
90 - interrupt-controller: identifies the controller node as interrupt-parent.
91 - #interrupt-cells: the value of this property should be 2.
92 - First Cell: represents the external gpio interrupt number local to the
93 external gpio interrupt space of the controller.
94 - Second Cell: flags to identify the type of the interrupt
95 - 1 = rising edge triggered
96 - 2 = falling edge triggered
97 - 3 = rising and falling edge triggered
98 - 4 = high level triggered
99 - 8 = low level triggered
Thomas Abraham30574f02012-09-07 06:07:19 +0900100
101B. External Wakeup Interrupts: For supporting external wakeup interrupts, a
102 child node representing the external wakeup interrupt controller should be
103 included in the pin-controller device node. This child node should include
104 the following properties.
105
106 - compatible: identifies the type of the external wakeup interrupt controller
107 The possible values are:
108 - samsung,exynos4210-wakeup-eint: represents wakeup interrupt controller
109 found on Samsung Exynos4210 SoC.
110 - interrupt-parent: phandle of the interrupt parent to which the external
111 wakeup interrupts are forwarded to.
Tomasz Figab33ef912012-10-11 10:11:21 +0200112 - interrupts: interrupt used by multiplexed wakeup interrupts.
113
114 In addition, following properties must be present in node of every bank
115 of pins supporting wake-up interrupts:
116
Thomas Abraham30574f02012-09-07 06:07:19 +0900117 - interrupt-controller: identifies the node as interrupt-parent.
118 - #interrupt-cells: the value of this property should be 2
119 - First Cell: represents the external wakeup interrupt number local to
120 the external wakeup interrupt space of the controller.
121 - Second Cell: flags to identify the type of the interrupt
122 - 1 = rising edge triggered
123 - 2 = falling edge triggered
124 - 3 = rising and falling edge triggered
125 - 4 = high level triggered
126 - 8 = low level triggered
127
Tomasz Figab33ef912012-10-11 10:11:21 +0200128 Node of every bank of pins supporting direct wake-up interrupts (without
129 multiplexing) must contain following properties:
130
131 - interrupt-parent: phandle of the interrupt parent to which the external
132 wakeup interrupts are forwarded to.
133 - interrupts: interrupts of the interrupt parent which are used for external
134 wakeup interrupts from pins of the bank, must contain interrupts for all
135 pins of the bank.
136
Thomas Abraham30574f02012-09-07 06:07:19 +0900137Aliases:
138
139All the pin controller nodes should be represented in the aliases node using
140the following format 'pinctrl{n}' where n is a unique number for the alias.
141
Tomasz Figab33ef912012-10-11 10:11:21 +0200142Example: A pin-controller node with pin banks:
143
144 pinctrl_0: pinctrl@11400000 {
Kukjin Kimb533c862013-01-02 16:05:42 -0800145 compatible = "samsung,exynos4210-pinctrl";
Tomasz Figab33ef912012-10-11 10:11:21 +0200146 reg = <0x11400000 0x1000>;
147 interrupts = <0 47 0>;
148
149 /* ... */
150
151 /* Pin bank without external interrupts */
152 gpy0: gpy0 {
153 gpio-controller;
154 #gpio-cells = <2>;
155 };
156
157 /* ... */
158
159 /* Pin bank with external GPIO or muxed wake-up interrupts */
160 gpj0: gpj0 {
161 gpio-controller;
162 #gpio-cells = <2>;
163
164 interrupt-controller;
165 #interrupt-cells = <2>;
166 };
167
168 /* ... */
169
170 /* Pin bank with external direct wake-up interrupts */
171 gpx0: gpx0 {
172 gpio-controller;
173 #gpio-cells = <2>;
174
175 interrupt-controller;
176 interrupt-parent = <&gic>;
177 interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>,
178 <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>;
179 #interrupt-cells = <2>;
180 };
181
182 /* ... */
183 };
184
Thomas Abraham30574f02012-09-07 06:07:19 +0900185Example 1: A pin-controller node with pin groups.
186
187 pinctrl_0: pinctrl@11400000 {
Kukjin Kimb533c862013-01-02 16:05:42 -0800188 compatible = "samsung,exynos4210-pinctrl";
Thomas Abraham30574f02012-09-07 06:07:19 +0900189 reg = <0x11400000 0x1000>;
190 interrupts = <0 47 0>;
191
Tomasz Figab33ef912012-10-11 10:11:21 +0200192 /* ... */
193
Thomas Abraham30574f02012-09-07 06:07:19 +0900194 uart0_data: uart0-data {
195 samsung,pins = "gpa0-0", "gpa0-1";
196 samsung,pin-function = <2>;
197 samsung,pin-pud = <0>;
198 samsung,pin-drv = <0>;
199 };
200
201 uart0_fctl: uart0-fctl {
202 samsung,pins = "gpa0-2", "gpa0-3";
203 samsung,pin-function = <2>;
204 samsung,pin-pud = <0>;
205 samsung,pin-drv = <0>;
206 };
207
208 uart1_data: uart1-data {
209 samsung,pins = "gpa0-4", "gpa0-5";
210 samsung,pin-function = <2>;
211 samsung,pin-pud = <0>;
212 samsung,pin-drv = <0>;
213 };
214
215 uart1_fctl: uart1-fctl {
216 samsung,pins = "gpa0-6", "gpa0-7";
217 samsung,pin-function = <2>;
218 samsung,pin-pud = <0>;
219 samsung,pin-drv = <0>;
220 };
221
222 i2c2_bus: i2c2-bus {
223 samsung,pins = "gpa0-6", "gpa0-7";
224 samsung,pin-function = <3>;
225 samsung,pin-pud = <3>;
226 samsung,pin-drv = <0>;
227 };
228 };
229
230Example 2: A pin-controller node with external wakeup interrupt controller node.
231
232 pinctrl_1: pinctrl@11000000 {
Kukjin Kimb533c862013-01-02 16:05:42 -0800233 compatible = "samsung,exynos4210-pinctrl";
Thomas Abraham30574f02012-09-07 06:07:19 +0900234 reg = <0x11000000 0x1000>;
Tomasz Figab33ef912012-10-11 10:11:21 +0200235 interrupts = <0 46 0>
Thomas Abraham30574f02012-09-07 06:07:19 +0900236
Tomasz Figab33ef912012-10-11 10:11:21 +0200237 /* ... */
238
239 wakeup-interrupt-controller {
Thomas Abraham30574f02012-09-07 06:07:19 +0900240 compatible = "samsung,exynos4210-wakeup-eint";
241 interrupt-parent = <&gic>;
Tomasz Figab33ef912012-10-11 10:11:21 +0200242 interrupts = <0 32 0>;
Thomas Abraham30574f02012-09-07 06:07:19 +0900243 };
244 };
245
246Example 3: A uart client node that supports 'default' and 'flow-control' states.
247
248 uart@13800000 {
249 compatible = "samsung,exynos4210-uart";
250 reg = <0x13800000 0x100>;
251 interrupts = <0 52 0>;
252 pinctrl-names = "default", "flow-control;
253 pinctrl-0 = <&uart0_data>;
254 pinctrl-1 = <&uart0_data &uart0_fctl>;
255 };
256
257Example 4: Set up the default pin state for uart controller.
258
259 static int s3c24xx_serial_probe(struct platform_device *pdev) {
260 struct pinctrl *pinctrl;
Tomasz Figab33ef912012-10-11 10:11:21 +0200261
262 /* ... */
263
Thomas Abraham30574f02012-09-07 06:07:19 +0900264 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
265 }