162306a36Sopenharmony_ciMediaTek Gen2 PCIe controller
262306a36Sopenharmony_ci
362306a36Sopenharmony_ciRequired properties:
462306a36Sopenharmony_ci- compatible: Should contain one of the following strings:
562306a36Sopenharmony_ci	"mediatek,mt2701-pcie"
662306a36Sopenharmony_ci	"mediatek,mt2712-pcie"
762306a36Sopenharmony_ci	"mediatek,mt7622-pcie"
862306a36Sopenharmony_ci	"mediatek,mt7623-pcie"
962306a36Sopenharmony_ci	"mediatek,mt7629-pcie"
1062306a36Sopenharmony_ci	"airoha,en7523-pcie"
1162306a36Sopenharmony_ci- device_type: Must be "pci"
1262306a36Sopenharmony_ci- reg: Base addresses and lengths of the root ports.
1362306a36Sopenharmony_ci- reg-names: Names of the above areas to use during resource lookup.
1462306a36Sopenharmony_ci- #address-cells: Address representation for root ports (must be 3)
1562306a36Sopenharmony_ci- #size-cells: Size representation for root ports (must be 2)
1662306a36Sopenharmony_ci- clocks: Must contain an entry for each entry in clock-names.
1762306a36Sopenharmony_ci  See ../clocks/clock-bindings.txt for details.
1862306a36Sopenharmony_ci- clock-names:
1962306a36Sopenharmony_ci  Mandatory entries:
2062306a36Sopenharmony_ci   - sys_ckN :transaction layer and data link layer clock
2162306a36Sopenharmony_ci  Required entries for MT2701/MT7623:
2262306a36Sopenharmony_ci   - free_ck :for reference clock of PCIe subsys
2362306a36Sopenharmony_ci  Required entries for MT2712/MT7622:
2462306a36Sopenharmony_ci   - ahb_ckN :AHB slave interface operating clock for CSR access and RC
2562306a36Sopenharmony_ci	      initiated MMIO access
2662306a36Sopenharmony_ci  Required entries for MT7622:
2762306a36Sopenharmony_ci   - axi_ckN :application layer MMIO channel operating clock
2862306a36Sopenharmony_ci   - aux_ckN :pe2_mac_bridge and pe2_mac_core operating clock when
2962306a36Sopenharmony_ci	      pcie_mac_ck/pcie_pipe_ck is turned off
3062306a36Sopenharmony_ci   - obff_ckN :OBFF functional block operating clock
3162306a36Sopenharmony_ci   - pipe_ckN :LTSSM and PHY/MAC layer operating clock
3262306a36Sopenharmony_ci  where N starting from 0 to one less than the number of root ports.
3362306a36Sopenharmony_ci- phys: List of PHY specifiers (used by generic PHY framework).
3462306a36Sopenharmony_ci- phy-names : Must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the
3562306a36Sopenharmony_ci  number of PHYs as specified in *phys* property.
3662306a36Sopenharmony_ci- power-domains: A phandle and power domain specifier pair to the power domain
3762306a36Sopenharmony_ci  which is responsible for collapsing and restoring power to the peripheral.
3862306a36Sopenharmony_ci- bus-range: Range of bus numbers associated with this controller.
3962306a36Sopenharmony_ci- ranges: Ranges for the PCI memory and I/O regions.
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ciRequired properties for MT7623/MT2701:
4262306a36Sopenharmony_ci- #interrupt-cells: Size representation for interrupts (must be 1)
4362306a36Sopenharmony_ci- interrupt-map-mask and interrupt-map: Standard PCI IRQ mapping properties
4462306a36Sopenharmony_ci  Please refer to the standard PCI bus binding document for a more detailed
4562306a36Sopenharmony_ci  explanation.
4662306a36Sopenharmony_ci- resets: Must contain an entry for each entry in reset-names.
4762306a36Sopenharmony_ci  See ../reset/reset.txt for details.
4862306a36Sopenharmony_ci- reset-names: Must be "pcie-rst0", "pcie-rst1", "pcie-rstN".. based on the
4962306a36Sopenharmony_ci  number of root ports.
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciRequired properties for MT2712/MT7622/MT7629:
5262306a36Sopenharmony_ci-interrupts: A list of interrupt outputs of the controller, must have one
5362306a36Sopenharmony_ci	     entry for each PCIe port
5462306a36Sopenharmony_ci- interrupt-names: Must include the following entries:
5562306a36Sopenharmony_ci	- "pcie_irq": The interrupt that is asserted when an MSI/INTX is received
5662306a36Sopenharmony_ci- linux,pci-domain: PCI domain ID. Should be unique for each host controller
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciIn addition, the device tree node must have sub-nodes describing each
5962306a36Sopenharmony_ciPCIe port interface, having the following mandatory properties:
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ciRequired properties:
6262306a36Sopenharmony_ci- device_type: Must be "pci"
6362306a36Sopenharmony_ci- reg: Only the first four bytes are used to refer to the correct bus number
6462306a36Sopenharmony_ci  and device number.
6562306a36Sopenharmony_ci- #address-cells: Must be 3
6662306a36Sopenharmony_ci- #size-cells: Must be 2
6762306a36Sopenharmony_ci- #interrupt-cells: Must be 1
6862306a36Sopenharmony_ci- interrupt-map-mask and interrupt-map: Standard PCI IRQ mapping properties
6962306a36Sopenharmony_ci  Please refer to the standard PCI bus binding document for a more detailed
7062306a36Sopenharmony_ci  explanation.
7162306a36Sopenharmony_ci- ranges: Sub-ranges distributed from the PCIe controller node. An empty
7262306a36Sopenharmony_ci  property is sufficient.
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ciExamples for MT7623:
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci	hifsys: syscon@1a000000 {
7762306a36Sopenharmony_ci		compatible = "mediatek,mt7623-hifsys",
7862306a36Sopenharmony_ci			     "mediatek,mt2701-hifsys",
7962306a36Sopenharmony_ci			     "syscon";
8062306a36Sopenharmony_ci		reg = <0 0x1a000000 0 0x1000>;
8162306a36Sopenharmony_ci		#clock-cells = <1>;
8262306a36Sopenharmony_ci		#reset-cells = <1>;
8362306a36Sopenharmony_ci	};
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci	pcie: pcie@1a140000 {
8662306a36Sopenharmony_ci		compatible = "mediatek,mt7623-pcie";
8762306a36Sopenharmony_ci		device_type = "pci";
8862306a36Sopenharmony_ci		reg = <0 0x1a140000 0 0x1000>, /* PCIe shared registers */
8962306a36Sopenharmony_ci		      <0 0x1a142000 0 0x1000>, /* Port0 registers */
9062306a36Sopenharmony_ci		      <0 0x1a143000 0 0x1000>, /* Port1 registers */
9162306a36Sopenharmony_ci		      <0 0x1a144000 0 0x1000>; /* Port2 registers */
9262306a36Sopenharmony_ci		reg-names = "subsys", "port0", "port1", "port2";
9362306a36Sopenharmony_ci		#address-cells = <3>;
9462306a36Sopenharmony_ci		#size-cells = <2>;
9562306a36Sopenharmony_ci		#interrupt-cells = <1>;
9662306a36Sopenharmony_ci		interrupt-map-mask = <0xf800 0 0 0>;
9762306a36Sopenharmony_ci		interrupt-map = <0x0000 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LEVEL_LOW>,
9862306a36Sopenharmony_ci				<0x0800 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>,
9962306a36Sopenharmony_ci				<0x1000 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>;
10062306a36Sopenharmony_ci		clocks = <&topckgen CLK_TOP_ETHIF_SEL>,
10162306a36Sopenharmony_ci			 <&hifsys CLK_HIFSYS_PCIE0>,
10262306a36Sopenharmony_ci			 <&hifsys CLK_HIFSYS_PCIE1>,
10362306a36Sopenharmony_ci			 <&hifsys CLK_HIFSYS_PCIE2>;
10462306a36Sopenharmony_ci		clock-names = "free_ck", "sys_ck0", "sys_ck1", "sys_ck2";
10562306a36Sopenharmony_ci		resets = <&hifsys MT2701_HIFSYS_PCIE0_RST>,
10662306a36Sopenharmony_ci			 <&hifsys MT2701_HIFSYS_PCIE1_RST>,
10762306a36Sopenharmony_ci			 <&hifsys MT2701_HIFSYS_PCIE2_RST>;
10862306a36Sopenharmony_ci		reset-names = "pcie-rst0", "pcie-rst1", "pcie-rst2";
10962306a36Sopenharmony_ci		phys = <&pcie0_phy PHY_TYPE_PCIE>, <&pcie1_phy PHY_TYPE_PCIE>,
11062306a36Sopenharmony_ci		       <&pcie2_phy PHY_TYPE_PCIE>;
11162306a36Sopenharmony_ci		phy-names = "pcie-phy0", "pcie-phy1", "pcie-phy2";
11262306a36Sopenharmony_ci		power-domains = <&scpsys MT2701_POWER_DOMAIN_HIF>;
11362306a36Sopenharmony_ci		bus-range = <0x00 0xff>;
11462306a36Sopenharmony_ci		ranges = <0x81000000 0 0x1a160000 0 0x1a160000 0 0x00010000	/* I/O space */
11562306a36Sopenharmony_ci			  0x83000000 0 0x60000000 0 0x60000000 0 0x10000000>;	/* memory space */
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci		pcie@0,0 {
11862306a36Sopenharmony_ci			reg = <0x0000 0 0 0 0>;
11962306a36Sopenharmony_ci			#address-cells = <3>;
12062306a36Sopenharmony_ci			#size-cells = <2>;
12162306a36Sopenharmony_ci			#interrupt-cells = <1>;
12262306a36Sopenharmony_ci			interrupt-map-mask = <0 0 0 0>;
12362306a36Sopenharmony_ci			interrupt-map = <0 0 0 0 &sysirq GIC_SPI 193 IRQ_TYPE_LEVEL_LOW>;
12462306a36Sopenharmony_ci			ranges;
12562306a36Sopenharmony_ci		};
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci		pcie@1,0 {
12862306a36Sopenharmony_ci			reg = <0x0800 0 0 0 0>;
12962306a36Sopenharmony_ci			#address-cells = <3>;
13062306a36Sopenharmony_ci			#size-cells = <2>;
13162306a36Sopenharmony_ci			#interrupt-cells = <1>;
13262306a36Sopenharmony_ci			interrupt-map-mask = <0 0 0 0>;
13362306a36Sopenharmony_ci			interrupt-map = <0 0 0 0 &sysirq GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>;
13462306a36Sopenharmony_ci			ranges;
13562306a36Sopenharmony_ci		};
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci		pcie@2,0 {
13862306a36Sopenharmony_ci			reg = <0x1000 0 0 0 0>;
13962306a36Sopenharmony_ci			#address-cells = <3>;
14062306a36Sopenharmony_ci			#size-cells = <2>;
14162306a36Sopenharmony_ci			#interrupt-cells = <1>;
14262306a36Sopenharmony_ci			interrupt-map-mask = <0 0 0 0>;
14362306a36Sopenharmony_ci			interrupt-map = <0 0 0 0 &sysirq GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>;
14462306a36Sopenharmony_ci			ranges;
14562306a36Sopenharmony_ci		};
14662306a36Sopenharmony_ci	};
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ciExamples for MT2712:
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci	pcie1: pcie@112ff000 {
15162306a36Sopenharmony_ci		compatible = "mediatek,mt2712-pcie";
15262306a36Sopenharmony_ci		device_type = "pci";
15362306a36Sopenharmony_ci		reg = <0 0x112ff000 0 0x1000>;
15462306a36Sopenharmony_ci		reg-names = "port1";
15562306a36Sopenharmony_ci		linux,pci-domain = <1>;
15662306a36Sopenharmony_ci		#address-cells = <3>;
15762306a36Sopenharmony_ci		#size-cells = <2>;
15862306a36Sopenharmony_ci		interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
15962306a36Sopenharmony_ci		interrupt-names = "pcie_irq";
16062306a36Sopenharmony_ci		clocks = <&topckgen CLK_TOP_PE2_MAC_P1_SEL>,
16162306a36Sopenharmony_ci			 <&pericfg CLK_PERI_PCIE1>;
16262306a36Sopenharmony_ci		clock-names = "sys_ck1", "ahb_ck1";
16362306a36Sopenharmony_ci		phys = <&u3port1 PHY_TYPE_PCIE>;
16462306a36Sopenharmony_ci		phy-names = "pcie-phy1";
16562306a36Sopenharmony_ci		bus-range = <0x00 0xff>;
16662306a36Sopenharmony_ci		ranges = <0x82000000 0 0x11400000  0x0 0x11400000  0 0x300000>;
16762306a36Sopenharmony_ci		status = "disabled";
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci		#interrupt-cells = <1>;
17062306a36Sopenharmony_ci		interrupt-map-mask = <0 0 0 7>;
17162306a36Sopenharmony_ci		interrupt-map = <0 0 0 1 &pcie_intc1 0>,
17262306a36Sopenharmony_ci				<0 0 0 2 &pcie_intc1 1>,
17362306a36Sopenharmony_ci				<0 0 0 3 &pcie_intc1 2>,
17462306a36Sopenharmony_ci				<0 0 0 4 &pcie_intc1 3>;
17562306a36Sopenharmony_ci		pcie_intc1: interrupt-controller {
17662306a36Sopenharmony_ci			interrupt-controller;
17762306a36Sopenharmony_ci			#address-cells = <0>;
17862306a36Sopenharmony_ci			#interrupt-cells = <1>;
17962306a36Sopenharmony_ci		};
18062306a36Sopenharmony_ci	};
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci	pcie0: pcie@11700000 {
18362306a36Sopenharmony_ci		compatible = "mediatek,mt2712-pcie";
18462306a36Sopenharmony_ci		device_type = "pci";
18562306a36Sopenharmony_ci		reg = <0 0x11700000 0 0x1000>;
18662306a36Sopenharmony_ci		reg-names = "port0";
18762306a36Sopenharmony_ci		linux,pci-domain = <0>;
18862306a36Sopenharmony_ci		#address-cells = <3>;
18962306a36Sopenharmony_ci		#size-cells = <2>;
19062306a36Sopenharmony_ci		interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
19162306a36Sopenharmony_ci		interrupt-names = "pcie_irq";
19262306a36Sopenharmony_ci		clocks = <&topckgen CLK_TOP_PE2_MAC_P0_SEL>,
19362306a36Sopenharmony_ci			 <&pericfg CLK_PERI_PCIE0>;
19462306a36Sopenharmony_ci		clock-names = "sys_ck0", "ahb_ck0";
19562306a36Sopenharmony_ci		phys = <&u3port0 PHY_TYPE_PCIE>;
19662306a36Sopenharmony_ci		phy-names = "pcie-phy0";
19762306a36Sopenharmony_ci		bus-range = <0x00 0xff>;
19862306a36Sopenharmony_ci		ranges = <0x82000000 0 0x20000000 0x0 0x20000000 0 0x10000000>;
19962306a36Sopenharmony_ci		status = "disabled";
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci		#interrupt-cells = <1>;
20262306a36Sopenharmony_ci		interrupt-map-mask = <0 0 0 7>;
20362306a36Sopenharmony_ci		interrupt-map = <0 0 0 1 &pcie_intc0 0>,
20462306a36Sopenharmony_ci				<0 0 0 2 &pcie_intc0 1>,
20562306a36Sopenharmony_ci				<0 0 0 3 &pcie_intc0 2>,
20662306a36Sopenharmony_ci				<0 0 0 4 &pcie_intc0 3>;
20762306a36Sopenharmony_ci		pcie_intc0: interrupt-controller {
20862306a36Sopenharmony_ci			interrupt-controller;
20962306a36Sopenharmony_ci			#address-cells = <0>;
21062306a36Sopenharmony_ci			#interrupt-cells = <1>;
21162306a36Sopenharmony_ci		};
21262306a36Sopenharmony_ci	};
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ciExamples for MT7622:
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci	pcie0: pcie@1a143000 {
21762306a36Sopenharmony_ci		compatible = "mediatek,mt7622-pcie";
21862306a36Sopenharmony_ci		device_type = "pci";
21962306a36Sopenharmony_ci		reg = <0 0x1a143000 0 0x1000>;
22062306a36Sopenharmony_ci		reg-names = "port0";
22162306a36Sopenharmony_ci		linux,pci-domain = <0>;
22262306a36Sopenharmony_ci		#address-cells = <3>;
22362306a36Sopenharmony_ci		#size-cells = <2>;
22462306a36Sopenharmony_ci		interrupts = <GIC_SPI 228 IRQ_TYPE_LEVEL_LOW>;
22562306a36Sopenharmony_ci		interrupt-names = "pcie_irq";
22662306a36Sopenharmony_ci		clocks = <&pciesys CLK_PCIE_P0_MAC_EN>,
22762306a36Sopenharmony_ci			 <&pciesys CLK_PCIE_P0_AHB_EN>,
22862306a36Sopenharmony_ci			 <&pciesys CLK_PCIE_P0_AUX_EN>,
22962306a36Sopenharmony_ci			 <&pciesys CLK_PCIE_P0_AXI_EN>,
23062306a36Sopenharmony_ci			 <&pciesys CLK_PCIE_P0_OBFF_EN>,
23162306a36Sopenharmony_ci			 <&pciesys CLK_PCIE_P0_PIPE_EN>;
23262306a36Sopenharmony_ci		clock-names = "sys_ck0", "ahb_ck0", "aux_ck0",
23362306a36Sopenharmony_ci			      "axi_ck0", "obff_ck0", "pipe_ck0";
23462306a36Sopenharmony_ci
23562306a36Sopenharmony_ci		power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>;
23662306a36Sopenharmony_ci		bus-range = <0x00 0xff>;
23762306a36Sopenharmony_ci		ranges = <0x82000000 0 0x20000000  0x0 0x20000000  0 0x8000000>;
23862306a36Sopenharmony_ci		status = "disabled";
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci		#interrupt-cells = <1>;
24162306a36Sopenharmony_ci		interrupt-map-mask = <0 0 0 7>;
24262306a36Sopenharmony_ci		interrupt-map = <0 0 0 1 &pcie_intc0 0>,
24362306a36Sopenharmony_ci				<0 0 0 2 &pcie_intc0 1>,
24462306a36Sopenharmony_ci				<0 0 0 3 &pcie_intc0 2>,
24562306a36Sopenharmony_ci				<0 0 0 4 &pcie_intc0 3>;
24662306a36Sopenharmony_ci		pcie_intc0: interrupt-controller {
24762306a36Sopenharmony_ci			interrupt-controller;
24862306a36Sopenharmony_ci			#address-cells = <0>;
24962306a36Sopenharmony_ci			#interrupt-cells = <1>;
25062306a36Sopenharmony_ci		};
25162306a36Sopenharmony_ci	};
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci	pcie1: pcie@1a145000 {
25462306a36Sopenharmony_ci		compatible = "mediatek,mt7622-pcie";
25562306a36Sopenharmony_ci		device_type = "pci";
25662306a36Sopenharmony_ci		reg = <0 0x1a145000 0 0x1000>;
25762306a36Sopenharmony_ci		reg-names = "port1";
25862306a36Sopenharmony_ci		linux,pci-domain = <1>;
25962306a36Sopenharmony_ci		#address-cells = <3>;
26062306a36Sopenharmony_ci		#size-cells = <2>;
26162306a36Sopenharmony_ci		interrupts = <GIC_SPI 229 IRQ_TYPE_LEVEL_LOW>;
26262306a36Sopenharmony_ci		interrupt-names = "pcie_irq";
26362306a36Sopenharmony_ci		clocks = <&pciesys CLK_PCIE_P1_MAC_EN>,
26462306a36Sopenharmony_ci			 /* designer has connect RC1 with p0_ahb clock */
26562306a36Sopenharmony_ci			 <&pciesys CLK_PCIE_P0_AHB_EN>,
26662306a36Sopenharmony_ci			 <&pciesys CLK_PCIE_P1_AUX_EN>,
26762306a36Sopenharmony_ci			 <&pciesys CLK_PCIE_P1_AXI_EN>,
26862306a36Sopenharmony_ci			 <&pciesys CLK_PCIE_P1_OBFF_EN>,
26962306a36Sopenharmony_ci			 <&pciesys CLK_PCIE_P1_PIPE_EN>;
27062306a36Sopenharmony_ci		clock-names = "sys_ck1", "ahb_ck1", "aux_ck1",
27162306a36Sopenharmony_ci			      "axi_ck1", "obff_ck1", "pipe_ck1";
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_ci		power-domains = <&scpsys MT7622_POWER_DOMAIN_HIF0>;
27462306a36Sopenharmony_ci		bus-range = <0x00 0xff>;
27562306a36Sopenharmony_ci		ranges = <0x82000000 0 0x28000000  0x0 0x28000000  0 0x8000000>;
27662306a36Sopenharmony_ci		status = "disabled";
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci		#interrupt-cells = <1>;
27962306a36Sopenharmony_ci		interrupt-map-mask = <0 0 0 7>;
28062306a36Sopenharmony_ci		interrupt-map = <0 0 0 1 &pcie_intc1 0>,
28162306a36Sopenharmony_ci				<0 0 0 2 &pcie_intc1 1>,
28262306a36Sopenharmony_ci				<0 0 0 3 &pcie_intc1 2>,
28362306a36Sopenharmony_ci				<0 0 0 4 &pcie_intc1 3>;
28462306a36Sopenharmony_ci		pcie_intc1: interrupt-controller {
28562306a36Sopenharmony_ci			interrupt-controller;
28662306a36Sopenharmony_ci			#address-cells = <0>;
28762306a36Sopenharmony_ci			#interrupt-cells = <1>;
28862306a36Sopenharmony_ci		};
28962306a36Sopenharmony_ci	};
290