diff options
-rw-r--r-- | Documentation/devicetree/bindings/gpio/gpio.txt | 60 |
1 files changed, 52 insertions, 8 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt index 0c85bb6e3a80..3fb8f53071b8 100644 --- a/Documentation/devicetree/bindings/gpio/gpio.txt +++ b/Documentation/devicetree/bindings/gpio/gpio.txt | |||
@@ -13,11 +13,11 @@ properties, each containing a 'gpio-list': | |||
13 | gpio-specifier : Array of #gpio-cells specifying specific gpio | 13 | gpio-specifier : Array of #gpio-cells specifying specific gpio |
14 | (controller specific) | 14 | (controller specific) |
15 | 15 | ||
16 | GPIO properties should be named "[<name>-]gpios". Exact | 16 | GPIO properties should be named "[<name>-]gpios". The exact |
17 | meaning of each gpios property must be documented in the device tree | 17 | meaning of each gpios property must be documented in the device tree |
18 | binding for each device. | 18 | binding for each device. |
19 | 19 | ||
20 | For example, the following could be used to describe gpios pins to use | 20 | For example, the following could be used to describe GPIO pins used |
21 | as chip select lines; with chip selects 0, 1 and 3 populated, and chip | 21 | as chip select lines; with chip selects 0, 1 and 3 populated, and chip |
22 | select 2 left empty: | 22 | select 2 left empty: |
23 | 23 | ||
@@ -44,35 +44,79 @@ whether pin is open-drain and whether pin is logically inverted. | |||
44 | Exact meaning of each specifier cell is controller specific, and must | 44 | Exact meaning of each specifier cell is controller specific, and must |
45 | be documented in the device tree binding for the device. | 45 | be documented in the device tree binding for the device. |
46 | 46 | ||
47 | Example of the node using GPIOs: | 47 | Example of a node using GPIOs: |
48 | 48 | ||
49 | node { | 49 | node { |
50 | gpios = <&qe_pio_e 18 0>; | 50 | gpios = <&qe_pio_e 18 0>; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | In this example gpio-specifier is "18 0" and encodes GPIO pin number, | 53 | In this example gpio-specifier is "18 0" and encodes GPIO pin number, |
54 | and empty GPIO flags as accepted by the "qe_pio_e" gpio-controller. | 54 | and GPIO flags as accepted by the "qe_pio_e" gpio-controller. |
55 | |||
56 | 1.1) GPIO specifier best practices | ||
57 | ---------------------------------- | ||
58 | |||
59 | A gpio-specifier should contain a flag indicating the GPIO polarity; active- | ||
60 | high or active-low. If it does, the follow best practices should be followed: | ||
61 | |||
62 | The gpio-specifier's polarity flag should represent the physical level at the | ||
63 | GPIO controller that achieves (or represents, for inputs) a logically asserted | ||
64 | value at the device. The exact definition of logically asserted should be | ||
65 | defined by the binding for the device. If the board inverts the signal between | ||
66 | the GPIO controller and the device, then the gpio-specifier will represent the | ||
67 | opposite physical level than the signal at the device's pin. | ||
68 | |||
69 | When the device's signal polarity is configurable, the binding for the | ||
70 | device must either: | ||
71 | |||
72 | a) Define a single static polarity for the signal, with the expectation that | ||
73 | any software using that binding would statically program the device to use | ||
74 | that signal polarity. | ||
75 | |||
76 | The static choice of polarity may be either: | ||
77 | |||
78 | a1) (Preferred) Dictated by a binding-specific DT property. | ||
79 | |||
80 | or: | ||
81 | |||
82 | a2) Defined statically by the DT binding itself. | ||
83 | |||
84 | In particular, the polarity cannot be derived from the gpio-specifier, since | ||
85 | that would prevent the DT from separately representing the two orthogonal | ||
86 | concepts of configurable signal polarity in the device, and possible board- | ||
87 | level signal inversion. | ||
88 | |||
89 | or: | ||
90 | |||
91 | b) Pick a single option for device signal polarity, and document this choice | ||
92 | in the binding. The gpio-specifier should represent the polarity of the signal | ||
93 | (at the GPIO controller) assuming that the device is configured for this | ||
94 | particular signal polarity choice. If software chooses to program the device | ||
95 | to generate or receive a signal of the opposite polarity, software will be | ||
96 | responsible for correctly interpreting (inverting) the GPIO signal at the GPIO | ||
97 | controller. | ||
55 | 98 | ||
56 | 2) gpio-controller nodes | 99 | 2) gpio-controller nodes |
57 | ------------------------ | 100 | ------------------------ |
58 | 101 | ||
59 | Every GPIO controller node must both an empty "gpio-controller" | 102 | Every GPIO controller node must contain both an empty "gpio-controller" |
60 | property, and have #gpio-cells contain the size of the gpio-specifier. | 103 | property, and a #gpio-cells integer property, which indicates the number of |
104 | cells in a gpio-specifier. | ||
61 | 105 | ||
62 | Example of two SOC GPIO banks defined as gpio-controller nodes: | 106 | Example of two SOC GPIO banks defined as gpio-controller nodes: |
63 | 107 | ||
64 | qe_pio_a: gpio-controller@1400 { | 108 | qe_pio_a: gpio-controller@1400 { |
65 | #gpio-cells = <2>; | ||
66 | compatible = "fsl,qe-pario-bank-a", "fsl,qe-pario-bank"; | 109 | compatible = "fsl,qe-pario-bank-a", "fsl,qe-pario-bank"; |
67 | reg = <0x1400 0x18>; | 110 | reg = <0x1400 0x18>; |
68 | gpio-controller; | 111 | gpio-controller; |
112 | #gpio-cells = <2>; | ||
69 | }; | 113 | }; |
70 | 114 | ||
71 | qe_pio_e: gpio-controller@1460 { | 115 | qe_pio_e: gpio-controller@1460 { |
72 | #gpio-cells = <2>; | ||
73 | compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank"; | 116 | compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank"; |
74 | reg = <0x1460 0x18>; | 117 | reg = <0x1460 0x18>; |
75 | gpio-controller; | 118 | gpio-controller; |
119 | #gpio-cells = <2>; | ||
76 | }; | 120 | }; |
77 | 121 | ||
78 | 2.1) gpio- and pin-controller interaction | 122 | 2.1) gpio- and pin-controller interaction |