xref: /openbmc/linux/Documentation/devicetree/bindings/pci/mediatek-pcie.txt (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1a9551ba6SRyder LeeMediaTek Gen2 PCIe controller
2d5a10922SRyder Lee
3d5a10922SRyder LeeRequired properties:
4a9551ba6SRyder Lee- compatible: Should contain one of the following strings:
5a9551ba6SRyder Lee	"mediatek,mt2701-pcie"
6c2e0ba9cSRyder Lee	"mediatek,mt2712-pcie"
7c2e0ba9cSRyder Lee	"mediatek,mt7622-pcie"
8a9551ba6SRyder Lee	"mediatek,mt7623-pcie"
9f4c737d6SJianjun Wang	"mediatek,mt7629-pcie"
10*c568d63bSJohn Crispin	"airoha,en7523-pcie"
11d5a10922SRyder Lee- device_type: Must be "pci"
12aa6eca5bSChuanjia Liu- reg: Base addresses and lengths of the root ports.
13c2e0ba9cSRyder Lee- reg-names: Names of the above areas to use during resource lookup.
14d5a10922SRyder Lee- #address-cells: Address representation for root ports (must be 3)
15d5a10922SRyder Lee- #size-cells: Size representation for root ports (must be 2)
16d5a10922SRyder Lee- clocks: Must contain an entry for each entry in clock-names.
17d5a10922SRyder Lee  See ../clocks/clock-bindings.txt for details.
18c2e0ba9cSRyder Lee- clock-names:
19c2e0ba9cSRyder Lee  Mandatory entries:
20c2e0ba9cSRyder Lee   - sys_ckN :transaction layer and data link layer clock
21c2e0ba9cSRyder Lee  Required entries for MT2701/MT7623:
22d5a10922SRyder Lee   - free_ck :for reference clock of PCIe subsys
23c2e0ba9cSRyder Lee  Required entries for MT2712/MT7622:
24c2e0ba9cSRyder Lee   - ahb_ckN :AHB slave interface operating clock for CSR access and RC
25c2e0ba9cSRyder Lee	      initiated MMIO access
26c2e0ba9cSRyder Lee  Required entries for MT7622:
27c2e0ba9cSRyder Lee   - axi_ckN :application layer MMIO channel operating clock
28c2e0ba9cSRyder Lee   - aux_ckN :pe2_mac_bridge and pe2_mac_core operating clock when
29c2e0ba9cSRyder Lee	      pcie_mac_ck/pcie_pipe_ck is turned off
30c2e0ba9cSRyder Lee   - obff_ckN :OBFF functional block operating clock
31c2e0ba9cSRyder Lee   - pipe_ckN :LTSSM and PHY/MAC layer operating clock
32c2e0ba9cSRyder Lee  where N starting from 0 to one less than the number of root ports.
33d5a10922SRyder Lee- phys: List of PHY specifiers (used by generic PHY framework).
34d5a10922SRyder Lee- phy-names : Must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the
35d5a10922SRyder Lee  number of PHYs as specified in *phys* property.
36d5a10922SRyder Lee- power-domains: A phandle and power domain specifier pair to the power domain
37d5a10922SRyder Lee  which is responsible for collapsing and restoring power to the peripheral.
38d5a10922SRyder Lee- bus-range: Range of bus numbers associated with this controller.
39d5a10922SRyder Lee- ranges: Ranges for the PCI memory and I/O regions.
40d5a10922SRyder Lee
41a9551ba6SRyder LeeRequired properties for MT7623/MT2701:
42a9551ba6SRyder Lee- #interrupt-cells: Size representation for interrupts (must be 1)
43a9551ba6SRyder Lee- interrupt-map-mask and interrupt-map: Standard PCI IRQ mapping properties
44a9551ba6SRyder Lee  Please refer to the standard PCI bus binding document for a more detailed
45a9551ba6SRyder Lee  explanation.
46a9551ba6SRyder Lee- resets: Must contain an entry for each entry in reset-names.
47a9551ba6SRyder Lee  See ../reset/reset.txt for details.
48a9551ba6SRyder Lee- reset-names: Must be "pcie-rst0", "pcie-rst1", "pcie-rstN".. based on the
49a9551ba6SRyder Lee  number of root ports.
50a9551ba6SRyder Lee
51aa6eca5bSChuanjia LiuRequired properties for MT2712/MT7622/MT7629:
52c2e0ba9cSRyder Lee-interrupts: A list of interrupt outputs of the controller, must have one
53c2e0ba9cSRyder Lee	     entry for each PCIe port
54aa6eca5bSChuanjia Liu- interrupt-names: Must include the following entries:
55aa6eca5bSChuanjia Liu	- "pcie_irq": The interrupt that is asserted when an MSI/INTX is received
56aa6eca5bSChuanjia Liu- linux,pci-domain: PCI domain ID. Should be unique for each host controller
57c2e0ba9cSRyder Lee
58d5a10922SRyder LeeIn addition, the device tree node must have sub-nodes describing each
59d5a10922SRyder LeePCIe port interface, having the following mandatory properties:
60d5a10922SRyder Lee
61d5a10922SRyder LeeRequired properties:
62d5a10922SRyder Lee- device_type: Must be "pci"
63d5a10922SRyder Lee- reg: Only the first four bytes are used to refer to the correct bus number
64d5a10922SRyder Lee  and device number.
65d5a10922SRyder Lee- #address-cells: Must be 3
66d5a10922SRyder Lee- #size-cells: Must be 2
67d5a10922SRyder Lee- #interrupt-cells: Must be 1
68d5a10922SRyder Lee- interrupt-map-mask and interrupt-map: Standard PCI IRQ mapping properties
69d5a10922SRyder Lee  Please refer to the standard PCI bus binding document for a more detailed
70d5a10922SRyder Lee  explanation.
71d5a10922SRyder Lee- ranges: Sub-ranges distributed from the PCIe controller node. An empty
72d5a10922SRyder Lee  property is sufficient.
73d5a10922SRyder Lee
74c2e0ba9cSRyder LeeExamples for MT7623:
75d5a10922SRyder Lee
76d5a10922SRyder Lee	hifsys: syscon@1a000000 {
77d5a10922SRyder Lee		compatible = "mediatek,mt7623-hifsys",
78d5a10922SRyder Lee			     "mediatek,mt2701-hifsys",
79d5a10922SRyder Lee			     "syscon";
80d5a10922SRyder Lee		reg = <0 0x1a000000 0 0x1000>;
81d5a10922SRyder Lee		#clock-cells = <1>;
82d5a10922SRyder Lee		#reset-cells = <1>;
83d5a10922SRyder Lee	};
84d5a10922SRyder Lee
85af7b9b79SRyder Lee	pcie: pcie@1a140000 {
86d5a10922SRyder Lee		compatible = "mediatek,mt7623-pcie";
87d5a10922SRyder Lee		device_type = "pci";
88d5a10922SRyder Lee		reg = <0 0x1a140000 0 0x1000>, /* PCIe shared registers */
89d5a10922SRyder Lee		      <0 0x1a142000 0 0x1000>, /* Port0 registers */
90d5a10922SRyder Lee		      <0 0x1a143000 0 0x1000>, /* Port1 registers */
91d5a10922SRyder Lee		      <0 0x1a144000 0 0x1000>; /* Port2 registers */
92c2e0ba9cSRyder Lee		reg-names = "subsys", "port0", "port1", "port2";
93d5a10922SRyder Lee		#address-cells = <3>;
94d5a10922SRyder Lee		#size-cells = <2>;
95d5a10922SRyder Lee		#interrupt-cells = <1>;
96d5a10922SRyder Lee		interrupt-map-mask = <0xf800 0 0 0>;
97d5a10922SRyder Lee		interrupt-map = <0x0000 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LEVEL_LOW>,
98d5a10922SRyder Lee				<0x0800 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>,
99d5a10922SRyder Lee				<0x1000 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>;
100d5a10922SRyder Lee		clocks = <&topckgen CLK_TOP_ETHIF_SEL>,
101d5a10922SRyder Lee			 <&hifsys CLK_HIFSYS_PCIE0>,
102d5a10922SRyder Lee			 <&hifsys CLK_HIFSYS_PCIE1>,
103d5a10922SRyder Lee			 <&hifsys CLK_HIFSYS_PCIE2>;
104d5a10922SRyder Lee		clock-names = "free_ck", "sys_ck0", "sys_ck1", "sys_ck2";
105d5a10922SRyder Lee		resets = <&hifsys MT2701_HIFSYS_PCIE0_RST>,
106d5a10922SRyder Lee			 <&hifsys MT2701_HIFSYS_PCIE1_RST>,
107d5a10922SRyder Lee			 <&hifsys MT2701_HIFSYS_PCIE2_RST>;
108d5a10922SRyder Lee		reset-names = "pcie-rst0", "pcie-rst1", "pcie-rst2";
109a9551ba6SRyder Lee		phys = <&pcie0_phy PHY_TYPE_PCIE>, <&pcie1_phy PHY_TYPE_PCIE>,
110a9551ba6SRyder Lee		       <&pcie2_phy PHY_TYPE_PCIE>;
111d5a10922SRyder Lee		phy-names = "pcie-phy0", "pcie-phy1", "pcie-phy2";
112d5a10922SRyder Lee		power-domains = <&scpsys MT2701_POWER_DOMAIN_HIF>;
113d5a10922SRyder Lee		bus-range = <0x00 0xff>;
114d5a10922SRyder Lee		ranges = <0x81000000 0 0x1a160000 0 0x1a160000 0 0x00010000	/* I/O space */
115d5a10922SRyder Lee			  0x83000000 0 0x60000000 0 0x60000000 0 0x10000000>;	/* memory space */
116d5a10922SRyder Lee
117d5a10922SRyder Lee		pcie@0,0 {
118d5a10922SRyder Lee			reg = <0x0000 0 0 0 0>;
119d5a10922SRyder Lee			#address-cells = <3>;
120d5a10922SRyder Lee			#size-cells = <2>;
121d5a10922SRyder Lee			#interrupt-cells = <1>;
122d5a10922SRyder Lee			interrupt-map-mask = <0 0 0 0>;
123d5a10922SRyder Lee			interrupt-map = <0 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LEVEL_LOW>;
124d5a10922SRyder Lee			ranges;
125d5a10922SRyder Lee		};
126d5a10922SRyder Lee
127d5a10922SRyder Lee		pcie@1,0 {
128d5a10922SRyder Lee			reg = <0x0800 0 0 0 0>;
129d5a10922SRyder Lee			#address-cells = <3>;
130d5a10922SRyder Lee			#size-cells = <2>;
131d5a10922SRyder Lee			#interrupt-cells = <1>;
132d5a10922SRyder Lee			interrupt-map-mask = <0 0 0 0>;
133d5a10922SRyder Lee			interrupt-map = <0 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>;
134d5a10922SRyder Lee			ranges;
135d5a10922SRyder Lee		};
136d5a10922SRyder Lee
137d5a10922SRyder Lee		pcie@2,0 {
138d5a10922SRyder Lee			reg = <0x1000 0 0 0 0>;
139d5a10922SRyder Lee			#address-cells = <3>;
140d5a10922SRyder Lee			#size-cells = <2>;
141d5a10922SRyder Lee			#interrupt-cells = <1>;
142d5a10922SRyder Lee			interrupt-map-mask = <0 0 0 0>;
143d5a10922SRyder Lee			interrupt-map = <0 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>;
144d5a10922SRyder Lee			ranges;
145d5a10922SRyder Lee		};
146d5a10922SRyder Lee	};
147c2e0ba9cSRyder Lee
148c2e0ba9cSRyder LeeExamples for MT2712:
149af7b9b79SRyder Lee
150aa6eca5bSChuanjia Liu	pcie1: pcie@112ff000 {
151c2e0ba9cSRyder Lee		compatible = "mediatek,mt2712-pcie";
152c2e0ba9cSRyder Lee		device_type = "pci";
153aa6eca5bSChuanjia Liu		reg = <0 0x112ff000 0 0x1000>;
154aa6eca5bSChuanjia Liu		reg-names = "port1";
155aa6eca5bSChuanjia Liu		linux,pci-domain = <1>;
156c2e0ba9cSRyder Lee		#address-cells = <3>;
157c2e0ba9cSRyder Lee		#size-cells = <2>;
158aa6eca5bSChuanjia Liu		interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
159aa6eca5bSChuanjia Liu		interrupt-names = "pcie_irq";
160aa6eca5bSChuanjia Liu		clocks = <&topckgen CLK_TOP_PE2_MAC_P1_SEL>,
161c2e0ba9cSRyder Lee			 <&pericfg CLK_PERI_PCIE1>;
162aa6eca5bSChuanjia Liu		clock-names = "sys_ck1", "ahb_ck1";
163aa6eca5bSChuanjia Liu		phys = <&u3port1 PHY_TYPE_PCIE>;
164aa6eca5bSChuanjia Liu		phy-names = "pcie-phy1";
165c2e0ba9cSRyder Lee		bus-range = <0x00 0xff>;
166aa6eca5bSChuanjia Liu		ranges = <0x82000000 0 0x11400000  0x0 0x11400000  0 0x300000>;
167aa6eca5bSChuanjia Liu		status = "disabled";
168c2e0ba9cSRyder Lee
169c2e0ba9cSRyder Lee		#interrupt-cells = <1>;
170c2e0ba9cSRyder Lee		interrupt-map-mask = <0 0 0 7>;
171c2e0ba9cSRyder Lee		interrupt-map = <0 0 0 1 &pcie_intc1 0>,
172c2e0ba9cSRyder Lee				<0 0 0 2 &pcie_intc1 1>,
173c2e0ba9cSRyder Lee				<0 0 0 3 &pcie_intc1 2>,
174c2e0ba9cSRyder Lee				<0 0 0 4 &pcie_intc1 3>;
175c2e0ba9cSRyder Lee		pcie_intc1: interrupt-controller {
176c2e0ba9cSRyder Lee			interrupt-controller;
177c2e0ba9cSRyder Lee			#address-cells = <0>;
178c2e0ba9cSRyder Lee			#interrupt-cells = <1>;
179c2e0ba9cSRyder Lee		};
180c2e0ba9cSRyder Lee	};
181aa6eca5bSChuanjia Liu
182aa6eca5bSChuanjia Liu	pcie0: pcie@11700000 {
183aa6eca5bSChuanjia Liu		compatible = "mediatek,mt2712-pcie";
184aa6eca5bSChuanjia Liu		device_type = "pci";
185aa6eca5bSChuanjia Liu		reg = <0 0x11700000 0 0x1000>;
186aa6eca5bSChuanjia Liu		reg-names = "port0";
187aa6eca5bSChuanjia Liu		linux,pci-domain = <0>;
188aa6eca5bSChuanjia Liu		#address-cells = <3>;
189aa6eca5bSChuanjia Liu		#size-cells = <2>;
190aa6eca5bSChuanjia Liu		interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
191aa6eca5bSChuanjia Liu		interrupt-names = "pcie_irq";
192aa6eca5bSChuanjia Liu		clocks = <&topckgen CLK_TOP_PE2_MAC_P0_SEL>,
193aa6eca5bSChuanjia Liu			 <&pericfg CLK_PERI_PCIE0>;
194aa6eca5bSChuanjia Liu		clock-names = "sys_ck0", "ahb_ck0";
195aa6eca5bSChuanjia Liu		phys = <&u3port0 PHY_TYPE_PCIE>;
196aa6eca5bSChuanjia Liu		phy-names = "pcie-phy0";
197aa6eca5bSChuanjia Liu		bus-range = <0x00 0xff>;
198aa6eca5bSChuanjia Liu		ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>;
199aa6eca5bSChuanjia Liu		status = "disabled";
200aa6eca5bSChuanjia Liu
201aa6eca5bSChuanjia Liu		#interrupt-cells = <1>;
202aa6eca5bSChuanjia Liu		interrupt-map-mask = <0 0 0 7>;
203aa6eca5bSChuanjia Liu		interrupt-map = <0 0 0 1 &pcie_intc0 0>,
204aa6eca5bSChuanjia Liu				<0 0 0 2 &pcie_intc0 1>,
205aa6eca5bSChuanjia Liu				<0 0 0 3 &pcie_intc0 2>,
206aa6eca5bSChuanjia Liu				<0 0 0 4 &pcie_intc0 3>;
207aa6eca5bSChuanjia Liu		pcie_intc0: interrupt-controller {
208aa6eca5bSChuanjia Liu			interrupt-controller;
209aa6eca5bSChuanjia Liu			#address-cells = <0>;
210aa6eca5bSChuanjia Liu			#interrupt-cells = <1>;
211aa6eca5bSChuanjia Liu		};
212c2e0ba9cSRyder Lee	};
213c2e0ba9cSRyder Lee
214c2e0ba9cSRyder LeeExamples for MT7622:
215af7b9b79SRyder Lee
216aa6eca5bSChuanjia Liu	pcie0: pcie@1a143000 {
217c2e0ba9cSRyder Lee		compatible = "mediatek,mt7622-pcie";
218c2e0ba9cSRyder Lee		device_type = "pci";
219aa6eca5bSChuanjia Liu		reg = <0 0x1a143000 0 0x1000>;
220aa6eca5bSChuanjia Liu		reg-names = "port0";
221aa6eca5bSChuanjia Liu		linux,pci-domain = <0>;
222c2e0ba9cSRyder Lee		#address-cells = <3>;
223c2e0ba9cSRyder Lee		#size-cells = <2>;
224aa6eca5bSChuanjia Liu		interrupts = <GIC_SPI 228 IRQ_TYPE_LEVEL_LOW>;
225aa6eca5bSChuanjia Liu		interrupt-names = "pcie_irq";
226c2e0ba9cSRyder Lee		clocks = <&pciesys CLK_PCIE_P0_MAC_EN>,
227c2e0ba9cSRyder Lee			 <&pciesys CLK_PCIE_P0_AHB_EN>,
228c2e0ba9cSRyder Lee			 <&pciesys CLK_PCIE_P0_AUX_EN>,
229c2e0ba9cSRyder Lee			 <&pciesys CLK_PCIE_P0_AXI_EN>,
230c2e0ba9cSRyder Lee			 <&pciesys CLK_PCIE_P0_OBFF_EN>,
231aa6eca5bSChuanjia Liu			 <&pciesys CLK_PCIE_P0_PIPE_EN>;
232aa6eca5bSChuanjia Liu		clock-names = "sys_ck0", "ahb_ck0", "aux_ck0",
233aa6eca5bSChuanjia Liu			      "axi_ck0", "obff_ck0", "pipe_ck0";
234aa6eca5bSChuanjia Liu
235c2e0ba9cSRyder Lee		power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>;
236c2e0ba9cSRyder Lee		bus-range = <0x00 0xff>;
237aa6eca5bSChuanjia Liu		ranges = <0x82000000 0 0x20000000  0x0 0x20000000  0 0x8000000>;
238aa6eca5bSChuanjia Liu		status = "disabled";
239c2e0ba9cSRyder Lee
240c2e0ba9cSRyder Lee		#interrupt-cells = <1>;
241c2e0ba9cSRyder Lee		interrupt-map-mask = <0 0 0 7>;
242c2e0ba9cSRyder Lee		interrupt-map = <0 0 0 1 &pcie_intc0 0>,
243c2e0ba9cSRyder Lee				<0 0 0 2 &pcie_intc0 1>,
244c2e0ba9cSRyder Lee				<0 0 0 3 &pcie_intc0 2>,
245c2e0ba9cSRyder Lee				<0 0 0 4 &pcie_intc0 3>;
246c2e0ba9cSRyder Lee		pcie_intc0: interrupt-controller {
247c2e0ba9cSRyder Lee			interrupt-controller;
248c2e0ba9cSRyder Lee			#address-cells = <0>;
249c2e0ba9cSRyder Lee			#interrupt-cells = <1>;
250c2e0ba9cSRyder Lee		};
251c2e0ba9cSRyder Lee	};
252c2e0ba9cSRyder Lee
253aa6eca5bSChuanjia Liu	pcie1: pcie@1a145000 {
254aa6eca5bSChuanjia Liu		compatible = "mediatek,mt7622-pcie";
255aa6eca5bSChuanjia Liu		device_type = "pci";
256aa6eca5bSChuanjia Liu		reg = <0 0x1a145000 0 0x1000>;
257aa6eca5bSChuanjia Liu		reg-names = "port1";
258aa6eca5bSChuanjia Liu		linux,pci-domain = <1>;
259c2e0ba9cSRyder Lee		#address-cells = <3>;
260c2e0ba9cSRyder Lee		#size-cells = <2>;
261aa6eca5bSChuanjia Liu		interrupts = <GIC_SPI 229 IRQ_TYPE_LEVEL_LOW>;
262aa6eca5bSChuanjia Liu		interrupt-names = "pcie_irq";
263aa6eca5bSChuanjia Liu		clocks = <&pciesys CLK_PCIE_P1_MAC_EN>,
264aa6eca5bSChuanjia Liu			 /* designer has connect RC1 with p0_ahb clock */
265aa6eca5bSChuanjia Liu			 <&pciesys CLK_PCIE_P0_AHB_EN>,
266aa6eca5bSChuanjia Liu			 <&pciesys CLK_PCIE_P1_AUX_EN>,
267aa6eca5bSChuanjia Liu			 <&pciesys CLK_PCIE_P1_AXI_EN>,
268aa6eca5bSChuanjia Liu			 <&pciesys CLK_PCIE_P1_OBFF_EN>,
269aa6eca5bSChuanjia Liu			 <&pciesys CLK_PCIE_P1_PIPE_EN>;
270aa6eca5bSChuanjia Liu		clock-names = "sys_ck1", "ahb_ck1", "aux_ck1",
271aa6eca5bSChuanjia Liu			      "axi_ck1", "obff_ck1", "pipe_ck1";
272aa6eca5bSChuanjia Liu
273aa6eca5bSChuanjia Liu		power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>;
274aa6eca5bSChuanjia Liu		bus-range = <0x00 0xff>;
275aa6eca5bSChuanjia Liu		ranges = <0x82000000 0 0x28000000  0x0 0x28000000  0 0x8000000>;
276aa6eca5bSChuanjia Liu		status = "disabled";
277aa6eca5bSChuanjia Liu
278c2e0ba9cSRyder Lee		#interrupt-cells = <1>;
279c2e0ba9cSRyder Lee		interrupt-map-mask = <0 0 0 7>;
280c2e0ba9cSRyder Lee		interrupt-map = <0 0 0 1 &pcie_intc1 0>,
281c2e0ba9cSRyder Lee				<0 0 0 2 &pcie_intc1 1>,
282c2e0ba9cSRyder Lee				<0 0 0 3 &pcie_intc1 2>,
283c2e0ba9cSRyder Lee				<0 0 0 4 &pcie_intc1 3>;
284c2e0ba9cSRyder Lee		pcie_intc1: interrupt-controller {
285c2e0ba9cSRyder Lee			interrupt-controller;
286c2e0ba9cSRyder Lee			#address-cells = <0>;
287c2e0ba9cSRyder Lee			#interrupt-cells = <1>;
288c2e0ba9cSRyder Lee		};
289c2e0ba9cSRyder Lee	};
290