Commit c02980d6 authored by Linus Walleij's avatar Linus Walleij

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: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 25db30c3
...@@ -27,30 +27,24 @@ and bit-banged data signals: ...@@ -27,30 +27,24 @@ and bit-banged data signals:
gpio-controller; gpio-controller;
#gpio-cells = <2>; #gpio-cells = <2>;
}; };
gpio2: gpio2 {
gpio-controller;
#gpio-cells = <1>;
};
[...] [...]
enable-gpios = <&gpio2 2>;
data-gpios = <&gpio1 12 0>, data-gpios = <&gpio1 12 0>,
<&gpio1 13 0>, <&gpio1 13 0>,
<&gpio1 14 0>, <&gpio1 14 0>,
<&gpio1 15 0>; <&gpio1 15 0>;
Note that gpio-specifier length is controller dependent. In the In the above example, &gpio1 uses 2 cells to specify a gpio. The first cell is
above example, &gpio1 uses 2 cells to specify a gpio, while &gpio2 a local offset to the GPIO line and the second cell represent consumer flags,
only uses one. such as if the consumer desire the line to be active low (inverted) or open
drain. This is the recommended practice.
gpio-specifier may encode: bank, pin position inside the bank,
whether pin is open-drain and whether pin is logically inverted.
Exact meaning of each specifier cell is controller specific, and must The exact meaning of each specifier cell is controller specific, and must be
be documented in the device tree binding for the device. documented in the device tree binding for the device, but it is strongly
recommended to use the two-cell approach.
Most controllers are however specifying a generic flag bitfield Most controllers are specifying a generic flag bitfield in the last cell, so
in the last cell, so for these, use the macros defined in for these, use the macros defined in
include/dt-bindings/gpio/gpio.h whenever possible: include/dt-bindings/gpio/gpio.h whenever possible:
Example of a node using GPIOs: Example of a node using GPIOs:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment