Skip to content

J873g: USB4 on the rear USB-C ports through tipd and atc.c (T8152 routers, PCIe-C, M6 Mac mini) - #2178

Open
sithglan wants to merge 31 commits into
aurora-silicon:mainfrom
sithglan:thomas/j873-usb4
Open

sithglan wants to merge 31 commits into
aurora-silicon:mainfrom
sithglan:thomas/j873-usb4

Conversation

@sithglan

@sithglan sithglan commented Nov 17, 2026 •

Copy link
Copy Markdown

USB4 on the three rear USB-C ports of the M6 Mac mini (J873g, T8152), through the Type-C stack. This is the last step of the order agreed above. tipd owns the PD controllers, atc.c runs the ports' ATC PHYs in CIO mode, and the routers start from the Type-C state, as on the J813 (#2142). There is no private port monitor any more.

Stacking. Stacked on #2486, which is on #1743 (#1797, #1800 and #2459 have merged), through a merge of integration/aurora 3cd5e0bb7671. It also carries these commits unchanged (same patches as the PRs' current heads):

Review the top 17 commits.

Needs aurora-silicon/aura#498. The J873g's USB4 and ATC PHY tunables and the routers' DROMs are no longer in the device tree: the bootloader copies them from the Mac's own ADT, as on the J813 (#2142 with aura#302/#435). With an older loader nothing is filled, and the drivers refuse the ports instead of running them untuned.

Carried from the earlier version, unchanged

  • Mailbox: each router's mailbox is "apple,t8152-cio-mailbox", "apple,t8152-smc-mailbox", with the two interrupts of its ADT acio-cpuN node.
  • CIO reset: T8152 (request 0x68, acknowledge 0x6c).
  • PCIe-C: T8152, with the MSI slice taken from the DT.
  • Routers: thunderbolt/apple T8152 support. The CIO power domains go through pmdomain: apple: T8152 PSD services as power domains #2459 and return to cold when unused.

Reworked

New

  • phy: apple: atc: run the T8152 Type-C ports in CIO mode
    • A T8152 PHY without apple,fixed-usb3 is a CIO-only Type-C port. It uses J873g: USB3 on the front ports (T8152 in the ATC PHY driver, M6 Mac mini) #1799's T8152 layout: power/reset block at 0x60000, sync reset at 0x60030, crossbar at 0x4c.
    • Both lanes are powered up. A reversed plug also sets the lane-swap bit.
    • Shutdown clamps AUX and drops the LFPS receivers, then releases the four power domains, so the next cable starts from a cold common block.
    • Thunderbolt partners are refused for now. Only USB4 has run on these routers.
  • DisplayPort and USB4 on one PHY
    • drm/apple's interim DP code powers the port's PHY through its DP PHY (phy_power_on/phy_power_off) instead of writing the PMGR/PSD registers itself, so genpd is the only power path.
    • While DP holds the PHY, a USB4 mux set returns -ETIMEDOUT, which tipd retries. While CIO runs, the DP power-on returns -EBUSY.
    • Both sides take the PHY only when it reads idle: 0x60000 = 0x4, sleep status 0 and sync reset 0.
    • This arbitration goes away once DP moves into atc.c.
  • thunderbolt: apple: stop the T8152 routers before a reboot: a running router is stopped before PCIe and DART shut down. The earlier port monitor showed this is needed.
  • DT:
    • the rear ports' ATC PHY nodes, with the ATC0/1/3 power states and PSD 55/56/58;
    • connector port@1 to the PHY's mux and switch, and port@4 to the router;
    • the router subtrees, identical to the hardware-tested ones apart from the graph links;
    • each router's NHI DART takes the router's first PSD service (59, 60, 62), for the DART power-domain lint. The router populates the DART only once it is powered and removes it before it powers down.
  • apple-t8152-port.c and its config line are removed.

Testing (M6, this tree)

The USB4 host-to-host and display rows, from one boot of this tree:

  • USB4: the back-middle port's partner is the upstream debug host (a Linux machine with USB4).
    • tipd entered USB4, atc.c brought the PHY up in CIO mode, and router ACIO0 started.
    • The router's firmware came up on its mailbox interrupts: 401178080.mailbox-recv counted 25 and -send 0.
    • The link trained (USB4, Gen 2, RS-FEC, both lanes in CL0), an Apple retimer was found, and the host-to-host link came up at 20 Gb/s on 2 lanes: "new host found … Linux mini".
  • Displays: all three come up, with the USB-C displays now powered through atc.c. 6 of 6 DPMS off/on cycles pass.
  • Other ports: the front hub enumerates at 10000M, and the two unused routers stay off.
  • Reboot: a reboot with the USB4 link up completes, through the new notifier.

Checks:

USB4 NVMe enclosure (Samsung 980 PRO in a Ugreen enclosure, back-right, this head):

  • Rows run: plugged at boot, 3 software replugs, a physical replug with the plug flipped (both orientations seen), DP and then USB4 again on the same port in one boot, and a reboot with the enclosure attached.
  • Every row: USB4 at 20 Gb/s on 2 lanes, PCIe at 16 GT/s x4, matching read checksums, 2911–3406 MiB/s sequential and 125k–141k IOPS random reads. The only errors were two reads in flight when the enclosure was pulled during a test.
  • Details are in the comment below.

Not covered: system sleep (the J873g has none), DP tunnelling over USB4 and two enclosures at once.

cc @Acelogic @RyanTheTide @DjDeveloperr @LiamRay10

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan
sithglan force-pushed the thomas/j873-usb4 branch 5 times, most recently from b8297ab to b43bc99 Compare November 18, 2026 11:13
@sithglan

Copy link
Copy Markdown
Author

Restacked on #2176 (ee608de). This series is unchanged.

@sithglan

Copy link
Copy Markdown
Author

Restacked on #2176 (e6186db). This series is unchanged.

@sithglan

Copy link
Copy Markdown
Author

Rebased onto the refreshed #2176 (6b1ffb1, on integration/aurora 0abc2f3). It is now 9a3c8b7 (was adcda13); the old branch no longer merged.

Testing on 0abc2f3:

@RyanTheTide

Copy link
Copy Markdown

Thanks for the USB4 bring-up; working on all three ports with hotplug is great.

In this tree we select behaviour by a hardware description, not by the machine or SoC it was tried on. A few new lines do the opposite:

  • drivers/pci/controller/pcie-apple.c:3464-3465: of_machine_is_compatible("apple,t8152") with a hardcoded aic_base = 1879, although the PCIe-C nodes already carry msi-ranges. Deriving the base from msi-ranges (or at least from the T8152 match data) would avoid another SoC branch.
  • drivers/iommu/apple-dart.c:6018 and drivers/soc/apple/mailbox.c:1609: cold Gen3 DART setup and the mailbox windows are admitted only on apple,j873g plus fixed addresses. The apple,t8152-*-dart compatibles and DT resources could select them.
  • drivers/thunderbolt/apple-t8152-port.c:381: a new driver polls the PD controllers that apple_dcpib also drives. One owner of the PD controllers, driven by their interrupt, would avoid two polling paths.

We are happy to help review a reworked version.

@sithglan

Copy link
Copy Markdown
Author

Restacked on the updated #2176 (6f320f0, two new commits for the apple,dcp-rtkit-running rename). It is now 756f397 (was 9a3c8b7); this series is unchanged (git range-diff). The review points above are still open.

@sithglan

Copy link
Copy Markdown
Author

Thanks. Two of the three points are done, and the stack is rebased onto the current #2176, #2139 and #2142 (head d134970ff6cf):

  • MSI base: t8152_pciec_hw now carries .msi_aic_base = 1879 and joins the T8132/T8142 branch of the slice check that Enable native rear-port USB4 and PCIe storage on J813 #2142 moved to match data. There's no apple,t8152 machine check any more. The third bridge (CIO3, ECAM 0x1c80000000, slice 0xc0) is accepted only for t8152_pciec_hw (628d76fcd352).
  • DART: the cold Gen3 admission no longer checks apple,j873g or any instance address. apple,t8152-acio-dart and apple,t8152-pciec-dart select the instances, and the remaining checks are on the hardware and DT: version 0x300, stream count, tunables, tunneled and the power domain for PCIe-C, and inactive streams. I also dropped the table that tied each DART address to its TLBI slot. Each DART now uses the slot its tlbi resource names, as the AVD and display DARTs do. I checked whether the slot could be derived from the hardware instead: the TLBI route register doesn't give it (on the running M6, the AVD's DART reads route 0 with its slot at 0x200000300) (1c007d73d332).
  • Mailbox: no driver change any more. The ADT gives each router coprocessor (acio-cpu0/1/3) an interrupt pair: [1660, 1659], [1731, 1730], [1873, 1872]. The SMC's own pair is [760, 759], listed send-empty first. So each mailbox is now "apple,t8152-cio-mailbox", "apple,t8152-smc-mailbox" with those interrupts, and the SMC mailbox's match data serves it, as for the ANS in Merge aurora-wip 210c8f6e into integration/aurora (J873g NVMe, 10GbE, power off, USB2, audio) #1797. The j873_windows profile and the polled-provider code are gone (9f169a9405f2, 24460eb53c66).
  • I also removed a macOS class name from the port monitor's header, the USB4 DT comment and the DT commit message.

Checks on this head:

This head has not run on the J873g yet. The routers now depend on the mailbox interrupts firing in that order, which the M6 run will confirm.

One owner of the PD controllers. I agree, and the tree already has the owner: tipd's SPMI transport (apple,sn201202x) drives the ACE3s on the J813, T6050, T6041 and T8140 machines. It uses their interrupts where the node describes them (T6041, T8140) and polls them otherwise (J813, T6050 today), with the usb-c-connector graph to the DWC3, the ATC PHY and the DCP. On the J873g, apple_dcpib/pd.c and this port monitor both talk to the ACE3s over raw SPMI, and both poll. So the clean shape is to bring the J873g onto that stack:

  1. T8152 in atc.c (your J873g: USB3 on the front ports (T8152 in the ATC PHY driver, M6 Mac mini) #1799 point), including CIO mode.
  2. The J873g ACE3s described as apple,sn201202x with their connector graphs and their interrupts. The ADT gives each hpmN (usbc,sn201202x,spmi) three, e.g. hpm0 [11, 17, 19], so these can be interrupt-driven, not polled.
  3. DP alt mode through the shared path in drm/apple (your J873g: HDMI and USB-C displays in drm/apple (iBoot interface, T8152 Gen3 display DARTs, M6 Mac mini) #1800 point).
  4. USB4 through tipd's Thunderbolt alt-mode handling into the router.

The port monitor and pd.c then go away. These are the #1799, #1800 and #2178 asks together, and each step needs M6 runs, so I'll take them in that order rather than patch the monitor in between. Does that ordering work for you?

@sithglan

Copy link
Copy Markdown
Author

Two changes since my last comment. The head is now ffa55796045f:

  • MSI slice from the DT only. After DjDeveloperr's review of Enable native rear-port USB4 and PCIe storage on J813 #2142, T8132 and T8142 no longer carry an AIC base in the match data. The slice is checked by its shape from msi-ranges and apple,msi-vector-base. T8152 uses the same branch, so the 1879 I mentioned above is gone too: the J873g's three nodes give 1975 − 96 = 2007 − 128 = 2071 − 192 = 1879.
  • CIO power domains now use the generic apple,t8152-psd provider from pmdomain: apple: T8152 PSD services as power domains #2459. This drops this PR's two commits that extended the AVD PSD variant with CIO services. They behave as before, off while unused, and they probe and read off on the J873g.

The stack is rebased onto the current #2176 and #2139 (with #1797's USB DART comment underneath). The tipd/ATC convergence for the port monitor follows.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026
The two front USB-C ports of the Mac mini (2026, J873g) sit behind an
on-board USB3 hub. The hub's SuperSpeed lanes are wired to the Type-C
PHY of the SoC's ATC2 directly, without a Type-C mux or port controller
in between, so that PHY only ever runs one fixed USB3 configuration.

Describe the T8152 variant in that role, with a boolean
apple,fixed-usb3 that marks such a port: the PHY runs USB3 on lane 0
from probe on, ignores mux and orientation changes and provides only
the USB3 PHY of its controller. The controller's USB2 side and reset
stay with the bootloader, so the T8152 PHY has no #reset-cells and no
Type-C switch properties.

The PHY is described by its core and pipehandler banks. On T8152 the
core bank also holds the USB controller's DARTs, and the PHY's power
and reset block sits behind them. It needs four power domains, listed
in the order they are powered up: the ATC's USB_AON power state, its
common PSD service and its COMMON_DP_0 and COMMON_DP_1 power states.
The other variants keep their single power domain and #reset-cells.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873g front ports reach their on-board USB3 hub through ATC2's
Type-C PHY, wired to the hub without a Type-C mux. So far the hub ran at
USB2 only: the bootloader leaves the PHY powered down and the PIPE on
the controller's dummy PHY. Support the T8152 PHY in that role in the
shared ATC driver.

T8152 shares the T8142 generation's power and reset block, tunables and
PIPE handler, with a different layout: the USB controller's DARTs sit
at 0x20000 and 0x40000 of the ATC window, so the power and reset block
follows at 0x60000, its lane swap is bit 1 there, and the reset the
power-up releases first is a separate always-on sync reset at 0x60030.
The crossbar is at 0x4c and the USB3 mode's existing setting, USB3+DP
with single PMA 0x008, gives the value 0x110; there is no lane mode
register to program. Describe this in the match data, with zero for the
layout of the other SoCs, and leave the power-up and power-down, the
tunables, the crossbar and the PIPE switch to the existing code.

What remains T8152 code:
 - Lane 0 is powered up on its own after the common-a tunables (LFPS
   receivers, sleep, clamp, AHB reset) and down again with the PHY.
   Without it the lane registers stay in AHB reset, drop the lane
   tunables and the PHY never reports PIPE PhyStatus. The crossbar is
   set right after, before the remaining tunables, as in the T8152
   sequence.
 - While the PIPE moves to the PHY, the BIST overrides hold lane 0's
   PIPE reset and power-down, stepping from P2 to P3, and the
   non-selected PHY override is released under them.

The T8152 PIPE handler takes the lock request but does not acknowledge
it: with the controller out of reset, no acknowledge came within 150 ms
in either direction, while the PIPE moved to USB3 and back to the dummy
PHY under the request. So T8152 changes the PIPE under the request
without waiting for the acknowledge; otherwise every USB3 start fails.

A fixed-USB3 port, apple,fixed-usb3, is a host by construction. Probe
maps only the core and PIPE windows, the core without claiming it as
it holds the DARTs, powers the PHY's power domains in the order they
are listed and brings the PHY up in USB3. It registers only the USB3
PHY: no reset controller, Type-C mux or switch, as the controller's
reset and USB2 side stay with the bootloader. The PIPE is routed when
the controller powers the USB3 PHY on, after its core reset, which also
sets the PHY up again after a power-off. If that fails the host starts
with its PIPE parked, so the hub keeps USB2.

The tunables come from the bootloader, which copies them from the Mac's
own ADT. A loader that copies none must not take USB2 away: the PHY's
consumers (the controller, and the display and Type-C drivers on the
rear ports) would wait for it forever. So T8152 has optional tunables:
the PHY probes without them, with common-a counted among the ones the
lanes need, and refuses every mode but USB2, before a register is
written. The hub then runs at USB2, as it did before this driver.

The T8152 register sequence is the one of the earlier standalone
driver, with which the hub enumerated at 10 Gb/s. The other SoCs keep
their register accesses: the new layout fields are zero for them, and
the new code runs for T8152 or a fixed-USB3 port only. KUnit cases
check the T8152 crossbar, lane and power block accesses, and that a
T8152 PHY without tunables refuses USB3, USB3+DP, USB4, Thunderbolt
and DisplayPort without writing a register.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The two front USB-C ports sit behind an on-board VL822 hub on usb-drd2.
The hub's USB2 side is on the controller's eUSB2 PHY, which the loader
sets up, and its USB3 side on ATC2's Type-C PHY, wired directly without
a Type-C mux. So far the controller was limited to high speed and the
hub ran at USB2 only.

Describe ATC2's PHY as an apple,t8152-atcphy with apple,fixed-usb3,
hand it to usb-drd2 as its USB3 PHY and drop the controller's high-speed
limit. Nothing changes for usb-drd1 (the back-left port).

The PHY's power domains are ATC2's USB_AON, COMMON_DP_0 and COMMON_DP_1
PMGR power states, in a new node for the ATCs' block of PMGR states at
0x308290000, and its common domain, PSD service 57 (ADT clock-gates
57). The T8152 USB3 bring-up runs the power states without automatic
power management, so they are marked apple,no-auto-pm.

The PHY's tunables are the groups of the ADT's atc-phy2 node that
apply to USB3 on lane 0: the common and PLL defaults as common-a, the
fabric, PLL and USBC0 groups as common-b and the lane 0 groups as
lane0-usb. Some of them differ between the four ATCs of the same Mac,
so they are calibration: the bootloader copies them from the Mac's own
ADT, through the atcphy2 alias (aurora-silicon/aura#498). With a loader
that copies none, the PHY runs USB2 only.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Allow the five ACIO register windows, LSTX GPIO and router firmware
tunables used by T8142. Describe its native PCIe-C compatible and
require the shared MSI vector base. Include the T8142 pinctrl fallback
chain used by the AOP LSTX pin.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
T8142 uses the Intr2AXI controller layout but its three-cell AIC
interrupt specifier and MSI window differ from T6050. Match it natively.
This allows a tunnelled NVMe controller to allocate working MSI-X
interrupts.

For T8132 and T8142 the slice is checked against the device tree alone.
msi-ranges names the AIC input of global vector apple,msi-vector-base in
a linear window, so the window's AIC base is msi-ranges minus
apple,msi-vector-base, and the slice is checked by its shape: an
edge-rising SPI, 32 vectors, 32-aligned, above the internal port's
vectors and inside the 8-bit map target. This replaces T8132's table of
ECAM apertures and its AIC base 1506 behind a machine check. The T8132
trees give 1602 - 0x60 = 1634 - 0x80 = 1506, and every J813 PCIe node
gives 1741.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Each T8152 USB4 router's coprocessor has a 0x80-byte mailbox window with
the counted FIFOs of the SMC mailbox, at offset 0x80 of its register
block. Describe it with apple,t8152-smc-mailbox as the fallback, so the
SMC mailbox's match data serves it, and with its send-empty and
recv-not-empty interrupts.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8152 CIO reset block resets the rear USB4 routers of the J873g.
It has a request and an acknowledge register instead of T8142's control
register, so it gets its own compatible.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8152 CIO reset block requests a router reset in register 0x68 and
acknowledges it in 0x6c. Wait for the router's pair of busy bits to
clear, request, wait for the acknowledgment and clear it.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The DARTs of the J873g rear USB4 routers (NHI streams) and of their
PCIe-C tunnels are Gen3 DARTs like the display ones, but start unlocked
with inactive streams. Each has its own slot in the shared TLB
invalidation aperture and its DMA window. Their tunables are the ADT's
(dart-acioN, dart-apciecN), which the bootloader copies into the node,
so the binding does not require them in a device tree.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The DARTs of the T8152 USB4 routers and their PCIe-C tunnels are Gen3
DARTs that, unlike the display ones, the bootloader leaves unlocked with
inactive streams, as it does the AVD instance. Extend the AVD instance's
cold Gen3 setup to them: version 0x300, their tunables and inactive
streams, then clear the streams, apply the tunables and invalidate
through the Gen3 TLBI aperture before translation is enabled. Domains
use the same two-level 16K tables inside a single 64 GiB DMA window.

The streams the operating system sets up now come from a mask per
instance:

- AVD DART (apple,t8152-avd-dart): streams 0-2, the decoder's, with its
  16 streams and its power domain checked as before. Its stream enable
  becomes a read-modify-write like the others', and other stream IDs
  are refused when a consumer attaches.
- ACIO DART (apple,t8152-acio-dart): 32 streams, NHI streams 0-11 and
  16-27.
- PCIe-C DART (apple,t8152-pciec-dart): translated streams 0-252, with
  253 and 255 in bypass for host transactions and MSI writes to the AIC
  (the ADT reserves them), firmware's stream 254 preserved, 16K pages,
  42-bit addresses; it must be tunnelled and have its power domain.
  Without the bypass on 255, NVMe completions were polled and the DART
  faulted at the AIC.

Each DART invalidates through the TLBI slot its "tlbi" resource names.
The slot has to be the port's own: with port 3's slot on port 1's DART,
reads returned wrong data with DART faults. The locked display DARTs
and all other Gen3 instances stay as they were.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The PCIe-C ports tunnelled through the J873g rear USB4 routers are laid
out like T8142's: Intr2AXI MSI slices, the T6050 tunnel controls, and no
port reset of their own.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8152 tunnelled PCIe-C ports use the T6050 tunnel controls with the
Intr2AXI MSI path, like T8142, and their MSI slices are checked the same
way: from msi-ranges and apple,msi-vector-base alone. The J873g's three
bridges use 0x60 (CIO0, ECAM 0x1c50000000), 0x80 (CIO1, 0x1c60000000)
and 0xc0 (CIO3, 0x1c80000000) of the window at AIC 1879.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Add the T8152 ACIO and NHI. The T8152 router CPU is started by a
reconfiguration request through its mailbox, so it has no cpu window.
A second range maps the shared Gen3 TLB invalidation aperture for the
router's DART.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8152 router is a Type 7 MXWrap-v2p3 that a reconfiguration request
starts through its counted mailbox. Its DP IN path is not qualified.
Release the CIO domains in reverse order and suspend each one
synchronously, because deleting the device link only queues an idle
request: the PHY reset and the next router start need them cold.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873g's three rear USB-C ports have T8152 ATC PHYs behind a Type-C
mux, with a USB4 router behind each. Linux runs them in CIO (USB4)
mode only for now: their DisplayPort alt mode is still driven by the
display controllers, and their USB2 side by the bootloader.

Allow a T8152 PHY without apple,fixed-usb3 for such a port: its core
bank alone (the power and reset block at 0x60000 is part of it, and
the display controllers map the same bank), the orientation and mode
switches with port@0 to the connector's SuperSpeed port, the ATC's
four power domains in power-up order, and the common and lane CIO
tunables. The display controller takes the PHY through its
DisplayPort PHY.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873g's three rear USB-C ports have T8152 ATC PHYs with a USB4
router behind each. Their DisplayPort alt mode is still programmed by
the display driver (drm/apple's T8152 code), and their USB2 side is the
bootloader's. Run such a PHY in CIO mode for a USB4 partner and leave it
to the display driver otherwise, as a Type-C port of its own kind
(cio_only, selected by the T8152 match data for a PHY without
apple,fixed-usb3). The Type-C port driver sets the mux before it starts
the router and after it stops it, as on T8142.

CIO mode uses the T8152 layout of the fixed-USB3 support: the power
and reset block at 0x60000 with the sync reset at 0x60030, the crossbar
at 0x4c (USB4 0, USB4 swapped 1), no lane mode register. It differs
from USB3 in that
both lanes are powered up, one after the other, between the common-a
tunables and the others (LFPS receivers 0x1e24 bits 12/16 and 14/18,
then the lane controls at 0x1e18 and 0x1e1c out of sleep, unclamped and
out of AHB reset), and in that a reversed plug sets the lane swap (bit 1
of 0x60008) next to the swapped crossbar, where T8142 leaves it clear.
On the way down AUX is clamped (0x1e24 bit 10, sleeps 6 and 8 cleared)
and both lanes' LFPS receivers are dropped before the lanes, as the
T8152 CIO shutdown does: these always-on controls keep their state
while the common block is off. The lanes are only touched while the
register bus (0x60000 bit 3) is out of reset. This is the sequence the
earlier port monitor ran, with which a rear port trained USB4 at
2 x 20 Gb/s and carried an NVMe enclosure at 16 GT/s x4.

The PHY's four power domains (USB_AON, the common PSD service, DP_0,
DP_1) are attached without device links. They are held while the PHY
runs CIO mode, and dropped synchronously after the CIO shutdown, so
that the common block goes cold before the next partner: a training
from a powered common block asserted in the router's firmware.

The PHY and the display driver take turns, explicitly:

- The display driver powers the PHY's DP PHY on before it touches the
  PHY and off when it has let go of it. The DP PHY holds the domains for
  it and keeps CIO mode out: a USB4 mode change fails with -ETIMEDOUT,
  and the mux declares its timeouts transient, so the port driver
  retries until the display is gone. A DP PHY power-on in CIO mode
  fails with -EBUSY.
- Either takes the PHY only when its power and reset block is as its
  power-up leaves it (0x60000 = 0x4, no sleep acknowledged, sync reset
  0); CIO mode is refused otherwise.
- A display the bootloader started has all four domains on and a busy
  block at probe. Its domains are then held for the display driver,
  which takes the PHY over, until its DP PHY goes off.

Once DisplayPort moves into this driver, the DP PHY programs it itself,
both modes switch under the PHY's lock and this arbitration goes away.

Thunderbolt alt mode is refused on these ports for now: the T8152
routers have only been run with USB4 partners. The other SoCs are
unchanged: the new paths are taken for a cio_only PHY or the T8152
generation only, and T8152 now sets has_usb4, which a fixed-USB3 port's
tunable list does not consult. KUnit cases check the CIO lanes,
crossbar and swap in both orientations, the power-down, the idle test
and which Type-C states ask for CIO. The DCP host-test fixtures that
compile the power-up and power-down get the new field.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
A rear USB-C port's ATC PHY is also its USB4 PHY, run by the ATC PHY
driver, which powers the PHY. Give each usb-c port node the port's PHY
in DisplayPort use (PHY_TYPE_DP): a DCP powers it while it drives the
PHY, from before a cold start until the PHY is powered down, and the
PHY driver keeps the PHY powered and out of USB4 meanwhile.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8152 DCPs powered a rear USB-C port's ATC PHY themselves: before
a cold start they set the port's USB_AON, DP_0 and DP_1 PMGR power
states (PS +0x100, +0, +0x20) to 0xf and its common PSD service to 0,
and after a power-down they set back those that had been off. The same
PHY now runs CIO mode for USB4, through the ATC PHY driver, which
powers it through the PMGR and PSD power domain drivers. With two
writers of the same states, one would switch off what the other uses,
or leave the power domain drivers believing a domain on that is off.

Take the PHY through the port's DP PHY instead (the usb-c node's phys):
power it on before the cold start's first PHY access and off once the
PHY is powered down. The PHY driver then holds the PHY's power domains
and keeps it out of USB4; while the PHY runs USB4 the power-on fails
with -EBUSY and the cold start with it. A display the bootloader left
running is kept powered by the PHY driver from its probe; the DCP that
adopts it powers the DP PHY on at once and so takes that over. A port
whose common block runs but whose DP PHY cannot be powered is in USB4,
not a bootloader display: the power and reset block (CFG +0x60000)
reads 0x1b in both. The PMGR and PSD state registers are still read to
tell whether the PHY can be looked at.

The DisplayPort programming itself is unchanged.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The three rear USB-C ports' ATC PHYs (ADT atc-phy0, 1 and 3) were only
known to the display controllers, as register windows they program and
power themselves. Describe them as T8152 Type-C PHYs, which the ATC PHY
driver runs in CIO mode for USB4:

- their core windows (0x403000000, 0x40b000000, 0x413000000, 0x84000
  each, also mapped by the display controllers);
- the orientation and mode switches, linked to the SuperSpeed port
  (port@1) of the port's usb-c-connector;
- their power domains, in power-up order: the ATC's USB_AON, its common
  PSD service (55, 56, 58) and its COMMON_DP_0/1 power states, new
  nodes next to ATC2's. The USB_AON states are kept on, as ATC2's: they
  hold the rear USB controllers' state the loader set up;
- the atcphy0, 1 and 3 aliases, through which the bootloader copies
  each PHY's CIO tunables from the Mac's own ADT (atc-phyN groups,
  aurora-silicon/aura#498): the common defaults before the lanes are
  powered up, the fabric, PLL and remaining common groups after them,
  then each lane's groups. Without them the PHY runs no CIO mode.

The display controllers' usb-c port nodes take the PHYs through their
DP PHY, which powers them while a controller drives the port.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
A reboot or power-off shuts the PCIe-C host and the router's and the
tunnel's DARTs down before the router, while a started router still
runs over them. With the J873g's rear ports, the earlier port monitor
stopped the routers from a reboot notifier for this. Without a port
monitor, do that in the router driver: for routers whose match data
asks for it (T8152), stop a started router from a reboot notifier, as
the port driver does for an unplugged cable, and refuse a new start
from then on.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Describe the three rear USB4 routers (ADT acio0, acio1, acio3) with
their mailboxes, NHI, ACIO DARTs, PCIe-C tunnels and their DARTs, the
CIO reset block, the PSD services they need and the LSTX pins.
Generated from the J873g ADT. The router, NHI, DART and PCIe-C
tunables and the routers' DROMs are not in the device tree: they are
per Mac (a DROM carries the host router's UID), so the bootloader
copies them from the Mac's own ADT (aurora-silicon/aura#498), through
the usb4-N-acio, -pcie-adapter, -nhi and -pcie aliases (ADT acio0, 1
and 3, apciecN), and the DARTs' by their address. With a loader that
copies none, the routers, NHIs and PCIe-C ports refuse to start.

Each router coprocessor's mailbox has apple,t8152-smc-mailbox as its
fallback and the two interrupts of the ADT's acio-cpuN node, which list
send-empty first, as the SMC mailbox's do.

Each router's Thunderbolt switch (its port@1) is linked to the USB4
port (port@4) of its port's usb-c-connector, as on the J813: the PD
controller driver sets the port's ATC PHY to CIO mode and then starts
the router with the cable's EUDO and orientation, and stops the router
before it takes the PHY out of CIO mode.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Every enabled DART must name the power state of the engine it serves
(scripts/dtc/apple-dart-pd-check.py). The three rear routers' NHI DARTs
named none.

A DART sits inside its router, so it takes the router's first PSD
service (59, 60 and 62: ADT acioN power-gates), the one the router
powers up first and down last. The router populates the DART only once
it is powered and its firmware is ready, and removes it before it
powers down, so the DART's vote never holds the router on after a stop.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan

sithglan commented Nov 24, 2026 •

Copy link
Copy Markdown
Author

@DjDeveloperr thanks. The head is 1b969ed3f444: points 2 and 3 are done, and 1 and 4 are below.

2. No tables in history. The table removal is folded into the commits that added the tables, and the separate removal commit is gone.

3. Older aura: the ATC PHYs no longer fail their probe. This is in #1799's "phy: apple: atc: add T8152 for a fixed-USB3 port".

  • T8152 gets optional_tunables, with common-a counted among the lane tunables. Without the loader's tables the PHY probes and refuses every mode but USB2, before a register is written. So dwc3, tipd and the display path have nothing to wait for.
  • New KUnit case atcphy_test_t8152_no_tunables: USB3, USB3+DP, USB4, TBT and DP are all refused with no register write. A mutant without the gate fails it.
  • The phy-apple-atc* suites pass 47/47 in arm64 QEMU.

J873g rows on this exact head, with the M6's default command line:

aura#498 (1.0.0b15-g46c6d9b4, one-shot trial) enrolled aura (1.0.0b14-gd7f5a487, copies no tables)
ATC PHYs 4/4 bound with the ADT's tables 4/4 bound, each "SuperSpeed tunables missing, USB2 only"
Routers 3/3 bound; USB4 with the mini at 20 Gb/s x2 0/3: "Missing bootloader RC tuning" (-EINVAL), as designed
Front ports hub at 10000M, keyboard keyboard on the USB2 hub, no USB3
tipd / displays 3 ports / HDMI up 3 ports / HDMI up
Deferred devices none none
Live DT against the old in-tree DTB 48/48 properties (45 identical, 3 DROMs UID+CRC8) no tables
Counts 0 failed units, 0 AVC (SELinux disabled), 0 DART faults, no kernel error lines beyond the base 0 failed units, 0 DART faults; new lines are only the refusals (Missing bootloader RC tuning, its probe failure, and "CIO mode failed: -95" when tipd asked for CIO on the tether's port)

4.

  • dt-checks against da3173dfb4c9: 0 new warnings on 138 DTBs, and the bindings pass (CI follows).
  • Still owed: the USB4 NVMe tunnel rows (replug, flip, checksums), the DisplayPort/USB4 switch row, and the M1-M5 regression row. They need the enclosure, a USB-C monitor and the J813 tether moved, and nobody is at the Macs today.

1. The stack is unchanged: it waits for #1743, #2486, #1799 and #2142.

Assisted-by: LLM (Claude:Opus 5.5)

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at 1b969ed3: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes no requested by DjDeveloperr
Hardware row at head no no line with the head SHA 1b969ed3, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:bringup, area:display, area:gpu, area:platform, area:usb

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at 1b969ed3f444

Blockers:

  • §4 PR body attribution (PR body): Delete the trailing attribution line at the bottom of the PR description (also flagged by pr-text). All 31 commits themselves are clean (human author/committer and human Signed-off-by: only).
  • Unmerged multi-PR stack, merge commit & aura#498 dependency (50d8d75faa47..3287c55d219c, merge dafefeb2ba1e): Still bundles 31 commits across four open PRs (#1743 draft, #2486 draft, #1799 open, 2 commits from #2142 open) plus mid-branch merge commit dafefeb2ba1e, and requires aurora-silicon/aura#498 (open) for J873g tunables/DROMs. Land the prerequisite PRs and aura#498 first, then rebase #2178 linearly onto main with only its own commits.
  • §5 PR body template & remaining hardware rows (PR body): Add the required Tested: (Macs at head SHA + result) and Risk: (one-way/two-way door + affected Macs) lines to the PR body, and post the remaining exact-head J873g USB4 NVMe PCIe-tunnel (replug, flip, checksums) and DP/USB4 switch rows plus a non-T8152 (M1–M5) USB4 regression row covering the shared atc.c, apple-dart.c, pcie-apple.c, and thunderbolt/apple.c changes once rebased.

Checked:

  • Verified both code/history blockers from da3173dfb4c9 are resolved: all 31 commits and the full 38-file diff carry zero in-tree Apple ADT tunable tables or literal DROM blobs, and drivers/phy/apple/atc.c (optional_tunables + atcphy_configure() gate + atcphy_test_t8152_no_tunables in drivers/phy/apple/atc-test.c) now degrades safely to USB2-only without probe deferral on older aura.
  • Checked §1–§6 across commits, full diff, PR title/body, live 12/12 CI checks, aurora-silicon/aura#498, #1743, #2486, #1799, #2142, and the 1b969ed3f444 J873g dual-bootloader hardware rows.
Evidence
  • Head & CI: 1b969ed3f4446d2762f8e7ebae7b63948c3088f8 (OPEN, MERGEABLE, BLOCKED); all 12/12 checks green (dt-checks, host-tests, kunit x3, source, rust-build, DWC3/ATC x3, pr-text, pr-readiness). pr-text emitted warnings for the missing Tested:/Risk: lines and the trailing attribution line in the PR body.
  • Resolved — §4 Clean-room in history: Scanned all 31 commits and the final diff. Tunable removal is folded into cc129b6f0f7c, c61cdee06824, and e251b2ceb140, and the example tunable lines are removed from Documentation/devicetree/bindings/phy/apple,atcphy.yaml (b620188b20ae, 8148fc35b924). Only [00] DROM placeholders and bootloader aliases (atcphy{0..3}, usb4-{0,1,3}-*) remain.
  • Resolved — §1 Older-aura fallback (drivers/phy/apple/atc.c:4473-4475,7007-7009,8714, drivers/phy/apple/atc-test.c:1557-1576): atcphy_hw_t8152 sets .optional_tunables = true, counts apple,tunable-common-a toward ss_missing on ATCPHY_GENERATION_T8152, and refuses non-OFF/USB2 modes with -EOPNOTSUPP before touching registers. Confirmed on J873g at 1b969ed3f444 with enrolled aura (1.0.0b14-gd7f5a487): 4/4 PHYs bind in USB2-only mode, front USB2 hub/keyboard and 3/3 tipd ports + HDMI work, 0/3 routers bind (-EINVAL), 0 deferred devices, 0 failed units, 0 DART faults. (Non-blocking nit: checking !atcphy->ss_tunables at the top of atcphy_cio_start() in drivers/phy/apple/atc.c:5617 before atcphy_cio_pds_on() would avoid power-cycling the four domains and logging CIO mode failed: -95 on an older bootloader.)
  • Dependencies: aurora-silicon/aura#498 (46c6d9b47308, OPEN), aurora-silicon/linux#1743 (3aa7b99a6fe4, OPEN draft), #2486 (f9ad98d1d5d6, OPEN draft), #1799 (cc820203214e, OPEN), #2142 (a42e7dccf46c, OPEN).
  • §6 Naming: Clean across all commits, PR title/body, and diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bringup Area from CODEOWNERS (bot) area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) ci-failing A check failed at the PR head (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants