freebsd-dev/sys/dts/bindings-gpio.txt

107 lines
2.6 KiB
Plaintext
Raw Normal View History

$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 /* GPIO[0]: FLAGS */
&GPIO 1 2>; /* GPIO[1]: FLAGS */
3. GPIO controller specifier
<phandle pin dir flags>
pin: 0-MAX GPIO pin number.
flags:
Available flags are listed in sys/conf.h. Following combination
can be supported by the controller. For details please refer
to controller's GPIO reference manual.
GPIO_PIN_INPUT 0x0001 Input direction
GPIO_PIN_OUTPUT 0x0002 Output direction
GPIO_PIN_OPENDRAIN 0x0004 Open-drain output
GPIO_PIN_OPENSOURCE 0x0008 Open-source output
GPIO_PIN_PUSHPULL 0x0010 Push-pull output
GPIO_PIN_TRISTATE 0x0020 Output disabled
GPIO_PIN_PULLUP 0x0040 Internal pull-up enabled
GPIO_PIN_PULLDOWN 0x0080 Internal pull-down enabled
GPIO_PIN_INVIN 0x0100 Invert input
GPIO_PIN_INVOUT 0x0200 Invert output
GPIO_PIN_PULSATE 0x0400 Pulsate in hardware
GPIO_PIN_IRQ_POL_EDG 0x0800 IRQ active single edge
GPIO_PIN_IRQ_POL_DBL 0x1000 IRQ active double edge
GPIO_PIN_IRQ_POL_LVL 0x2000 IRQ active level
GPIO_PIN_IRQ_DEBOUNCE 0x4000 Debounce on IRQ pin
Example:
gpios = <&GPIO 0 0x00000001 /* GPIO[0]: IN */
&GPIO 1 0x00000002 /* GPIO[1]: OUT */
&GPIO 2 0x00000801 /* GPIO[2]: IN, IRQ (edge) */
&GPIO 3 0x00004001 /* GPIO[3]: IN, IRQ (level) */
...
&GPIO 10 0x00000401>; /* GPIO[10]: OUT, blink */