bindings-gpio.txt revision 266105
1100280Sgordon$FreeBSD: stable/10/sys/boot/fdt/dts/bindings-gpio.txt 266105 2014-05-15 01:27:53Z loos $
225184Sjkh
350472SpeterGPIO configuration.
466830Sobrien===================
525184Sjkh
6100280Sgordon1. Properties for GPIO Controllers
7100280Sgordon
8100280Sgordon1.1 #gpio-cells
925184Sjkh
10100280SgordonProperty:	#gpio-cells
1125184Sjkh
12100280SgordonValue type:	<u32>
13100280Sgordon
14100280SgordonDescription:	The #gpio-cells property defines the number of cells required
15100280Sgordon		to encode a gpio specifier.
16100280Sgordon
17100280Sgordon
18100280Sgordon1.2 gpio-controller
19100280Sgordon
20100280SgordonProperty:	gpio-controller
21100280Sgordon
22100280SgordonValue type:	<empty>
23100280Sgordon
24100280SgordonDescription:	The presence of a gpio-controller property defines a node as a
25100280Sgordon		GPIO controller node.
26100280Sgordon
27100280Sgordon
28100280Sgordon1.3 pin-count
29100280Sgordon
30100280SgordonProperty:	pin-count
31100280Sgordon
32100280SgordonValue type:	<u32>
33100280Sgordon
34100280SgordonDescription:	The pin-count property defines the number of GPIO pins.
35100280Sgordon
36100280Sgordon
37100280Sgordon1.4 Example
38100280Sgordon
39100280Sgordon	GPIO: gpio@10100 {
40100280Sgordon		#gpio-cells = <3>;
41100280Sgordon		compatible = "mrvl,gpio";
42100280Sgordon		reg = <0x10100 0x20>;
43100280Sgordon		gpio-controller;
44100280Sgordon		interrupts = <6 7 8 9>;
45100280Sgordon		interrupt-parent = <&PIC>;
46100280Sgordon		pin-count = <50>
47100280Sgordon	};
48100280Sgordon
49100280Sgordon2. Properties for GPIO consumer nodes.
50100280Sgordon
51100280Sgordon2.1 gpios
52100280Sgordon
53100280SgordonProperty:	gpios
54100280Sgordon
55100280SgordonValue type:	<prop-encoded-array> encoded as arbitrary number of GPIO
56100280Sgordon		specifiers.
57100280Sgordon
58100280SgordonDescription:	The gpios property of a device node defines the GPIO or GPIOs
59100280Sgordon		that are used by the device. The value of the gpios property
60100280Sgordon		consists of an arbitrary number of GPIO specifiers.
61100280Sgordon		
62100280Sgordon		The first cell of the GPIO specifier is phandle of the node's
63100280Sgordon		parent GPIO controller and remaining cells are defined by the
64100282Sdougb		binding describing the GPIO parent, typically include
65100282Sdougb		information like pin number, direction and various flags.
66100282Sdougb
67100282SdougbExample:
68100282Sdougb		gpios = <&GPIO 0 1 0		/* GPIO[0]:  IN,  NONE */
69100282Sdougb			 &GPIO 1 2 0>;		/* GPIO[1]:  OUT, NONE */
70100282Sdougb
71100282Sdougb
72100282Sdougb3. "mrvl,gpio" controller GPIO specifier
73100282Sdougb
74100282Sdougb	<phandle pin dir flags>
75100282Sdougb
76100282Sdougb
77100282Sdougbpin:	0-MAX				GPIO pin number.
78100282Sdougb
79100282Sdougbdir:
80100282Sdougb	1		IN		Input direction.
81100282Sdougb	2		OUT		Output direction.
82100282Sdougb
83100282Sdougbflags:
84100282Sdougb	0x0000----	IN_NONE
85100280Sgordon	0x0001----	IN_POL_LOW	Polarity low (active-low).
86100280Sgordon	0x0002----	IN_IRQ_EDGE	Interrupt, edge triggered.
87100280Sgordon	0x0004----	IN_IRQ_LEVEL	Interrupt, level triggered.
88100280Sgordon	
89100280Sgordon	0x----0000	OUT_NONE
90100280Sgordon	0x----0001	OUT_BLINK	Blink on the pin.
9185831Sdes	0x----0002	OUT_OPEN_DRAIN	Open drain output line.
9285831Sdes	0x----0004	OUT_OPEN_SRC	Open source output line.
9385831Sdes
9486163Sfenner
9585831SdesExample:
9685831Sdes	gpios = <&GPIO 0  1 0x00000000		/* GPIO[0]:   IN */
9785831Sdes		 &GPIO 1  2 0x00000000		/* GPIO[1]:   OUT */
9865532Snectar		 &GPIO 2  1 0x00020000		/* GPIO[2]:   IN, IRQ (edge) */
9985831Sdes		 &GPIO 3  1 0x00040000		/* GPIO[3]:   IN, IRQ (level) */
10085831Sdes		 ...
10170108Sdougb		 &GPIO 10 2 0x00000001>;	/* GPIO[10]:  OUT, blink */
10270108Sdougb