xref: /freebsd/sys/contrib/device-tree/Bindings/pci/ralink,rt3883-pci.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel Vadot* Mediatek/Ralink RT3883 PCI controller
2*c66ec88fSEmmanuel Vadot
3*c66ec88fSEmmanuel Vadot1) Main node
4*c66ec88fSEmmanuel Vadot
5*c66ec88fSEmmanuel Vadot   Required properties:
6*c66ec88fSEmmanuel Vadot
7*c66ec88fSEmmanuel Vadot   - compatible: must be "ralink,rt3883-pci"
8*c66ec88fSEmmanuel Vadot
9*c66ec88fSEmmanuel Vadot   - reg: specifies the physical base address of the controller and
10*c66ec88fSEmmanuel Vadot     the length of the memory mapped region.
11*c66ec88fSEmmanuel Vadot
12*c66ec88fSEmmanuel Vadot   - #address-cells: specifies the number of cells needed to encode an
13*c66ec88fSEmmanuel Vadot     address. The value must be 1.
14*c66ec88fSEmmanuel Vadot
15*c66ec88fSEmmanuel Vadot   - #size-cells: specifies the number of cells used to represent the size
16*c66ec88fSEmmanuel Vadot     of an address. The value must be 1.
17*c66ec88fSEmmanuel Vadot
18*c66ec88fSEmmanuel Vadot   - ranges: specifies the translation between child address space and parent
19*c66ec88fSEmmanuel Vadot     address space
20*c66ec88fSEmmanuel Vadot
21*c66ec88fSEmmanuel Vadot  Optional properties:
22*c66ec88fSEmmanuel Vadot
23*c66ec88fSEmmanuel Vadot   - status: indicates the operational status of the device.
24*c66ec88fSEmmanuel Vadot     Value must be either "disabled" or "okay".
25*c66ec88fSEmmanuel Vadot
26*c66ec88fSEmmanuel Vadot2) Child nodes
27*c66ec88fSEmmanuel Vadot
28*c66ec88fSEmmanuel Vadot   The main node must have two child nodes which describes the built-in
29*c66ec88fSEmmanuel Vadot   interrupt controller and the PCI host bridge.
30*c66ec88fSEmmanuel Vadot
31*c66ec88fSEmmanuel Vadot   a) Interrupt controller:
32*c66ec88fSEmmanuel Vadot
33*c66ec88fSEmmanuel Vadot   Required properties:
34*c66ec88fSEmmanuel Vadot
35*c66ec88fSEmmanuel Vadot   - interrupt-controller: identifies the node as an interrupt controller
36*c66ec88fSEmmanuel Vadot
37*c66ec88fSEmmanuel Vadot   - #address-cells: specifies the number of cells needed to encode an
38*c66ec88fSEmmanuel Vadot     address. The value must be 0. As such, 'interrupt-map' nodes do not
39*c66ec88fSEmmanuel Vadot     have to specify a parent unit address.
40*c66ec88fSEmmanuel Vadot
41*c66ec88fSEmmanuel Vadot   - #interrupt-cells: specifies the number of cells needed to encode an
42*c66ec88fSEmmanuel Vadot     interrupt source. The value must be 1.
43*c66ec88fSEmmanuel Vadot
44*c66ec88fSEmmanuel Vadot   - interrupts: specifies the interrupt source of the parent interrupt
45*c66ec88fSEmmanuel Vadot     controller. The format of the interrupt specifier depends on the
46*c66ec88fSEmmanuel Vadot     parent interrupt controller.
47*c66ec88fSEmmanuel Vadot
48*c66ec88fSEmmanuel Vadot   b) PCI host bridge:
49*c66ec88fSEmmanuel Vadot
50*c66ec88fSEmmanuel Vadot   Required properties:
51*c66ec88fSEmmanuel Vadot
52*c66ec88fSEmmanuel Vadot   - #address-cells: specifies the number of cells needed to encode an
53*c66ec88fSEmmanuel Vadot     address. The value must be 0.
54*c66ec88fSEmmanuel Vadot
55*c66ec88fSEmmanuel Vadot   - #size-cells: specifies the number of cells used to represent the size
56*c66ec88fSEmmanuel Vadot     of an address. The value must be 2.
57*c66ec88fSEmmanuel Vadot
58*c66ec88fSEmmanuel Vadot   - #interrupt-cells: specifies the number of cells needed to encode an
59*c66ec88fSEmmanuel Vadot     interrupt source. The value must be 1.
60*c66ec88fSEmmanuel Vadot
61*c66ec88fSEmmanuel Vadot   - device_type: must be "pci"
62*c66ec88fSEmmanuel Vadot
63*c66ec88fSEmmanuel Vadot   - bus-range: PCI bus numbers covered
64*c66ec88fSEmmanuel Vadot
65*c66ec88fSEmmanuel Vadot   - ranges: specifies the ranges for the PCI memory and I/O regions
66*c66ec88fSEmmanuel Vadot
67*c66ec88fSEmmanuel Vadot   - interrupt-map-mask,
68*c66ec88fSEmmanuel Vadot   - interrupt-map: standard PCI properties to define the mapping of the
69*c66ec88fSEmmanuel Vadot     PCI interface to interrupt numbers.
70*c66ec88fSEmmanuel Vadot
71*c66ec88fSEmmanuel Vadot   The PCI host bridge node might have additional sub-nodes representing
72*c66ec88fSEmmanuel Vadot   the onboard PCI devices/PCI slots. Each such sub-node must have the
73*c66ec88fSEmmanuel Vadot   following mandatory properties:
74*c66ec88fSEmmanuel Vadot
75*c66ec88fSEmmanuel Vadot     - reg: used only for interrupt mapping, so only the first four bytes
76*c66ec88fSEmmanuel Vadot       are used to refer to the correct bus number and device number.
77*c66ec88fSEmmanuel Vadot
78*c66ec88fSEmmanuel Vadot     - device_type: must be "pci"
79*c66ec88fSEmmanuel Vadot
80*c66ec88fSEmmanuel Vadot   If a given sub-node represents a PCI bridge it must have following
81*c66ec88fSEmmanuel Vadot   mandatory properties as well:
82*c66ec88fSEmmanuel Vadot
83*c66ec88fSEmmanuel Vadot     - #address-cells: must be set to <3>
84*c66ec88fSEmmanuel Vadot
85*c66ec88fSEmmanuel Vadot     - #size-cells: must set to <2>
86*c66ec88fSEmmanuel Vadot
87*c66ec88fSEmmanuel Vadot     - #interrupt-cells: must be set to <1>
88*c66ec88fSEmmanuel Vadot
89*c66ec88fSEmmanuel Vadot     - interrupt-map-mask,
90*c66ec88fSEmmanuel Vadot     - interrupt-map: standard PCI properties to define the mapping of the
91*c66ec88fSEmmanuel Vadot       PCI interface to interrupt numbers.
92*c66ec88fSEmmanuel Vadot
93*c66ec88fSEmmanuel Vadot   Besides the required properties the sub-nodes may have these optional
94*c66ec88fSEmmanuel Vadot   properties:
95*c66ec88fSEmmanuel Vadot
96*c66ec88fSEmmanuel Vadot     - status: indicates the operational status of the sub-node.
97*c66ec88fSEmmanuel Vadot       Value must be either "disabled" or "okay".
98*c66ec88fSEmmanuel Vadot
99*c66ec88fSEmmanuel Vadot3) Example:
100*c66ec88fSEmmanuel Vadot
101*c66ec88fSEmmanuel Vadot   a) SoC specific dtsi file:
102*c66ec88fSEmmanuel Vadot
103*c66ec88fSEmmanuel Vadot	pci@10140000 {
104*c66ec88fSEmmanuel Vadot		compatible = "ralink,rt3883-pci";
105*c66ec88fSEmmanuel Vadot		reg = <0x10140000 0x20000>;
106*c66ec88fSEmmanuel Vadot		#address-cells = <1>;
107*c66ec88fSEmmanuel Vadot		#size-cells = <1>;
108*c66ec88fSEmmanuel Vadot		ranges; /* direct mapping */
109*c66ec88fSEmmanuel Vadot
110*c66ec88fSEmmanuel Vadot		status = "disabled";
111*c66ec88fSEmmanuel Vadot
112*c66ec88fSEmmanuel Vadot		pciintc: interrupt-controller {
113*c66ec88fSEmmanuel Vadot			interrupt-controller;
114*c66ec88fSEmmanuel Vadot			#address-cells = <0>;
115*c66ec88fSEmmanuel Vadot			#interrupt-cells = <1>;
116*c66ec88fSEmmanuel Vadot
117*c66ec88fSEmmanuel Vadot			interrupt-parent = <&cpuintc>;
118*c66ec88fSEmmanuel Vadot			interrupts = <4>;
119*c66ec88fSEmmanuel Vadot		};
120*c66ec88fSEmmanuel Vadot
121*c66ec88fSEmmanuel Vadot		host-bridge {
122*c66ec88fSEmmanuel Vadot			#address-cells = <3>;
123*c66ec88fSEmmanuel Vadot			#size-cells = <2>;
124*c66ec88fSEmmanuel Vadot			#interrupt-cells = <1>;
125*c66ec88fSEmmanuel Vadot
126*c66ec88fSEmmanuel Vadot			device_type = "pci";
127*c66ec88fSEmmanuel Vadot
128*c66ec88fSEmmanuel Vadot			bus-range = <0 255>;
129*c66ec88fSEmmanuel Vadot			ranges = <
130*c66ec88fSEmmanuel Vadot				0x02000000 0 0x00000000 0x20000000 0 0x10000000 /* pci memory */
131*c66ec88fSEmmanuel Vadot				0x01000000 0 0x00000000 0x10160000 0 0x00010000 /* io space */
132*c66ec88fSEmmanuel Vadot			>;
133*c66ec88fSEmmanuel Vadot
134*c66ec88fSEmmanuel Vadot			interrupt-map-mask = <0xf800 0 0 7>;
135*c66ec88fSEmmanuel Vadot			interrupt-map = <
136*c66ec88fSEmmanuel Vadot				/* IDSEL 17 */
137*c66ec88fSEmmanuel Vadot				0x8800 0 0 1 &pciintc 18
138*c66ec88fSEmmanuel Vadot				0x8800 0 0 2 &pciintc 18
139*c66ec88fSEmmanuel Vadot				0x8800 0 0 3 &pciintc 18
140*c66ec88fSEmmanuel Vadot				0x8800 0 0 4 &pciintc 18
141*c66ec88fSEmmanuel Vadot				/* IDSEL 18 */
142*c66ec88fSEmmanuel Vadot				0x9000 0 0 1 &pciintc 19
143*c66ec88fSEmmanuel Vadot				0x9000 0 0 2 &pciintc 19
144*c66ec88fSEmmanuel Vadot				0x9000 0 0 3 &pciintc 19
145*c66ec88fSEmmanuel Vadot				0x9000 0 0 4 &pciintc 19
146*c66ec88fSEmmanuel Vadot			>;
147*c66ec88fSEmmanuel Vadot
148*c66ec88fSEmmanuel Vadot			pci-bridge@1 {
149*c66ec88fSEmmanuel Vadot				reg = <0x0800 0 0 0 0>;
150*c66ec88fSEmmanuel Vadot				device_type = "pci";
151*c66ec88fSEmmanuel Vadot				#interrupt-cells = <1>;
152*c66ec88fSEmmanuel Vadot				#address-cells = <3>;
153*c66ec88fSEmmanuel Vadot				#size-cells = <2>;
154*c66ec88fSEmmanuel Vadot
155*c66ec88fSEmmanuel Vadot				interrupt-map-mask = <0x0 0 0 0>;
156*c66ec88fSEmmanuel Vadot				interrupt-map = <0x0 0 0 0 &pciintc 20>;
157*c66ec88fSEmmanuel Vadot
158*c66ec88fSEmmanuel Vadot				status = "disabled";
159*c66ec88fSEmmanuel Vadot			};
160*c66ec88fSEmmanuel Vadot
161*c66ec88fSEmmanuel Vadot			pci-slot@17 {
162*c66ec88fSEmmanuel Vadot				reg = <0x8800 0 0 0 0>;
163*c66ec88fSEmmanuel Vadot				device_type = "pci";
164*c66ec88fSEmmanuel Vadot
165*c66ec88fSEmmanuel Vadot				status = "disabled";
166*c66ec88fSEmmanuel Vadot			};
167*c66ec88fSEmmanuel Vadot
168*c66ec88fSEmmanuel Vadot			pci-slot@18 {
169*c66ec88fSEmmanuel Vadot				reg = <0x9000 0 0 0 0>;
170*c66ec88fSEmmanuel Vadot				device_type = "pci";
171*c66ec88fSEmmanuel Vadot
172*c66ec88fSEmmanuel Vadot				status = "disabled";
173*c66ec88fSEmmanuel Vadot			};
174*c66ec88fSEmmanuel Vadot		};
175*c66ec88fSEmmanuel Vadot	};
176*c66ec88fSEmmanuel Vadot
177*c66ec88fSEmmanuel Vadot   b) Board specific dts file:
178*c66ec88fSEmmanuel Vadot
179*c66ec88fSEmmanuel Vadot	pci@10140000 {
180*c66ec88fSEmmanuel Vadot		status = "okay";
181*c66ec88fSEmmanuel Vadot
182*c66ec88fSEmmanuel Vadot		host-bridge {
183*c66ec88fSEmmanuel Vadot			pci-bridge@1 {
184*c66ec88fSEmmanuel Vadot				status = "okay";
185*c66ec88fSEmmanuel Vadot			};
186*c66ec88fSEmmanuel Vadot		};
187*c66ec88fSEmmanuel Vadot	};
188