Merge remote-tracking branch 'asoc/fix/dapm' into asoc-linus
[sfrench/cifs-2.6.git] / Documentation / devicetree / bindings / pinctrl / samsung-pinctrl.txt
1 Samsung GPIO and Pin Mux/Config controller
2
3 Samsung's ARM based SoC's integrates a GPIO and Pin mux/config hardware
4 controller. It controls the input/output settings on the available pads/pins
5 and also provides ability to multiplex and configure the output of various
6 on-chip controllers onto these pads.
7
8 Required Properties:
9 - compatible: should be one of the following.
10   - "samsung,s3c2412-pinctrl": for S3C2412-compatible pin-controller,
11   - "samsung,s3c2416-pinctrl": for S3C2416-compatible pin-controller,
12   - "samsung,s3c2440-pinctrl": for S3C2440-compatible pin-controller,
13   - "samsung,s3c2450-pinctrl": for S3C2450-compatible pin-controller,
14   - "samsung,s3c64xx-pinctrl": for S3C64xx-compatible pin-controller,
15   - "samsung,s5pv210-pinctrl": for S5PV210-compatible pin-controller,
16   - "samsung,exynos4210-pinctrl": for Exynos4210 compatible pin-controller.
17   - "samsung,exynos4x12-pinctrl": for Exynos4x12 compatible pin-controller.
18   - "samsung,exynos5250-pinctrl": for Exynos5250 compatible pin-controller.
19   - "samsung,exynos5260-pinctrl": for Exynos5260 compatible pin-controller.
20   - "samsung,exynos5410-pinctrl": for Exynos5410 compatible pin-controller.
21   - "samsung,exynos5420-pinctrl": for Exynos5420 compatible pin-controller.
22   - "samsung,exynos5433-pinctrl": for Exynos5433 compatible pin-controller.
23   - "samsung,exynos7-pinctrl": for Exynos7 compatible pin-controller.
24
25 - reg: Base address of the pin controller hardware module and length of
26   the address space it occupies.
27
28   - reg: Second base address of the pin controller if the specific registers
29   of the pin controller are separated into the different base address.
30
31         Eg: GPF[1-5] of Exynos5433 are separated into the two base address.
32         - First base address is for GPAx and GPF[1-5] external interrupt
33           registers.
34         - Second base address is for GPF[1-5] pinctrl registers.
35
36         pinctrl_0: pinctrl@10580000 {
37                 compatible = "samsung,exynos5433-pinctrl";
38                 reg = <0x10580000 0x1a20>, <0x11090000 0x100>;
39
40                 wakeup-interrupt-controller {
41                         compatible = "samsung,exynos7-wakeup-eint";
42                         interrupts = <0 16 0>;
43                 };
44         };
45
46 - Pin banks as child nodes: Pin banks of the controller are represented by child
47   nodes of the controller node. Bank name is taken from name of the node. Each
48   bank node must contain following properties:
49
50   - gpio-controller: identifies the node as a gpio controller and pin bank.
51   - #gpio-cells: number of cells in GPIO specifier. Since the generic GPIO
52     binding is used, the amount of cells must be specified as 2. See the below
53     mentioned gpio binding representation for description of particular cells.
54
55         Eg: <&gpx2 6 0>
56         <[phandle of the gpio controller node]
57         [pin number within the gpio controller]
58         [flags]>
59
60         Values for gpio specifier:
61         - Pin number: is a value between 0 to 7.
62         - Flags: 0 - Active High
63                  1 - Active Low
64
65 - Pin mux/config groups as child nodes: The pin mux (selecting pin function
66   mode) and pin config (pull up/down, driver strength) settings are represented
67   as child nodes of the pin-controller node. There should be atleast one
68   child node and there is no limit on the count of these child nodes. It is
69   also possible for a child node to consist of several further child nodes
70   to allow grouping multiple pinctrl groups into one. The format of second
71   level child nodes is exactly the same as for first level ones and is
72   described below.
73
74   The child node should contain a list of pin(s) on which a particular pin
75   function selection or pin configuration (or both) have to applied. This
76   list of pins is specified using the property name "samsung,pins". There
77   should be atleast one pin specfied for this property and there is no upper
78   limit on the count of pins that can be specified. The pins are specified
79   using pin names which are derived from the hardware manual of the SoC. As
80   an example, the pins in GPA0 bank of the pin controller can be represented
81   as "gpa0-0", "gpa0-1", "gpa0-2" and so on. The names should be in lower case.
82   The format of the pin names should be (as per the hardware manual)
83   "[pin bank name]-[pin number within the bank]".
84
85   The pin function selection that should be applied on the pins listed in the
86   child node is specified using the "samsung,pin-function" property. The value
87   of this property that should be applied to each of the pins listed in the
88   "samsung,pins" property should be picked from the hardware manual of the SoC
89   for the specified pin group. This property is optional in the child node if
90   no specific function selection is desired for the pins listed in the child
91   node. The value of this property is used as-is to program the pin-controller
92   function selector register of the pin-bank.
93
94   The child node can also optionally specify one or more of the pin
95   configuration that should be applied on all the pins listed in the
96   "samsung,pins" property of the child node. The following pin configuration
97   properties are supported.
98
99   - samsung,pin-val: Initial value of pin output buffer.
100   - samsung,pin-pud: Pull up/down configuration.
101   - samsung,pin-drv: Drive strength configuration.
102   - samsung,pin-pud-pdn: Pull up/down configuration in power down mode.
103   - samsung,pin-drv-pdn: Drive strength configuration in power down mode.
104
105   The values specified by these config properties should be derived from the
106   hardware manual and these values are programmed as-is into the pin
107   pull up/down and driver strength register of the pin-controller.
108
109   Note: A child should include atleast a pin function selection property or
110   pin configuration property (one or more) or both.
111
112   The client nodes that require a particular pin function selection and/or
113   pin configuration should use the bindings listed in the "pinctrl-bindings.txt"
114   file.
115
116 External GPIO and Wakeup Interrupts:
117
118 The controller supports two types of external interrupts over gpio. The first
119 is the external gpio interrupt and second is the external wakeup interrupts.
120 The difference between the two is that the external wakeup interrupts can be
121 used as system wakeup events.
122
123 A. External GPIO Interrupts: For supporting external gpio interrupts, the
124    following properties should be specified in the pin-controller device node.
125
126    - interrupt-parent: phandle of the interrupt parent to which the external
127      GPIO interrupts are forwarded to.
128    - interrupts: interrupt specifier for the controller. The format and value of
129      the interrupt specifier depends on the interrupt parent for the controller.
130
131    In addition, following properties must be present in node of every bank
132    of pins supporting GPIO interrupts:
133
134    - interrupt-controller: identifies the controller node as interrupt-parent.
135    - #interrupt-cells: the value of this property should be 2.
136      - First Cell: represents the external gpio interrupt number local to the
137        external gpio interrupt space of the controller.
138      - Second Cell: flags to identify the type of the interrupt
139        - 1 = rising edge triggered
140        - 2 = falling edge triggered
141        - 3 = rising and falling edge triggered
142        - 4 = high level triggered
143        - 8 = low level triggered
144
145 B. External Wakeup Interrupts: For supporting external wakeup interrupts, a
146    child node representing the external wakeup interrupt controller should be
147    included in the pin-controller device node. This child node should include
148    the following properties.
149
150    - compatible: identifies the type of the external wakeup interrupt controller
151      The possible values are:
152      - samsung,s3c2410-wakeup-eint: represents wakeup interrupt controller
153        found on Samsung S3C24xx SoCs except S3C2412 and S3C2413,
154      - samsung,s3c2412-wakeup-eint: represents wakeup interrupt controller
155        found on Samsung S3C2412 and S3C2413 SoCs,
156      - samsung,s3c64xx-wakeup-eint: represents wakeup interrupt controller
157        found on Samsung S3C64xx SoCs,
158      - samsung,exynos4210-wakeup-eint: represents wakeup interrupt controller
159        found on Samsung Exynos4210 and S5PC110/S5PV210 SoCs.
160      - samsung,exynos7-wakeup-eint: represents wakeup interrupt controller
161        found on Samsung Exynos7 SoC.
162    - interrupt-parent: phandle of the interrupt parent to which the external
163      wakeup interrupts are forwarded to.
164    - interrupts: interrupt used by multiplexed wakeup interrupts.
165
166    In addition, following properties must be present in node of every bank
167    of pins supporting wake-up interrupts:
168
169    - interrupt-controller: identifies the node as interrupt-parent.
170    - #interrupt-cells: the value of this property should be 2
171      - First Cell: represents the external wakeup interrupt number local to
172        the external wakeup interrupt space of the controller.
173      - Second Cell: flags to identify the type of the interrupt
174        - 1 = rising edge triggered
175        - 2 = falling edge triggered
176        - 3 = rising and falling edge triggered
177        - 4 = high level triggered
178        - 8 = low level triggered
179
180    Node of every bank of pins supporting direct wake-up interrupts (without
181    multiplexing) must contain following properties:
182
183    - interrupt-parent: phandle of the interrupt parent to which the external
184      wakeup interrupts are forwarded to.
185    - interrupts: interrupts of the interrupt parent which are used for external
186      wakeup interrupts from pins of the bank, must contain interrupts for all
187      pins of the bank.
188
189 Aliases:
190
191 All the pin controller nodes should be represented in the aliases node using
192 the following format 'pinctrl{n}' where n is a unique number for the alias.
193
194 Aliases for controllers compatible with "samsung,exynos7-pinctrl":
195 - pinctrl0: pin controller of ALIVE block,
196 - pinctrl1: pin controller of BUS0 block,
197 - pinctrl2: pin controller of NFC block,
198 - pinctrl3: pin controller of TOUCH block,
199 - pinctrl4: pin controller of FF block,
200 - pinctrl5: pin controller of ESE block,
201 - pinctrl6: pin controller of FSYS0 block,
202 - pinctrl7: pin controller of FSYS1 block,
203 - pinctrl8: pin controller of BUS1 block,
204 - pinctrl9: pin controller of AUDIO block,
205
206 Example: A pin-controller node with pin banks:
207
208         pinctrl_0: pinctrl@11400000 {
209                 compatible = "samsung,exynos4210-pinctrl";
210                 reg = <0x11400000 0x1000>;
211                 interrupts = <0 47 0>;
212
213                 /* ... */
214
215                 /* Pin bank without external interrupts */
216                 gpy0: gpy0 {
217                         gpio-controller;
218                         #gpio-cells = <2>;
219                 };
220
221                 /* ... */
222
223                 /* Pin bank with external GPIO or muxed wake-up interrupts */
224                 gpj0: gpj0 {
225                         gpio-controller;
226                         #gpio-cells = <2>;
227
228                         interrupt-controller;
229                         #interrupt-cells = <2>;
230                 };
231
232                 /* ... */
233
234                 /* Pin bank with external direct wake-up interrupts */
235                 gpx0: gpx0 {
236                         gpio-controller;
237                         #gpio-cells = <2>;
238
239                         interrupt-controller;
240                         interrupt-parent = <&gic>;
241                         interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>,
242                                      <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>;
243                         #interrupt-cells = <2>;
244                 };
245
246                 /* ... */
247         };
248
249 Example 1: A pin-controller node with pin groups.
250
251         #include <dt-bindings/pinctrl/samsung.h>
252
253         pinctrl_0: pinctrl@11400000 {
254                 compatible = "samsung,exynos4210-pinctrl";
255                 reg = <0x11400000 0x1000>;
256                 interrupts = <0 47 0>;
257
258                 /* ... */
259
260                 uart0_data: uart0-data {
261                         samsung,pins = "gpa0-0", "gpa0-1";
262                         samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
263                         samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
264                         samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
265                 };
266
267                 uart0_fctl: uart0-fctl {
268                         samsung,pins = "gpa0-2", "gpa0-3";
269                         samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
270                         samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
271                         samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
272                 };
273
274                 uart1_data: uart1-data {
275                         samsung,pins = "gpa0-4", "gpa0-5";
276                         samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
277                         samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
278                         samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
279                 };
280
281                 uart1_fctl: uart1-fctl {
282                         samsung,pins = "gpa0-6", "gpa0-7";
283                         samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
284                         samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
285                         samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
286                 };
287
288                 i2c2_bus: i2c2-bus {
289                         samsung,pins = "gpa0-6", "gpa0-7";
290                         samsung,pin-function = <EXYNOS_PIN_FUNC_3>;
291                         samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
292                         samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
293                 };
294
295                 sd4_bus8: sd4-bus-width8 {
296                         part-1 {
297                                 samsung,pins = "gpk0-3", "gpk0-4",
298                                                 "gpk0-5", "gpk0-6";
299                                 samsung,pin-function = <EXYNOS_PIN_FUNC_3>;
300                                 samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
301                                 samsung,pin-drv = <EXYNOS4_PIN_DRV_LV4>;
302                         };
303                         part-2 {
304                                 samsung,pins = "gpk1-3", "gpk1-4",
305                                                 "gpk1-5", "gpk1-6";
306                                 samsung,pin-function = <EXYNOS_PIN_FUNC_4>;
307                                 samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
308                                 samsung,pin-drv = <EXYNOS4_PIN_DRV_LV4>;
309                         };
310                 };
311         };
312
313 Example 2: A pin-controller node with external wakeup interrupt controller node.
314
315         pinctrl_1: pinctrl@11000000 {
316                 compatible = "samsung,exynos4210-pinctrl";
317                 reg = <0x11000000 0x1000>;
318                 interrupts = <0 46 0>
319
320                 /* ... */
321
322                 wakeup-interrupt-controller {
323                         compatible = "samsung,exynos4210-wakeup-eint";
324                         interrupt-parent = <&gic>;
325                         interrupts = <0 32 0>;
326                 };
327         };
328
329 Example 3: A uart client node that supports 'default' and 'flow-control' states.
330
331         uart@13800000 {
332                 compatible = "samsung,exynos4210-uart";
333                 reg = <0x13800000 0x100>;
334                 interrupts = <0 52 0>;
335                 pinctrl-names = "default", "flow-control;
336                 pinctrl-0 = <&uart0_data>;
337                 pinctrl-1 = <&uart0_data &uart0_fctl>;
338         };
339
340 Example 4: Set up the default pin state for uart controller.
341
342         static int s3c24xx_serial_probe(struct platform_device *pdev) {
343                 struct pinctrl *pinctrl;
344
345                 /* ... */
346
347                 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
348         }
349
350 Example 5: A display port client node that supports 'default' pinctrl state
351            and gpio binding.
352
353         display-port-controller {
354                 /* ... */
355
356                 samsung,hpd-gpio = <&gpx2 6 0>;
357                 pinctrl-names = "default";
358                 pinctrl-0 = <&dp_hpd>;
359         };
360
361 Example 6: Request the gpio for display port controller
362
363         static int exynos_dp_probe(struct platform_device *pdev)
364         {
365                 int hpd_gpio, ret;
366                 struct device *dev = &pdev->dev;
367                 struct device_node *dp_node = dev->of_node;
368
369                 /* ... */
370
371                 hpd_gpio = of_get_named_gpio(dp_node, "samsung,hpd-gpio", 0);
372
373                 /* ... */
374
375                 ret = devm_gpio_request_one(&pdev->dev, hpd_gpio, GPIOF_IN,
376                                             "hpd_gpio");
377                 /* ... */
378         }