Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions arch/arm64/boot/dts/apple/t6040-j614s.dts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
};

&usb4_0_acio {
/delete-property/ apple,pcie-tunnel;
status = "okay";
};

Expand Down Expand Up @@ -167,7 +166,6 @@
};

&usb4_1_acio {
/delete-property/ apple,pcie-tunnel;
status = "okay";
};

Expand Down Expand Up @@ -203,7 +201,6 @@
};

&usb4_2_acio {
/delete-property/ apple,pcie-tunnel;
status = "okay";
};

Expand All @@ -218,4 +215,42 @@
status = "okay";
};

/* PCIe-C (tunneled PCIe) on all three Thunderbolt ports: t6040-pciec.dtsi */

&usb4_0_pcie_tunnel {
status = "okay";
};

&apciec0_dart {
status = "okay";
};

&usb4_0_pcie {
status = "okay";
};

&usb4_1_pcie_tunnel {
status = "okay";
};

&apciec1_dart {
status = "okay";
};

&usb4_1_pcie {
status = "okay";
};

&usb4_2_pcie_tunnel {
status = "okay";
};

&apciec2_dart {
status = "okay";
};

&usb4_2_pcie {
status = "okay";
};

#include "t6040-j614s-extdisp-hdmi.dtsi"
89 changes: 89 additions & 0 deletions arch/arm64/boot/dts/apple/t6040-pciec.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
* T6040 PCIe-C (tunneled PCIe) on the three Thunderbolt ports, e.g. a
* Studio Display's xHCI. No boot loader hands the ports over: the kernel
* cold-initializes them. Boards enable the tunnel, DART and controller of
* each port they wire up.
*
* From the ADT (macOS 26 IODeviceTree), identical for apciec0-2 and
* dart-apciec0-2 and between the J614s and J616s:
* - the DART's DMA window: vm-base 1 TiB + 2 GiB, vm-size 0x7ff00000, its
* first 16 KiB a dead mapping;
* - bypass-253 and bypass-255: the port's own writes (MSIs turned into AIC
* writes) use those reserved streams, which must bypass, as on T6050;
* - the DART tunables, the controller's debug, rc and fabric tunables and
* the port's config tunables.
* Full error reporting, CTC flush and the ATC PCIe power domain as on
* T6050's PCIe-C DART.
*/

#define T6040_PCIEC(n) \
&apciec##n##_dart { \
apple,dma-range = <0x100 0x80004000 0x0 0x7fefc000>; \
power-domains = <&ps_atc##n##_pcie>; \
apple,bypass-sids = <253 255>; \
apple,full-error-reporting; \
apple,ctc-flush; \
apple,tunable = <0x20c 0x80000121 0x80000121>, \
<0x220 0xf0f0f 0xf0f0f>, \
<0x224 0xffffff 0x80808>, \
<0x300 0x1f31 0x1>, \
<0x308 0x3ffffffc 0x10000000>, \
<0x310 0x3ffffffc 0x3ffffffc>; \
}; \
\
&usb4_##n##_pcie { \
apple,pciec-kernel-init; \
apple,tunable-debug = <0x1000 0x1 0x0>; \
apple,tunable-rc = <0x78 0x7000 0x0>, \
<0x718 0x7c000 0x0>, \
<0x814 0xffffffff 0x2000f060>, \
<0x8bc 0x1 0x0>; \
apple,tunable-fabric = <0x4 0x1f001f 0x100010>, \
<0x8 0x1 0x1>, \
<0xc 0x1 0x1>, \
<0x10 0x801f 0x4>, \
<0x18 0xff 0xe0>, \
<0x1c 0x1 0x1>, \
<0x20 0x801f 0x4>, \
<0x28 0x1f 0x10>, \
<0x2c 0x801f 0x4>, \
<0x34 0x3f 0x20>, \
<0x38 0x801f 0x4>, \
<0x40 0x3f 0x20>, \
<0x44 0x801f 0x4>, \
<0x4c 0x10001 0x10001>, \
<0x50 0x1 0x1>, \
<0x54 0x1 0x1>, \
<0x58 0x801f 0x4>, \
<0x60 0x7f007f 0x450045>, \
<0x64 0x801f 0x4>, \
<0x6c 0x1f001f 0x100010>, \
<0x70 0xf1 0x1>, \
<0x74 0x801f 0x4>, \
<0x7c 0x801f 0x4>, \
<0x84 0x1 0x1>, \
<0x88 0x1 0x1>, \
<0x8c 0x801f 0x4>, \
<0x94 0x1 0x1>, \
<0x98 0x801f 0x4>, \
<0xa0 0x1 0x1>, \
<0xa4 0x801f 0x4>, \
<0xac 0x1 0x1>, \
<0xb0 0x1 0x1>, \
<0xb4 0x801f 0x4>, \
<0xbc 0x801f 0x4>, \
<0xc4 0x801f 0x4>; \
}; \
\
&usb4_##n##_pcie_port { \
apple,tunable = <0x140 0x1 0x1>, \
<0x2a0 0x7e 0xa>, \
<0x1090 0x1 0x0>; \
};

T6040_PCIEC(0)
T6040_PCIEC(1)
T6040_PCIEC(2)

#undef T6040_PCIEC
1 change: 1 addition & 0 deletions arch/arm64/boot/dts/apple/t6040.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@
};

#include "t6040-usb4.dtsi"
#include "t6040-pciec.dtsi"

/*
* The SIO coprocessor is part of every T6040 and has no board wiring: iBoot
Expand Down
14 changes: 12 additions & 2 deletions drivers/pci/controller/pcie-apple.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,16 @@ static const struct hw_info t8132_pciec_hw = {
.s2idle_hold_domain = true,
};

/*
* T6040 PCIe-C is an Intr2AXI controller like T6050: the ADT
* (apciec,t6040) has no oe-fabric region, and its fabric/rc/debug/config and
* DART tunables are T6050's with small value differences. Cold init therefore
* takes the T6050 path (no port reset sequence, RID2SID cleared only).
* RID2SID slots are allocated as on T6050, not indexed by SID: with
* iommu-map-mask 0xff a device behind the tunnel (e.g. 03:00.0, the
* Studio Display's xHCI) shares SID 0 with 01:00.0, and an indexed slot
* then fails its enable with -EBUSY.
*/
static const struct hw_info t6040_pciec_hw = {
.port_msiaddr = PORT_MSIADDR,
.port_msiaddr_hi = PORT_MSIADDR + 4,
Expand All @@ -451,9 +461,9 @@ static const struct hw_info t6040_pciec_hw = {
.port_msimap = PORT_T602X_MSIMAP,
.port_tunctrl = 0x1088,
.max_rid2sid = 256,
.sid_indexed_rid2sid = true,
.tunneled = true,
.t8132_reset = true,
.tunnel_intr2axi = true,
.no_port_reset = true,
.msimap_by_vector = true,
.s2idle_hold_domain = true,
};
Expand Down
Loading