aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/bindings/gpio/gpio.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/devicetree/bindings/gpio/gpio.txt')
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio.txt40
1 files changed, 26 insertions, 14 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt
index 3fb8f53071b8..b9bd1d64cfa6 100644
--- a/Documentation/devicetree/bindings/gpio/gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio.txt
@@ -13,13 +13,22 @@ properties, each containing a 'gpio-list':
13 gpio-specifier : Array of #gpio-cells specifying specific gpio 13 gpio-specifier : Array of #gpio-cells specifying specific gpio
14 (controller specific) 14 (controller specific)
15 15
16GPIO properties should be named "[<name>-]gpios". The exact 16GPIO properties should be named "[<name>-]gpios", with <name> being the purpose
17meaning of each gpios property must be documented in the device tree 17of this GPIO for the device. While a non-existent <name> is considered valid
18binding for each device. 18for compatibility reasons (resolving to the "gpios" property), it is not allowed
19for new bindings.
19 20
20For example, the following could be used to describe GPIO pins used 21GPIO properties can contain one or more GPIO phandles, but only in exceptional
21as chip select lines; with chip selects 0, 1 and 3 populated, and chip 22cases should they contain more than one. If your device uses several GPIOs with
22select 2 left empty: 23distinct functions, reference each of them under its own property, giving it a
24meaningful name. The only case where an array of GPIOs is accepted is when
25several GPIOs serve the same function (e.g. a parallel data line).
26
27The exact purpose of each gpios property must be documented in the device tree
28binding of the device.
29
30The following example could be used to describe GPIO pins used as device enable
31and bit-banged data signals:
23 32
24 gpio1: gpio1 { 33 gpio1: gpio1 {
25 gpio-controller 34 gpio-controller
@@ -30,10 +39,12 @@ select 2 left empty:
30 #gpio-cells = <1>; 39 #gpio-cells = <1>;
31 }; 40 };
32 [...] 41 [...]
33 chipsel-gpios = <&gpio1 12 0>, 42
34 <&gpio1 13 0>, 43 enable-gpios = <&gpio2 2>;
35 <0>, /* holes are permitted, means no GPIO 2 */ 44 data-gpios = <&gpio1 12 0>,
36 <&gpio2 2>; 45 <&gpio1 13 0>,
46 <&gpio1 14 0>,
47 <&gpio1 15 0>;
37 48
38Note that gpio-specifier length is controller dependent. In the 49Note that gpio-specifier length is controller dependent. In the
39above example, &gpio1 uses 2 cells to specify a gpio, while &gpio2 50above example, &gpio1 uses 2 cells to specify a gpio, while &gpio2
@@ -42,16 +53,17 @@ only uses one.
42gpio-specifier may encode: bank, pin position inside the bank, 53gpio-specifier may encode: bank, pin position inside the bank,
43whether pin is open-drain and whether pin is logically inverted. 54whether pin is open-drain and whether pin is logically inverted.
44Exact meaning of each specifier cell is controller specific, and must 55Exact meaning of each specifier cell is controller specific, and must
45be documented in the device tree binding for the device. 56be documented in the device tree binding for the device. Use the macros
57defined in include/dt-bindings/gpio/gpio.h whenever possible:
46 58
47Example of a node using GPIOs: 59Example of a node using GPIOs:
48 60
49 node { 61 node {
50 gpios = <&qe_pio_e 18 0>; 62 enable-gpios = <&qe_pio_e 18 GPIO_ACTIVE_HIGH>;
51 }; 63 };
52 64
53In this example gpio-specifier is "18 0" and encodes GPIO pin number, 65GPIO_ACTIVE_HIGH is 0, so in this example gpio-specifier is "18 0" and encodes
54and GPIO flags as accepted by the "qe_pio_e" gpio-controller. 66GPIO pin number, and GPIO flags as accepted by the "qe_pio_e" gpio-controller.
55 67
561.1) GPIO specifier best practices 681.1) GPIO specifier best practices
57---------------------------------- 69----------------------------------