Skip to content

Commit c02980d

Browse files
author
Linus Walleij
committed
gpio: OF: Remove bad practice examples
We remove the references to anything but two-cell GPIO specifiers and just mention that controllers need to specify their bindings and that we strongly recommend two-cell bindings. Cc: devicetree@vger.kernel.org Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 25db30c commit c02980d

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

  • Documentation/devicetree/bindings/gpio

‎Documentation/devicetree/bindings/gpio/gpio.txt‎

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,24 @@ and bit-banged data signals:
2727
gpio-controller;
2828
#gpio-cells = <2>;
2929
};
30-
gpio2: gpio2 {
31-
gpio-controller;
32-
#gpio-cells = <1>;
33-
};
3430
[...]
3531

36-
enable-gpios = <&gpio2 2>;
3732
data-gpios = <&gpio1 12 0>,
3833
<&gpio1 13 0>,
3934
<&gpio1 14 0>,
4035
<&gpio1 15 0>;
4136

42-
Note that gpio-specifier length is controller dependent. In the
43-
above example, &gpio1 uses 2 cells to specify a gpio, while &gpio2
44-
only uses one.
45-
46-
gpio-specifier may encode: bank, pin position inside the bank,
47-
whether pin is open-drain and whether pin is logically inverted.
37+
In the above example, &gpio1 uses 2 cells to specify a gpio. The first cell is
38+
a local offset to the GPIO line and the second cell represent consumer flags,
39+
such as if the consumer desire the line to be active low (inverted) or open
40+
drain. This is the recommended practice.
4841

49-
Exact meaning of each specifier cell is controller specific, and must
50-
be documented in the device tree binding for the device.
42+
The exact meaning of each specifier cell is controller specific, and must be
43+
documented in the device tree binding for the device, but it is strongly
44+
recommended to use the two-cell approach.
5145

52-
Most controllers are however specifying a generic flag bitfield
53-
in the last cell, so for these, use the macros defined in
46+
Most controllers are specifying a generic flag bitfield in the last cell, so
47+
for these, use the macros defined in
5448
include/dt-bindings/gpio/gpio.h whenever possible:
5549

5650
Example of a node using GPIOs:

0 commit comments

Comments
 (0)