xref: /OK3568_Linux_fs/u-boot/doc/device-tree-bindings/gpio/nvidia,tegra186-gpio.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunNVIDIA Tegra186 GPIO controllers
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunTegra186 contains two GPIO controllers; a main controller and an "AON"
4*4882a593Smuzhiyuncontroller. This binding document applies to both controllers. The register
5*4882a593Smuzhiyunlayouts for the controllers share many similarities, but also some significant
6*4882a593Smuzhiyundifferences. Hence, this document describes closely related but different
7*4882a593Smuzhiyunbindings and compatible values.
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunThe Tegra186 GPIO controller allows software to set the IO direction of, and
10*4882a593Smuzhiyunread/write the value of, numerous GPIO signals. Routing of GPIO signals to
11*4882a593Smuzhiyunpackage balls is under the control of a separate pin controller HW block. Two
12*4882a593Smuzhiyunmajor sets of registers exist:
13*4882a593Smuzhiyun
14*4882a593Smuzhiyuna) Security registers, which allow configuration of allowed access to the GPIO
15*4882a593Smuzhiyunregister set. These registers exist in a single contiguous block of physical
16*4882a593Smuzhiyunaddress space. The size of this block, and the security features available,
17*4882a593Smuzhiyunvaries between the different GPIO controllers.
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunAccess to this set of registers is not necessary in all circumstances. Code
20*4882a593Smuzhiyunthat wishes to configure access to the GPIO registers needs access to these
21*4882a593Smuzhiyunregisters to do so. Code which simply wishes to read or write GPIO data does not
22*4882a593Smuzhiyunneed access to these registers.
23*4882a593Smuzhiyun
24*4882a593Smuzhiyunb) GPIO registers, which allow manipulation of the GPIO signals. In some GPIO
25*4882a593Smuzhiyuncontrollers, these registers are exposed via multiple "physical aliases" in
26*4882a593Smuzhiyunaddress space, each of which access the same underlying state. See the hardware
27*4882a593Smuzhiyundocumentation for rationale. Any particular GPIO client is expected to access
28*4882a593Smuzhiyunjust one of these physical aliases.
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunTegra HW documentation describes a unified naming convention for all GPIOs
31*4882a593Smuzhiyunimplemented by the SoC. Each GPIO is assigned to a port, and a port may control
32*4882a593Smuzhiyuna number of GPIOs. Thus, each GPIO is named according to an alphabetical port
33*4882a593Smuzhiyunname and an integer GPIO name within the port. For example, GPIO_PA0, GPIO_PN6,
34*4882a593Smuzhiyunor GPIO_PCC3.
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunThe number of ports implemented by each GPIO controller varies. The number of
37*4882a593Smuzhiyunimplemented GPIOs within each port varies. GPIO registers within a controller
38*4882a593Smuzhiyunare grouped and laid out according to the port they affect.
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunThe mapping from port name to the GPIO controller that implements that port, and
41*4882a593Smuzhiyunthe mapping from port name to register offset within a controller, are both
42*4882a593Smuzhiyunextremely non-linear. The header file <dt-bindings/gpio/tegra186-gpio.h>
43*4882a593Smuzhiyundescribes the port-level mapping. In that file, the naming convention for ports
44*4882a593Smuzhiyunmatches the HW documentation. The values chosen for the names are alphabetically
45*4882a593Smuzhiyunsorted within a particular controller. Drivers need to map between the DT GPIO
46*4882a593SmuzhiyunIDs and HW register offsets using a lookup table.
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunEach GPIO controller can generate a number of interrupt signals. Each signal
49*4882a593Smuzhiyunrepresents the aggregate status for all GPIOs within a set of ports. Thus, the
50*4882a593Smuzhiyunnumber of interrupt signals generated by a controller varies as a rough function
51*4882a593Smuzhiyunof the number of ports it implements. Note that the HW documentation refers to
52*4882a593Smuzhiyunboth the overall controller HW module and the sets-of-ports as "controllers".
53*4882a593Smuzhiyun
54*4882a593SmuzhiyunEach GPIO controller in fact generates multiple interrupts signals for each set
55*4882a593Smuzhiyunof ports. Each GPIO may be configured to feed into a specific one of the
56*4882a593Smuzhiyuninterrupt signals generated by a set-of-ports. The intent is for each generated
57*4882a593Smuzhiyunsignal to be routed to a different CPU, thus allowing different CPUs to each
58*4882a593Smuzhiyunhandle subsets of the interrupts within a port. The status of each of these
59*4882a593Smuzhiyunper-port-set signals is reported via a separate register. Thus, a driver needs
60*4882a593Smuzhiyunto know which status register to observe. This binding currently defines no
61*4882a593Smuzhiyunconfiguration mechanism for this. By default, drivers should use register
62*4882a593SmuzhiyunGPIO_${port}_INTERRUPT_STATUS_G1_0. Future revisions to the binding could
63*4882a593Smuzhiyundefine a property to configure this.
64*4882a593Smuzhiyun
65*4882a593SmuzhiyunRequired properties:
66*4882a593Smuzhiyun- compatible
67*4882a593Smuzhiyun    Array of strings.
68*4882a593Smuzhiyun    One of:
69*4882a593Smuzhiyun    - "nvidia,tegra186-gpio".
70*4882a593Smuzhiyun    - "nvidia,tegra186-gpio-aon".
71*4882a593Smuzhiyun- reg-names
72*4882a593Smuzhiyun    Array of strings.
73*4882a593Smuzhiyun    Contains a list of names for the register spaces described by the reg
74*4882a593Smuzhiyun    property. May contain the following entries, in any order:
75*4882a593Smuzhiyun    - "gpio": Mandatory. GPIO control registers. This may cover either:
76*4882a593Smuzhiyun        a) The single physical alias that this OS should use.
77*4882a593Smuzhiyun        b) All physical aliases that exist in the controller. This is
78*4882a593Smuzhiyun           appropriate when the OS is responsible for managing assignment of
79*4882a593Smuzhiyun           the physical aliases.
80*4882a593Smuzhiyun    - "security": Optional. Security configuration registers.
81*4882a593Smuzhiyun    Users of this binding MUST look up entries in the reg property by name,
82*4882a593Smuzhiyun    using this reg-names property to do so.
83*4882a593Smuzhiyun- reg
84*4882a593Smuzhiyun    Array of (physical base address, length) tuples.
85*4882a593Smuzhiyun    Must contain one entry per entry in the reg-names property, in a matching
86*4882a593Smuzhiyun    order.
87*4882a593Smuzhiyun- interrupts
88*4882a593Smuzhiyun    Array of interrupt specifiers.
89*4882a593Smuzhiyun    The interrupt outputs from the HW block, one per set of ports, in the
90*4882a593Smuzhiyun    order the HW manual describes them. The number of entries required varies
91*4882a593Smuzhiyun    depending on compatible value:
92*4882a593Smuzhiyun    - "nvidia,tegra186-gpio": 6 entries.
93*4882a593Smuzhiyun    - "nvidia,tegra186-gpio-aon": 1 entry.
94*4882a593Smuzhiyun- gpio-controller
95*4882a593Smuzhiyun    Boolean.
96*4882a593Smuzhiyun    Marks the device node as a GPIO controller/provider.
97*4882a593Smuzhiyun- #gpio-cells
98*4882a593Smuzhiyun    Single-cell integer.
99*4882a593Smuzhiyun    Must be <2>.
100*4882a593Smuzhiyun    Indicates how many cells are used in a consumer's GPIO specifier.
101*4882a593Smuzhiyun    In the specifier:
102*4882a593Smuzhiyun    - The first cell is the pin number.
103*4882a593Smuzhiyun        See <dt-bindings/gpio/tegra186-gpio.h>.
104*4882a593Smuzhiyun    - The second cell contains flags:
105*4882a593Smuzhiyun        - Bit 0 specifies polarity
106*4882a593Smuzhiyun            - 0: Active-high (normal).
107*4882a593Smuzhiyun            - 1: Active-low (inverted).
108*4882a593Smuzhiyun- interrupt-controller
109*4882a593Smuzhiyun    Boolean.
110*4882a593Smuzhiyun    Marks the device node as an interrupt controller/provider.
111*4882a593Smuzhiyun- #interrupt-cells
112*4882a593Smuzhiyun    Single-cell integer.
113*4882a593Smuzhiyun    Must be <2>.
114*4882a593Smuzhiyun    Indicates how many cells are used in a consumer's interrupt specifier.
115*4882a593Smuzhiyun    In the specifier:
116*4882a593Smuzhiyun    - The first cell is the GPIO number.
117*4882a593Smuzhiyun        See <dt-bindings/gpio/tegra186-gpio.h>.
118*4882a593Smuzhiyun    - The second cell is contains flags:
119*4882a593Smuzhiyun        - Bits [3:0] indicate trigger type and level:
120*4882a593Smuzhiyun            - 1: Low-to-high edge triggered.
121*4882a593Smuzhiyun            - 2: High-to-low edge triggered.
122*4882a593Smuzhiyun            - 4: Active high level-sensitive.
123*4882a593Smuzhiyun            - 8: Active low level-sensitive.
124*4882a593Smuzhiyun            Valid combinations are 1, 2, 3, 4, 8.
125*4882a593Smuzhiyun
126*4882a593SmuzhiyunExample:
127*4882a593Smuzhiyun
128*4882a593Smuzhiyun#include <dt-bindings/interrupt-controller/irq.h>
129*4882a593Smuzhiyun
130*4882a593Smuzhiyungpio@2200000 {
131*4882a593Smuzhiyun	compatible = "nvidia,tegra186-gpio";
132*4882a593Smuzhiyun	reg-names = "security", "gpio";
133*4882a593Smuzhiyun	reg =
134*4882a593Smuzhiyun		<0x0 0x2200000 0x0 0x10000>,
135*4882a593Smuzhiyun		<0x0 0x2210000 0x0 0x10000>;
136*4882a593Smuzhiyun	interrupts =
137*4882a593Smuzhiyun		<0 47 IRQ_TYPE_LEVEL_HIGH>,
138*4882a593Smuzhiyun		<0 50 IRQ_TYPE_LEVEL_HIGH>,
139*4882a593Smuzhiyun		<0 53 IRQ_TYPE_LEVEL_HIGH>,
140*4882a593Smuzhiyun		<0 56 IRQ_TYPE_LEVEL_HIGH>,
141*4882a593Smuzhiyun		<0 59 IRQ_TYPE_LEVEL_HIGH>,
142*4882a593Smuzhiyun		<0 180 IRQ_TYPE_LEVEL_HIGH>;
143*4882a593Smuzhiyun	gpio-controller;
144*4882a593Smuzhiyun	#gpio-cells = <2>;
145*4882a593Smuzhiyun	interrupt-controller;
146*4882a593Smuzhiyun	#interrupt-cells = <2>;
147*4882a593Smuzhiyun};
148*4882a593Smuzhiyun
149*4882a593Smuzhiyungpio@c2f0000 {
150*4882a593Smuzhiyun	compatible = "nvidia,tegra186-gpio-aon";
151*4882a593Smuzhiyun	reg-names = "security", "gpio";
152*4882a593Smuzhiyun	reg =
153*4882a593Smuzhiyun		<0x0 0xc2f0000 0x0 0x1000>,
154*4882a593Smuzhiyun		<0x0 0xc2f1000 0x0 0x1000>;
155*4882a593Smuzhiyun	interrupts =
156*4882a593Smuzhiyun		<0 60 IRQ_TYPE_LEVEL_HIGH>;
157*4882a593Smuzhiyun	gpio-controller;
158*4882a593Smuzhiyun	#gpio-cells = <2>;
159*4882a593Smuzhiyun	interrupt-controller;
160*4882a593Smuzhiyun	#interrupt-cells = <2>;
161*4882a593Smuzhiyun};
162