xref: /freebsd/sys/dts/bindings-gpio.txt (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1
2GPIO configuration.
3===================
4
51. Properties for GPIO Controllers
6
71.1 #gpio-cells
8
9Property:	#gpio-cells
10
11Value type:	<u32>
12
13Description:	The #gpio-cells property defines the number of cells required
14		to encode a gpio specifier.
15
16
171.2 gpio-controller
18
19Property:	gpio-controller
20
21Value type:	<empty>
22
23Description:	The presence of a gpio-controller property defines a node as a
24		GPIO controller node.
25
26
271.3 pin-count
28
29Property:	pin-count
30
31Value type:	<u32>
32
33Description:	The pin-count property defines the number of GPIO pins.
34
35
361.4 Example
37
38	GPIO: gpio@10100 {
39		#gpio-cells = <3>;
40		compatible = "mrvl,gpio";
41		reg = <0x10100 0x20>;
42		gpio-controller;
43		interrupts = <6 7 8 9>;
44		interrupt-parent = <&PIC>;
45		pin-count = <50>
46	};
47
482. Properties for GPIO consumer nodes.
49
502.1 gpios
51
52Property:	gpios
53
54Value type:	<prop-encoded-array> encoded as arbitrary number of GPIO
55		specifiers.
56
57Description:	The gpios property of a device node defines the GPIO or GPIOs
58		that are used by the device. The value of the gpios property
59		consists of an arbitrary number of GPIO specifiers.
60
61		The first cell of the GPIO specifier is phandle of the node's
62		parent GPIO controller and remaining cells are defined by the
63		binding describing the GPIO parent, typically include
64		information like pin number, direction and various flags.
65
66Example:
67		gpios = <&GPIO 0 1		/* GPIO[0]:  FLAGS */
68			 &GPIO 1 2>;		/* GPIO[1]:  FLAGS */
69
70
713. GPIO controller specifier
72
73	<phandle pin dir flags>
74
75
76pin:	0-MAX				GPIO pin number.
77
78flags:
79	Available flags are listed in sys/conf.h. Following combination
80	can be supported by the controller. For details please refer
81	to controller's GPIO reference manual.
82
83	GPIO_PIN_INPUT		0x0001	Input direction
84	GPIO_PIN_OUTPUT		0x0002	Output direction
85	GPIO_PIN_OPENDRAIN	0x0004	Open-drain output
86	GPIO_PIN_OPENSOURCE	0x0008	Open-source output
87	GPIO_PIN_PUSHPULL	0x0010	Push-pull output
88	GPIO_PIN_TRISTATE	0x0020	Output disabled
89	GPIO_PIN_PULLUP		0x0040	Internal pull-up enabled
90	GPIO_PIN_PULLDOWN	0x0080	Internal pull-down enabled
91	GPIO_PIN_INVIN		0x0100	Invert input
92	GPIO_PIN_INVOUT		0x0200	Invert output
93	GPIO_PIN_PULSATE	0x0400	Pulsate in hardware
94	GPIO_PIN_IRQ_POL_EDG	0x0800	IRQ active single edge
95	GPIO_PIN_IRQ_POL_DBL	0x1000	IRQ active double edge
96	GPIO_PIN_IRQ_POL_LVL	0x2000	IRQ active level
97	GPIO_PIN_IRQ_DEBOUNCE	0x4000	Debounce on IRQ pin
98
99Example:
100	gpios = <&GPIO 0  0x00000001	/* GPIO[0]:   IN */
101		 &GPIO 1  0x00000002	/* GPIO[1]:   OUT */
102		 &GPIO 2  0x00000801	/* GPIO[2]:   IN, IRQ (edge) */
103		 &GPIO 3  0x00004001	/* GPIO[3]:   IN, IRQ (level) */
104		 ...
105		 &GPIO 10 0x00000401>;	/* GPIO[10]:  OUT, blink */
106