aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio.txt60
1 files changed, 52 insertions, 8 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt
index 0c85bb6e3a80..3fb8f53071b8 100644
--- a/Documentation/devicetree/bindings/gpio/gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio.txt
@@ -13,11 +13,11 @@ 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". Exact 16GPIO properties should be named "[<name>-]gpios". The exact
17meaning of each gpios property must be documented in the device tree 17meaning of each gpios property must be documented in the device tree
18binding for each device. 18binding for each device.
19 19
20For example, the following could be used to describe gpios pins to use 20For example, the following could be used to describe GPIO pins used
21as chip select lines; with chip selects 0, 1 and 3 populated, and chip 21as chip select lines; with chip selects 0, 1 and 3 populated, and chip
22select 2 left empty: 22select 2 left empty:
23 23
@@ -44,35 +44,79 @@ whether pin is open-drain and whether pin is logically inverted.
44Exact meaning of each specifier cell is controller specific, and must 44Exact meaning of each specifier cell is controller specific, and must
45be documented in the device tree binding for the device. 45be documented in the device tree binding for the device.
46 46
47Example of the node using GPIOs: 47Example of a node using GPIOs:
48 48
49 node { 49 node {
50 gpios = <&qe_pio_e 18 0>; 50 gpios = <&qe_pio_e 18 0>;
51 }; 51 };
52 52
53In this example gpio-specifier is "18 0" and encodes GPIO pin number, 53In this example gpio-specifier is "18 0" and encodes GPIO pin number,
54and empty GPIO flags as accepted by the "qe_pio_e" gpio-controller. 54and GPIO flags as accepted by the "qe_pio_e" gpio-controller.
55
561.1) GPIO specifier best practices
57----------------------------------
58
59A gpio-specifier should contain a flag indicating the GPIO polarity; active-
60high or active-low. If it does, the follow best practices should be followed:
61
62The gpio-specifier's polarity flag should represent the physical level at the
63GPIO controller that achieves (or represents, for inputs) a logically asserted
64value at the device. The exact definition of logically asserted should be
65defined by the binding for the device. If the board inverts the signal between
66the GPIO controller and the device, then the gpio-specifier will represent the
67opposite physical level than the signal at the device's pin.
68
69When the device's signal polarity is configurable, the binding for the
70device must either:
71
72a) Define a single static polarity for the signal, with the expectation that
73any software using that binding would statically program the device to use
74that signal polarity.
75
76The static choice of polarity may be either:
77
78a1) (Preferred) Dictated by a binding-specific DT property.
79
80or:
81
82a2) Defined statically by the DT binding itself.
83
84In particular, the polarity cannot be derived from the gpio-specifier, since
85that would prevent the DT from separately representing the two orthogonal
86concepts of configurable signal polarity in the device, and possible board-
87level signal inversion.
88
89or:
90
91b) Pick a single option for device signal polarity, and document this choice
92in the binding. The gpio-specifier should represent the polarity of the signal
93(at the GPIO controller) assuming that the device is configured for this
94particular signal polarity choice. If software chooses to program the device
95to generate or receive a signal of the opposite polarity, software will be
96responsible for correctly interpreting (inverting) the GPIO signal at the GPIO
97controller.
55 98
562) gpio-controller nodes 992) gpio-controller nodes
57------------------------ 100------------------------
58 101
59Every GPIO controller node must both an empty "gpio-controller" 102Every GPIO controller node must contain both an empty "gpio-controller"
60property, and have #gpio-cells contain the size of the gpio-specifier. 103property, and a #gpio-cells integer property, which indicates the number of
104cells in a gpio-specifier.
61 105
62Example of two SOC GPIO banks defined as gpio-controller nodes: 106Example of two SOC GPIO banks defined as gpio-controller nodes:
63 107
64 qe_pio_a: gpio-controller@1400 { 108 qe_pio_a: gpio-controller@1400 {
65 #gpio-cells = <2>;
66 compatible = "fsl,qe-pario-bank-a", "fsl,qe-pario-bank"; 109 compatible = "fsl,qe-pario-bank-a", "fsl,qe-pario-bank";
67 reg = <0x1400 0x18>; 110 reg = <0x1400 0x18>;
68 gpio-controller; 111 gpio-controller;
112 #gpio-cells = <2>;
69 }; 113 };
70 114
71 qe_pio_e: gpio-controller@1460 { 115 qe_pio_e: gpio-controller@1460 {
72 #gpio-cells = <2>;
73 compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank"; 116 compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank";
74 reg = <0x1460 0x18>; 117 reg = <0x1460 0x18>;
75 gpio-controller; 118 gpio-controller;
119 #gpio-cells = <2>;
76 }; 120 };
77 121
782.1) gpio- and pin-controller interaction 1222.1) gpio- and pin-controller interaction