1$FreeBSD$ 2 3GPIO configuration. 4=================== 5 61. Properties for GPIO Controllers 7 81.1 #gpio-cells 9 10Property: #gpio-cells 11 12Value type: <u32> 13 14Description: The #gpio-cells property defines the number of cells required 15 to encode a gpio specifier. 16 17 181.2 gpio-controller 19 20Property: gpio-controller 21 22Value type: <empty> 23 24Description: The presence of a gpio-controller property defines a node as a 25 GPIO controller node. 26 27 281.3 pin-count 29 30Property: pin-count 31 32Value type: <u32> 33 34Description: The pin-count property defines the number of GPIO pins. 35 36 371.4 Example 38 39 GPIO: gpio@10100 { 40 #gpio-cells = <3>; 41 compatible = "mrvl,gpio"; 42 reg = <0x10100 0x20>; 43 gpio-controller; 44 interrupts = <6 7 8 9>; 45 interrupt-parent = <&PIC>; 46 pin-count = <50> 47 }; 48 492. Properties for GPIO consumer nodes. 50 512.1 gpios 52 53Property: gpios 54 55Value type: <prop-encoded-array> encoded as arbitrary number of GPIO 56 specifiers. 57 58Description: The gpios property of a device node defines the GPIO or GPIOs 59 that are used by the device. The value of the gpios property 60 consists of an arbitrary number of GPIO specifiers. 61 62 The first cell of the GPIO specifier is phandle of the node's 63 parent GPIO controller and remaining cells are defined by the 64 binding describing the GPIO parent, typically include 65 information like pin number, direction and various flags. 66 67Example: 68 gpios = <&GPIO 0 1 0 /* GPIO[0]: IN, NONE */ 69 &GPIO 1 2 0>; /* GPIO[1]: OUT, NONE */ 70 71 723. "mrvl,gpio" controller GPIO specifier 73 74 <phandle pin dir flags> 75 76 77pin: 0-MAX GPIO pin number. 78 79dir: 80 1 IN Input direction. 81 2 OUT Output direction. 82 83flags: 84 0x0000---- IN_NONE 85 0x0001---- IN_POL_LOW Polarity low (active-low). 86 0x0002---- IN_IRQ_EDGE Interrupt, edge triggered. 87 0x0004---- IN_IRQ_LEVEL Interrupt, level triggered. 88 89 0x----0000 OUT_NONE 90 0x----0001 OUT_BLINK Blink on the pin. 91 0x----0002 OUT_OPEN_DRAIN Open drain output line. 92 0x----0004 OUT_OPEN_SRC Open source output line. 93 94 95Example: 96 gpios = <&GPIO 0 1 0x00000000 /* GPIO[0]: IN */ 97 &GPIO 1 2 0x00000000 /* GPIO[1]: OUT */ 98 &GPIO 2 1 0x00020000 /* GPIO[2]: IN, IRQ (edge) */ 99 &GPIO 3 1 0x00040000 /* GPIO[3]: IN, IRQ (level) */ 100 ... 101 &GPIO 10 2 0x00000001>; /* GPIO[10]: OUT, blink */ 102