From 51e6f907133aa1d448bfa1b68113ce39d03cdb22 Mon Sep 17 00:00:00 2001 From: Marcelo Alcantara Date: Thu, 3 Dec 2026 08:58:01 +1000 Subject: [PATCH 1/2] PCI: apple: accept 4-cell die-0 AIC MSI specifiers for PCIe-C slices Multi-die AIC2 controllers such as T6031/T6034 encode interrupt specifiers with four cells () instead of three (). All T6031/T6034 USB4 PCIe-C tunnel hosts sit on die 0 and share the same 32-vector per-bridge slice shape already validated by apple_t8122_msi_window() and apple_t8122_msi_claim(). Add apple_pciec_msi_irq_index() in pcie-apple-t8122.h to validate both 3-cell single-die and 4-cell die-0 specifiers (rejecting non-zero die, wrong trigger flags, or disallowed 4-cell specifiers), use it in apple_msi_init() before claiming a slice, and extend tools/asahi/pcie-apple-msi-slice-tests.c to cover both specifier parsing and the T6031 slice shape (window 1854, bases 0x20/0x40/0x60). Single-die T6030 and T6040 keep strict 3-cell specifier validation. Based on work by Will Bunting in omacom/linux-aurora#498. Signed-off-by: Marcelo Alcantara --- drivers/pci/controller/pcie-apple-t8122.h | 24 +++++++++++++++++++++++ drivers/pci/controller/pcie-apple.c | 22 +++++++++++++-------- tools/asahi/pcie-apple-msi-slice-tests.c | 23 ++++++++++++++++++++++ 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/pcie-apple-t8122.h b/drivers/pci/controller/pcie-apple-t8122.h index 2ac892d45f98..a93256b096e5 100644 --- a/drivers/pci/controller/pcie-apple-t8122.h +++ b/drivers/pci/controller/pcie-apple-t8122.h @@ -48,4 +48,28 @@ static inline int apple_pciec_msi_slice(bool has_base, unsigned int base, return 0; } +/* + * Locate the AIC IRQ cell in an msi-ranges interrupt specifier. Single-die + * AIC uses (3 cells, IRQ at index 1); multi-die AIC (such as + * T6031) uses (4 cells, die 0 only, IRQ at index 2). + * Returns the IRQ cell index, or -1 for any other specifier shape. + */ +static inline int apple_pciec_msi_irq_index(unsigned int args_count, + unsigned int arg0, + unsigned int arg1, + unsigned int arg2, + unsigned int arg3, + unsigned int expected_flags, + bool allow_multidie) +{ + if (arg0 != 0) + return -1; + if (args_count == 3 && arg2 == expected_flags) + return 1; + if (allow_multidie && args_count == 4 && arg1 == 0 && + arg3 == expected_flags) + return 2; + return -1; +} + #endif diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c index 5205407fd02c..abea0a81d908 100644 --- a/drivers/pci/controller/pcie-apple.c +++ b/drivers/pci/controller/pcie-apple.c @@ -3661,11 +3661,21 @@ static int apple_msi_init(struct apple_pcie *pcie) } else if (pcie->hw == &t8122_pciec_hw || pcie->hw == &t6040_pciec_hw) { struct resource ecam; u32 expected_base, aic_base; + int irq_idx; if (of_address_to_resource(to_of_node(fwnode), 0, &ecam)) goto invalid_slice; + irq_idx = apple_pciec_msi_irq_index(args.args_count, + args.args[0], args.args[1], + args.args[2], args.args[3], + IRQ_TYPE_EDGE_RISING, + pcie->hw == &t8122_pciec_hw); + if (irq_idx < 0) + goto invalid_slice; /* These ECAM apertures identify the ADT bridges of each SoC. */ if (of_machine_is_compatible("apple,t6030")) { + if (irq_idx != 1) + goto invalid_slice; aic_base = 1342; switch (ecam.start) { case 0x730000000ULL: @@ -3697,11 +3707,10 @@ static int apple_msi_init(struct apple_pcie *pcie) } } else if (pcie->hw == &t8122_pciec_hw) { /* The node names its slice; check its shape, not the board. */ - if (args.args_count != 3 || - of_property_read_u32(to_of_node(fwnode), + if (of_property_read_u32(to_of_node(fwnode), "apple,msi-vector-base", &expected_base)) goto invalid_slice; - ret = apple_t8122_msi_window(expected_base, args.args[1], + ret = apple_t8122_msi_window(expected_base, args.args[irq_idx], pcie->nvecs); if (ret < 0) goto invalid_slice; @@ -3714,11 +3723,8 @@ static int apple_msi_init(struct apple_pcie *pcie) } else { goto invalid_slice; } - if (args.args_count != 3 || args.args[0] != 0 || - args.args[2] != IRQ_TYPE_EDGE_RISING) - goto invalid_slice; { - u32 base = 0, irq = args.args[1], nvecs = pcie->nvecs; + u32 base = 0, irq = args.args[irq_idx], nvecs = pcie->nvecs; bool has_base = of_property_present(to_of_node(fwnode), "apple,msi-vector-base"); @@ -3740,7 +3746,7 @@ static int apple_msi_init(struct apple_pcie *pcie) irq); pcie->msi_vector_base = expected_base; pcie->nvecs = nvecs; - args.args[1] = irq; + args.args[irq_idx] = irq; } } diff --git a/tools/asahi/pcie-apple-msi-slice-tests.c b/tools/asahi/pcie-apple-msi-slice-tests.c index 815902440fe9..39ef6e4706ae 100644 --- a/tools/asahi/pcie-apple-msi-slice-tests.c +++ b/tools/asahi/pcie-apple-msi-slice-tests.c @@ -32,6 +32,29 @@ int main(void) /* T6040's per-slice shape still accepted. */ irq = 2103; n = 32; assert(apple_pciec_msi_slice(true, 32, 32, 2071, &irq, &n) == 0); + /* T6031 multi-die AIC (window 1854, slices 0x20/0x40/0x60) via generic window helper. */ + assert(apple_t8122_msi_window(32, 1886, 32) == 1854); + assert(apple_t8122_msi_window(64, 1918, 32) == 1854); + assert(apple_t8122_msi_window(96, 1950, 32) == 1854); + irq = 1886; n = 32; + assert(apple_pciec_msi_slice(true, 32, 32, 1854, &irq, &n) == 0 && irq == 1886); + irq = 1918; n = 32; + assert(apple_pciec_msi_slice(true, 64, 64, 1854, &irq, &n) == 0 && irq == 1918); + irq = 1950; n = 32; + assert(apple_pciec_msi_slice(true, 96, 96, 1854, &irq, &n) == 0 && irq == 1950); + /* Interrupt specifier parsing: 3-cell single-die and 4-cell die-0 only. */ + assert(apple_pciec_msi_irq_index(3, 0, 1374, 1, 0, 1, false) == 1); + assert(apple_pciec_msi_irq_index(3, 0, 1374, 1, 0, 1, true) == 1); + assert(apple_pciec_msi_irq_index(4, 0, 0, 1886, 1, 1, true) == 2); + /* Disallowed multi-die, non-zero die, wrong type/flags, or wrong cell count: refused. */ + assert(apple_pciec_msi_irq_index(4, 0, 0, 1886, 1, 1, false) < 0); + assert(apple_pciec_msi_irq_index(4, 0, 1, 1886, 1, 1, true) < 0); + assert(apple_pciec_msi_irq_index(4, 1, 0, 1886, 1, 1, true) < 0); + assert(apple_pciec_msi_irq_index(4, 0, 0, 1886, 4, 1, true) < 0); + assert(apple_pciec_msi_irq_index(3, 1, 1374, 1, 0, 1, true) < 0); + assert(apple_pciec_msi_irq_index(3, 0, 1374, 4, 0, 1, true) < 0); + assert(apple_pciec_msi_irq_index(2, 0, 1374, 1, 0, 1, true) < 0); + assert(apple_pciec_msi_irq_index(5, 0, 0, 1886, 1, 1, true) < 0); puts("pcie-apple-msi-slice-tests: OK"); return 0; } From 33a87e888ec34204579cbecf6c985bdc60621908 Mon Sep 17 00:00:00 2001 From: Will Bunting <18180928+wbunting@users.noreply.github.com> Date: Thu, 3 Dec 2026 08:59:30 +1000 Subject: [PATCH 2/2] arm64: dts: apple: t6031: add ATC0, ATC1, and ATC2 USB4 PCIe tunnels Describe the USB4 PCIe-C tunnel hosts, DARTs, and apple,pcie-tunnel links for ATC0, ATC1, and ATC2 in t6031-usb4.dtsi (modelled on t6030-usb4.dtsi) and include it from t6031.dtsi so all single-die T6031/T6034 M3 Max boards (J514C, J516C, J514M, J516M) inherit it while leaving multi-die T6032 (M3 Ultra) untouched. - All values come from the J516C ADT (apciec0..2, dart-apciec0..2, apciec0..2-piodma, acio0..2). Register windows sit at 0x7, 0xb, and 0xf with controller/DART interrupts 1347/1348, 1375/1376, and 1403/1404. - MSIs use the 32-vector slices at offsets 0x20 (1886), 0x40 (1918), and 0x60 (1950) of T6031's shared AIC 1854 window (internal apcie0 owns 0..31 in t6031-die0.dtsi). - Each ACIO gains its pcie-adapter window, ps_atcN_pcie power domain / post-init-provider, and apple,pcie-tunnel link; unlike T6030 there is no "cpu" window because T6031 ACIO uses the t8103 start sequence. - Remove the duplicate disabled pciec{0,1,2}_dart nodes from t6031-misc-interfaces.dtsi and repoint apciec{0,1,2}_piodma iommus in t6031-peripherals.dtsi to usb4_{0,1,2}_pcie_dart, matching t6030's tunnel layout. Tested on J516C (16" M3 Max) across all three USB-C ports with a Universal Audio Apollo Twin X (TB3) and a Ugreen TB5 dock (JHL9480, Intel I226-V 2.5GbE + NVMe): devices enumerate behind their tunnel bridges with working MSIs and zero DART/AER errors. Signed-off-by: Will Bunting <18180928+wbunting@users.noreply.github.com> Co-developed-by: Marcelo Alcantara Signed-off-by: Marcelo Alcantara --- .../boot/dts/apple/t6031-misc-interfaces.dtsi | 32 +- .../boot/dts/apple/t6031-peripherals.dtsi | 6 +- arch/arm64/boot/dts/apple/t6031-usb4.dtsi | 349 ++++++++++++++++++ arch/arm64/boot/dts/apple/t6031.dtsi | 2 + 4 files changed, 355 insertions(+), 34 deletions(-) create mode 100644 arch/arm64/boot/dts/apple/t6031-usb4.dtsi diff --git a/arch/arm64/boot/dts/apple/t6031-misc-interfaces.dtsi b/arch/arm64/boot/dts/apple/t6031-misc-interfaces.dtsi index 979232598017..6b404ad1a213 100644 --- a/arch/arm64/boot/dts/apple/t6031-misc-interfaces.dtsi +++ b/arch/arm64/boot/dts/apple/t6031-misc-interfaces.dtsi @@ -1,37 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ OR MIT -/* Disabled tunnel translation and miscellaneous interfaces. */ +/* Disabled miscellaneous interfaces. */ &soc { - pciec0_dart: iommu@721008000 { - compatible = "apple,t6031-dart", "apple,t8110-dart"; - reg = <0x7 0x21008000 0 0x4000>; - interrupt-parent = <&aic>; - interrupts = ; - #iommu-cells = <1>; - power-domains = <&ps_atc0_cio_pcie>; - status = "disabled"; - }; - - pciec1_dart: iommu@b21008000 { - compatible = "apple,t6031-dart", "apple,t8110-dart"; - reg = <0xb 0x21008000 0 0x4000>; - interrupt-parent = <&aic>; - interrupts = ; - #iommu-cells = <1>; - power-domains = <&ps_atc1_cio_pcie>; - status = "disabled"; - }; - - pciec2_dart: iommu@f21008000 { - compatible = "apple,t6031-dart", "apple,t8110-dart"; - reg = <0xf 0x21008000 0 0x4000>; - interrupt-parent = <&aic>; - interrupts = ; - #iommu-cells = <1>; - power-domains = <&ps_atc2_cio_pcie>; - status = "disabled"; - }; - atcphy0_xbar: mux@70304c000 { compatible = "apple,t6031-display-crossbar", "apple,t6020-display-crossbar"; diff --git a/arch/arm64/boot/dts/apple/t6031-peripherals.dtsi b/arch/arm64/boot/dts/apple/t6031-peripherals.dtsi index 35edfd26af5f..5d17f73b941d 100644 --- a/arch/arm64/boot/dts/apple/t6031-peripherals.dtsi +++ b/arch/arm64/boot/dts/apple/t6031-peripherals.dtsi @@ -232,7 +232,7 @@ <0x7 0x20008000 0x0 0x4000>; interrupt-parent = <&aic>; interrupts = ; - iommus = <&pciec0_dart 15>; + iommus = <&usb4_0_pcie_dart 15>; status = "disabled"; }; @@ -244,7 +244,7 @@ <0xb 0x20008000 0x0 0x4000>; interrupt-parent = <&aic>; interrupts = ; - iommus = <&pciec1_dart 15>; + iommus = <&usb4_1_pcie_dart 15>; status = "disabled"; }; @@ -256,7 +256,7 @@ <0xf 0x20008000 0x0 0x4000>; interrupt-parent = <&aic>; interrupts = ; - iommus = <&pciec2_dart 15>; + iommus = <&usb4_2_pcie_dart 15>; status = "disabled"; }; diff --git a/arch/arm64/boot/dts/apple/t6031-usb4.dtsi b/arch/arm64/boot/dts/apple/t6031-usb4.dtsi new file mode 100644 index 000000000000..6286534eadde --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6031-usb4.dtsi @@ -0,0 +1,349 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * T6031/T6034 (M3 Max) USB4 PCIe tunnels on ATC0, ATC1 and ATC2, modelled on + * t6030-usb4.dtsi. + * + * Every value is from the J516C ADT (/arm-io/apciecN, dart-apciecN, + * apciecN-piodma, acioN). The register windows and tunables match T6030. + * The AIC numbers differ, and T6031 uses the four-cell, die-numbered AIC + * specifier. MSIs come from the ADT's shared window at AIC 1854: the + * internal apcie0 owns its first 32 vectors (t6031-die0.dtsi) and the tunnel + * hosts take the next three 32-vector slices: ATC0 0x20 (1886), ATC1 0x40 + * (1918), ATC2 0x60 (1950). + * + * aura fills apple,tunable-{rc,fabric,debug} through the usb4-N-pcie alias, + * the root port's apple,tunable, and apple,tunable-pcie-adapter through + * usb4-N-pcie-adapter. No bootloader fills the DART and OE fabric tunables, + * so they are carried here. + */ + +/ { + aliases { + usb4-0-pcie = &usb4_0_pcie; + usb4-0-pcie-adapter = &usb4_0_acio; + usb4-1-pcie = &usb4_1_pcie; + usb4-1-pcie-adapter = &usb4_1_acio; + usb4-2-pcie = &usb4_2_pcie; + usb4-2-pcie-adapter = &usb4_2_acio; + }; +}; + +&usb4_0_acio { + /* + * ADT acioN reg[5] is the PCIe adapter window m1n1 tunes. Unlike + * T6030 there is no "cpu" window: the T6031 ACIO uses the t8103 + * start sequence. + */ + reg = <0x7 0x01ac0000 0x0 0xc000>, + <0x7 0x01080000 0x0 0x20000>, + <0x7 0x01e44000 0x0 0x4000>; + reg-names = "rc", "sram", "pcie-adapter"; + power-domains = <&ps_atc0_cio>, <&ps_atc0_cio_pcie>, + <&ps_atc0_cio_usb>, <&ps_atc0_pcie>; + post-init-providers = <&ps_atc0_cio>, <&ps_atc0_cio_pcie>, + <&ps_atc0_cio_usb>, <&ps_atc0_pcie>; + apple,pcie-tunnel = <&usb4_0_pcie_tunnel>; +}; + +&usb4_1_acio { + /* + * ADT acioN reg[5] is the PCIe adapter window m1n1 tunes. Unlike + * T6030 there is no "cpu" window: the T6031 ACIO uses the t8103 + * start sequence. + */ + reg = <0xb 0x01ac0000 0x0 0xc000>, + <0xb 0x01080000 0x0 0x20000>, + <0xb 0x01e44000 0x0 0x4000>; + reg-names = "rc", "sram", "pcie-adapter"; + power-domains = <&ps_atc1_cio>, <&ps_atc1_cio_pcie>, + <&ps_atc1_cio_usb>, <&ps_atc1_pcie>; + post-init-providers = <&ps_atc1_cio>, <&ps_atc1_cio_pcie>, + <&ps_atc1_cio_usb>, <&ps_atc1_pcie>; + apple,pcie-tunnel = <&usb4_1_pcie_tunnel>; +}; + +&usb4_2_acio { + /* + * ADT acioN reg[5] is the PCIe adapter window m1n1 tunes. Unlike + * T6030 there is no "cpu" window: the T6031 ACIO uses the t8103 + * start sequence. + */ + reg = <0xf 0x01ac0000 0x0 0xc000>, + <0xf 0x01080000 0x0 0x20000>, + <0xf 0x01e44000 0x0 0x4000>; + reg-names = "rc", "sram", "pcie-adapter"; + power-domains = <&ps_atc2_cio>, <&ps_atc2_cio_pcie>, + <&ps_atc2_cio_usb>, <&ps_atc2_pcie>; + post-init-providers = <&ps_atc2_cio>, <&ps_atc2_cio_pcie>, + <&ps_atc2_cio_usb>, <&ps_atc2_pcie>; + apple,pcie-tunnel = <&usb4_2_pcie_tunnel>; +}; + +/ { + usb4_0_pcie_tunnel: usb4-pcie-tunnel-0 { + #address-cells = <2>; + #size-cells = <2>; + ranges; + nonposted-mmio; + /* Preserve the SoC DMA window after moving the virtual container. */ + dma-ranges = <0 0 0 0 0xffffffff 0xffffc000>; + + usb4_0_pcie_dart: iommu@721008000 { + compatible = "apple,t6031-dart", "apple,t8110-dart"; + reg = <0x7 0x21008000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = ; + #iommu-cells = <1>; + power-domains = <&ps_atc0_cio_pcie>; + /* ADT dart-apciec0 dart-tunables-instance-0 */ + apple,tunable = + <0x20c 0x800001b7 0x800001b7>, + <0x220 0xf0f0f 0xf0f0f>, + <0x224 0xffffff 0x80808>, + <0x300 0x1f31 0x1>, + <0x308 0x3ffffffc 0x10000000>, + <0x310 0x3ffffffc 0x3ffffffc>, + <0x318 0x1f31 0x1>, + <0x320 0x3ffffffc 0x1f00000>, + <0x328 0x3ffffffc 0x1f0bffc>; + }; + + usb4_0_pcie: pcie@730000000 { + compatible = "apple,t8122-pciec", "apple,t8103-pciec"; + device_type = "pci"; + reg = <0x7 0x30000000 0x0 0x10000000>, + <0x7 0x20000000 0x0 0x4000>, + <0x7 0x21000000 0x0 0x8000>, + <0x7 0x20004000 0x0 0x4000>, + <0x7 0x20200000 0x0 0x4000>, + <0x7 0x21010000 0x0 0x4000>, + <0x7 0x20008000 0x0 0x4000>, + <0x7 0x2100c000 0x0 0x4000>; + reg-names = "config", "rc", "port0", "fabric", + "debug", "ltssm", "oe-fabric", "intr2axi"; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_atc0_cio_pcie>; + apple,pciec-kernel-init; + /* ADT apciec0-piodma atc-apcie-oe-fabric-tunables */ + apple,tunable-oe-fabric = + <0x4 0x70007 0x40004>, + <0x8 0x1 0x1>, + <0xc 0x1 0x1>, + <0x10 0x801f 0x4>, + <0x18 0x801f 0x4>, + <0x20 0x801f 0x4>; + msi-controller; + msi-parent = <&usb4_0_pcie>; + /* Its 32-vector slice of T6031's shared window (AIC 1854 + 32). */ + msi-ranges = <&aic AIC_IRQ 0 1886 IRQ_TYPE_EDGE_RISING 32>; + apple,msi-vector-base = <32>; + iommu-map = <0x0 &usb4_0_pcie_dart 0x0 0x40>; + iommu-map-mask = <0x3f>; + bus-range = <0x0 0x7f>; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x43000000 0x8 0x0 + 0x8 0x0 0x2 0x0>, + <0x02000000 0x0 0x100000 + 0xa 0x100000 0x0 0x3ff00000>, + <0x42000000 0x0 0x40000000 + 0xa 0x40000000 0x0 0x40000000>; + + usb4_0_pcie_port: pci@0,0 { + device_type = "pci"; + reg = <0x0 0x0 0x0 0x0 0x0>; + external-facing; + /* apple,tunable is filled by the bootloader */ + #address-cells = <3>; + #size-cells = <2>; + ranges; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &usb4_0_pcie_port 0 0 0 0>, + <0 0 0 2 &usb4_0_pcie_port 0 0 0 1>, + <0 0 0 3 &usb4_0_pcie_port 0 0 0 2>, + <0 0 0 4 &usb4_0_pcie_port 0 0 0 3>; + }; + }; + }; + + usb4_1_pcie_tunnel: usb4-pcie-tunnel-1 { + #address-cells = <2>; + #size-cells = <2>; + ranges; + nonposted-mmio; + /* Preserve the SoC DMA window after moving the virtual container. */ + dma-ranges = <0 0 0 0 0xffffffff 0xffffc000>; + + usb4_1_pcie_dart: iommu@b21008000 { + compatible = "apple,t6031-dart", "apple,t8110-dart"; + reg = <0xb 0x21008000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = ; + #iommu-cells = <1>; + power-domains = <&ps_atc1_cio_pcie>; + /* ADT dart-apciec1 dart-tunables-instance-0 */ + apple,tunable = + <0x20c 0x800001b7 0x800001b7>, + <0x220 0xf0f0f 0xf0f0f>, + <0x224 0xffffff 0x80808>, + <0x300 0x1f31 0x1>, + <0x308 0x3ffffffc 0x10000000>, + <0x310 0x3ffffffc 0x3ffffffc>, + <0x318 0x1f31 0x1>, + <0x320 0x3ffffffc 0x1f00000>, + <0x328 0x3ffffffc 0x1f0bffc>; + }; + + usb4_1_pcie: pcie@b30000000 { + compatible = "apple,t8122-pciec", "apple,t8103-pciec"; + device_type = "pci"; + reg = <0xb 0x30000000 0x0 0x10000000>, + <0xb 0x20000000 0x0 0x4000>, + <0xb 0x21000000 0x0 0x8000>, + <0xb 0x20004000 0x0 0x4000>, + <0xb 0x20200000 0x0 0x4000>, + <0xb 0x21010000 0x0 0x4000>, + <0xb 0x20008000 0x0 0x4000>, + <0xb 0x2100c000 0x0 0x4000>; + reg-names = "config", "rc", "port0", "fabric", + "debug", "ltssm", "oe-fabric", "intr2axi"; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_atc1_cio_pcie>; + apple,pciec-kernel-init; + /* ADT apciec1-piodma atc-apcie-oe-fabric-tunables */ + apple,tunable-oe-fabric = + <0x4 0x70007 0x40004>, + <0x8 0x1 0x1>, + <0xc 0x1 0x1>, + <0x10 0x801f 0x4>, + <0x18 0x801f 0x4>, + <0x20 0x801f 0x4>; + msi-controller; + msi-parent = <&usb4_1_pcie>; + /* Its 32-vector slice of T6031's shared window (AIC 1854 + 64). */ + msi-ranges = <&aic AIC_IRQ 0 1918 IRQ_TYPE_EDGE_RISING 32>; + apple,msi-vector-base = <64>; + iommu-map = <0x0 &usb4_1_pcie_dart 0x0 0x40>; + iommu-map-mask = <0x3f>; + bus-range = <0x0 0x7f>; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x43000000 0xc 0x0 + 0xc 0x0 0x2 0x0>, + <0x02000000 0x0 0x100000 + 0xe 0x100000 0x0 0x3ff00000>, + <0x42000000 0x0 0x40000000 + 0xe 0x40000000 0x0 0x40000000>; + + usb4_1_pcie_port: pci@0,0 { + device_type = "pci"; + reg = <0x0 0x0 0x0 0x0 0x0>; + external-facing; + /* apple,tunable is filled by the bootloader */ + #address-cells = <3>; + #size-cells = <2>; + ranges; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &usb4_1_pcie_port 0 0 0 0>, + <0 0 0 2 &usb4_1_pcie_port 0 0 0 1>, + <0 0 0 3 &usb4_1_pcie_port 0 0 0 2>, + <0 0 0 4 &usb4_1_pcie_port 0 0 0 3>; + }; + }; + }; + + usb4_2_pcie_tunnel: usb4-pcie-tunnel-2 { + #address-cells = <2>; + #size-cells = <2>; + ranges; + nonposted-mmio; + /* Preserve the SoC DMA window after moving the virtual container. */ + dma-ranges = <0 0 0 0 0xffffffff 0xffffc000>; + + usb4_2_pcie_dart: iommu@f21008000 { + compatible = "apple,t6031-dart", "apple,t8110-dart"; + reg = <0xf 0x21008000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = ; + #iommu-cells = <1>; + power-domains = <&ps_atc2_cio_pcie>; + /* ADT dart-apciec2 dart-tunables-instance-0 */ + apple,tunable = + <0x20c 0x800001b7 0x800001b7>, + <0x220 0xf0f0f 0xf0f0f>, + <0x224 0xffffff 0x80808>, + <0x300 0x1f31 0x1>, + <0x308 0x3ffffffc 0x10000000>, + <0x310 0x3ffffffc 0x3ffffffc>, + <0x318 0x1f31 0x1>, + <0x320 0x3ffffffc 0x1f00000>, + <0x328 0x3ffffffc 0x1f0bffc>; + }; + + usb4_2_pcie: pcie@f30000000 { + compatible = "apple,t8122-pciec", "apple,t8103-pciec"; + device_type = "pci"; + reg = <0xf 0x30000000 0x0 0x10000000>, + <0xf 0x20000000 0x0 0x4000>, + <0xf 0x21000000 0x0 0x8000>, + <0xf 0x20004000 0x0 0x4000>, + <0xf 0x20200000 0x0 0x4000>, + <0xf 0x21010000 0x0 0x4000>, + <0xf 0x20008000 0x0 0x4000>, + <0xf 0x2100c000 0x0 0x4000>; + reg-names = "config", "rc", "port0", "fabric", + "debug", "ltssm", "oe-fabric", "intr2axi"; + interrupt-parent = <&aic>; + interrupts = ; + power-domains = <&ps_atc2_cio_pcie>; + apple,pciec-kernel-init; + /* ADT apciec2-piodma atc-apcie-oe-fabric-tunables */ + apple,tunable-oe-fabric = + <0x4 0x70007 0x40004>, + <0x8 0x1 0x1>, + <0xc 0x1 0x1>, + <0x10 0x801f 0x4>, + <0x18 0x801f 0x4>, + <0x20 0x801f 0x4>; + msi-controller; + msi-parent = <&usb4_2_pcie>; + /* Its 32-vector slice of T6031's shared window (AIC 1854 + 96). */ + msi-ranges = <&aic AIC_IRQ 0 1950 IRQ_TYPE_EDGE_RISING 32>; + apple,msi-vector-base = <96>; + iommu-map = <0x0 &usb4_2_pcie_dart 0x0 0x40>; + iommu-map-mask = <0x3f>; + bus-range = <0x0 0x7f>; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x43000000 0x10 0x0 + 0x10 0x0 0x2 0x0>, + <0x02000000 0x0 0x100000 + 0x12 0x100000 0x0 0x3ff00000>, + <0x42000000 0x0 0x40000000 + 0x12 0x40000000 0x0 0x40000000>; + + usb4_2_pcie_port: pci@0,0 { + device_type = "pci"; + reg = <0x0 0x0 0x0 0x0 0x0>; + external-facing; + /* apple,tunable is filled by the bootloader */ + #address-cells = <3>; + #size-cells = <2>; + ranges; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &usb4_2_pcie_port 0 0 0 0>, + <0 0 0 2 &usb4_2_pcie_port 0 0 0 1>, + <0 0 0 3 &usb4_2_pcie_port 0 0 0 2>, + <0 0 0 4 &usb4_2_pcie_port 0 0 0 3>; + }; + }; + }; +}; diff --git a/arch/arm64/boot/dts/apple/t6031.dtsi b/arch/arm64/boot/dts/apple/t6031.dtsi index 0aa4fd81f998..073ba34be932 100644 --- a/arch/arm64/boot/dts/apple/t6031.dtsi +++ b/arch/arm64/boot/dts/apple/t6031.dtsi @@ -59,6 +59,8 @@ #include "t6031-misc-interfaces.dtsi" +#include "t6031-usb4.dtsi" + &smc_hwmon { /* M3 Max die keys; absent firmware keys are skipped. */ apple,soc-die-keys = "Tf04", "Tf06", "Tf09", "Tf0A", "Tf0B",