freebsd-nq/sys/dts/bindings-gpio.txt
2017-11-14 21:03:57 +00:00

102 lines
2.2 KiB
Plaintext

$FreeBSD$
GPIO configuration.
===================
1. Properties for GPIO Controllers
1.1 #gpio-cells
Property: #gpio-cells
Value type: <u32>
Description: The #gpio-cells property defines the number of cells required
to encode a gpio specifier.
1.2 gpio-controller
Property: gpio-controller
Value type: <empty>
Description: The presence of a gpio-controller property defines a node as a
GPIO controller node.
1.3 pin-count
Property: pin-count
Value type: <u32>
Description: The pin-count property defines the number of GPIO pins.
1.4 Example
GPIO: gpio@10100 {
#gpio-cells = <3>;
compatible = "mrvl,gpio";
reg = <0x10100 0x20>;
gpio-controller;
interrupts = <6 7 8 9>;
interrupt-parent = <&PIC>;
pin-count = <50>
};
2. Properties for GPIO consumer nodes.
2.1 gpios
Property: gpios
Value type: <prop-encoded-array> encoded as arbitrary number of GPIO
specifiers.
Description: The gpios property of a device node defines the GPIO or GPIOs
that are used by the device. The value of the gpios property
consists of an arbitrary number of GPIO specifiers.
The first cell of the GPIO specifier is phandle of the node's
parent GPIO controller and remaining cells are defined by the
binding describing the GPIO parent, typically include
information like pin number, direction and various flags.
Example:
gpios = <&GPIO 0 1 0 /* GPIO[0]: IN, NONE */
&GPIO 1 2 0>; /* GPIO[1]: OUT, NONE */
3. "mrvl,gpio" controller GPIO specifier
<phandle pin dir flags>
pin: 0-MAX GPIO pin number.
dir:
1 IN Input direction.
2 OUT Output direction.
flags:
0x0000---- IN_NONE
0x0001---- IN_POL_LOW Polarity low (active-low).
0x0002---- IN_IRQ_EDGE Interrupt, edge triggered.
0x0004---- IN_IRQ_LEVEL Interrupt, level triggered.
0x----0000 OUT_NONE
0x----0001 OUT_BLINK Blink on the pin.
0x----0002 OUT_OPEN_DRAIN Open drain output line.
0x----0004 OUT_OPEN_SRC Open source output line.
Example:
gpios = <&GPIO 0 1 0x00000000 /* GPIO[0]: IN */
&GPIO 1 2 0x00000000 /* GPIO[1]: OUT */
&GPIO 2 1 0x00020000 /* GPIO[2]: IN, IRQ (edge) */
&GPIO 3 1 0x00040000 /* GPIO[3]: IN, IRQ (level) */
...
&GPIO 10 2 0x00000001>; /* GPIO[10]: OUT, blink */