Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[cascardo/linux.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,pinctrl-exynos4210": for Exynos4210 compatible pin-controller.
11   - "samsung,pinctrl-exynos5250": for Exynos5250 compatible pin-controller.
12
13 - reg: Base address of the pin controller hardware module and length of
14   the address space it occupies.
15
16 - interrupts: interrupt specifier for the controller. The format and value of
17   the interrupt specifier depends on the interrupt parent for the controller.
18
19 - Pin mux/config groups as child nodes: The pin mux (selecting pin function
20   mode) and pin config (pull up/down, driver strength) settings are represented
21   as child nodes of the pin-controller node. There should be atleast one
22   child node and there is no limit on the count of these child nodes.
23
24   The child node should contain a list of pin(s) on which a particular pin
25   function selection or pin configuration (or both) have to applied. This
26   list of pins is specified using the property name "samsung,pins". There
27   should be atleast one pin specfied for this property and there is no upper
28   limit on the count of pins that can be specified. The pins are specified
29   using pin names which are derived from the hardware manual of the SoC. As
30   an example, the pins in GPA0 bank of the pin controller can be represented
31   as "gpa0-0", "gpa0-1", "gpa0-2" and so on. The names should be in lower case.
32   The format of the pin names should be (as per the hardware manual)
33   "[pin bank name]-[pin number within the bank]".
34
35   The pin function selection that should be applied on the pins listed in the
36   child node is specified using the "samsung,pin-function" property. The value
37   of this property that should be applied to each of the pins listed in the
38   "samsung,pins" property should be picked from the hardware manual of the SoC
39   for the specified pin group. This property is optional in the child node if
40   no specific function selection is desired for the pins listed in the child
41   node. The value of this property is used as-is to program the pin-controller
42   function selector register of the pin-bank.
43
44   The child node can also optionally specify one or more of the pin
45   configuration that should be applied on all the pins listed in the
46   "samsung,pins" property of the child node. The following pin configuration
47   properties are supported.
48
49   - samsung,pin-pud: Pull up/down configuration.
50   - samsung,pin-drv: Drive strength configuration.
51   - samsung,pin-pud-pdn: Pull up/down configuration in power down mode.
52   - samsung,pin-drv-pdn: Drive strength configuration in power down mode.
53
54   The values specified by these config properties should be derived from the
55   hardware manual and these values are programmed as-is into the pin
56   pull up/down and driver strength register of the pin-controller.
57
58   Note: A child should include atleast a pin function selection property or
59   pin configuration property (one or more) or both.
60
61   The client nodes that require a particular pin function selection and/or
62   pin configuration should use the bindings listed in the "pinctrl-bindings.txt"
63   file.
64
65 External GPIO and Wakeup Interrupts:
66
67 The controller supports two types of external interrupts over gpio. The first
68 is the external gpio interrupt and second is the external wakeup interrupts.
69 The difference between the two is that the external wakeup interrupts can be
70 used as system wakeup events.
71
72 A. External GPIO Interrupts: For supporting external gpio interrupts, the
73    following properties should be specified in the pin-controller device node.
74
75 - interrupt-controller: identifies the controller node as interrupt-parent.
76 - #interrupt-cells: the value of this property should be 2.
77   - First Cell: represents the external gpio interrupt number local to the
78     external gpio interrupt space of the controller.
79   - Second Cell: flags to identify the type of the interrupt
80     - 1 = rising edge triggered
81     - 2 = falling edge triggered
82     - 3 = rising and falling edge triggered
83     - 4 = high level triggered
84     - 8 = low level triggered
85
86 B. External Wakeup Interrupts: For supporting external wakeup interrupts, a
87    child node representing the external wakeup interrupt controller should be
88    included in the pin-controller device node. This child node should include
89    the following properties.
90
91    - compatible: identifies the type of the external wakeup interrupt controller
92      The possible values are:
93      - samsung,exynos4210-wakeup-eint: represents wakeup interrupt controller
94        found on Samsung Exynos4210 SoC.
95    - interrupt-parent: phandle of the interrupt parent to which the external
96      wakeup interrupts are forwarded to.
97    - interrupt-controller: identifies the node as interrupt-parent.
98    - #interrupt-cells: the value of this property should be 2
99      - First Cell: represents the external wakeup interrupt number local to
100        the external wakeup interrupt space of the controller.
101      - Second Cell: flags to identify the type of the interrupt
102        - 1 = rising edge triggered
103        - 2 = falling edge triggered
104        - 3 = rising and falling edge triggered
105        - 4 = high level triggered
106        - 8 = low level triggered
107
108 Aliases:
109
110 All the pin controller nodes should be represented in the aliases node using
111 the following format 'pinctrl{n}' where n is a unique number for the alias.
112
113 Example 1: A pin-controller node with pin groups.
114
115         pinctrl_0: pinctrl@11400000 {
116                 compatible = "samsung,pinctrl-exynos4210";
117                 reg = <0x11400000 0x1000>;
118                 interrupts = <0 47 0>;
119
120                 uart0_data: uart0-data {
121                         samsung,pins = "gpa0-0", "gpa0-1";
122                         samsung,pin-function = <2>;
123                         samsung,pin-pud = <0>;
124                         samsung,pin-drv = <0>;
125                 };
126
127                 uart0_fctl: uart0-fctl {
128                         samsung,pins = "gpa0-2", "gpa0-3";
129                         samsung,pin-function = <2>;
130                         samsung,pin-pud = <0>;
131                         samsung,pin-drv = <0>;
132                 };
133
134                 uart1_data: uart1-data {
135                         samsung,pins = "gpa0-4", "gpa0-5";
136                         samsung,pin-function = <2>;
137                         samsung,pin-pud = <0>;
138                         samsung,pin-drv = <0>;
139                 };
140
141                 uart1_fctl: uart1-fctl {
142                         samsung,pins = "gpa0-6", "gpa0-7";
143                         samsung,pin-function = <2>;
144                         samsung,pin-pud = <0>;
145                         samsung,pin-drv = <0>;
146                 };
147
148                 i2c2_bus: i2c2-bus {
149                         samsung,pins = "gpa0-6", "gpa0-7";
150                         samsung,pin-function = <3>;
151                         samsung,pin-pud = <3>;
152                         samsung,pin-drv = <0>;
153                 };
154         };
155
156 Example 2: A pin-controller node with external wakeup interrupt controller node.
157
158         pinctrl_1: pinctrl@11000000 {
159                 compatible = "samsung,pinctrl-exynos4210";
160                 reg = <0x11000000 0x1000>;
161                 interrupts = <0 46 0>;
162                 interrupt-controller;
163                 #interrupt-cells = <2>;
164
165                 wakup_eint: wakeup-interrupt-controller {
166                         compatible = "samsung,exynos4210-wakeup-eint";
167                         interrupt-parent = <&gic>;
168                         interrupt-controller;
169                         #interrupt-cells = <2>;
170                         interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>,
171                                         <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>,
172                                         <0 24 0>, <0 25 0>, <0 26 0>, <0 27 0>,
173                                         <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>,
174                                         <0 32 0>;
175                 };
176         };
177
178 Example 3: A uart client node that supports 'default' and 'flow-control' states.
179
180         uart@13800000 {
181                 compatible = "samsung,exynos4210-uart";
182                 reg = <0x13800000 0x100>;
183                 interrupts = <0 52 0>;
184                 pinctrl-names = "default", "flow-control;
185                 pinctrl-0 = <&uart0_data>;
186                 pinctrl-1 = <&uart0_data &uart0_fctl>;
187         };
188
189 Example 4: Set up the default pin state for uart controller.
190
191         static int s3c24xx_serial_probe(struct platform_device *pdev) {
192                 struct pinctrl *pinctrl;
193                 ...
194                 ...
195                 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
196         }