Repository navigation
J773g: run the front USB-C ports' SuperSpeed half (fixed ATC2 lanes) - #2683
DjDeveloperr wants to merge 5 commits into
Conversation
On the Mac mini (M4), the SuperSpeed lanes of ATC2's PHY go to the on-board hub behind the front USB-C ports instead of to a connector, and no port controller selects a mode for them. Apple's device tree gives that PHY two properties the Type-C PHYs don't have, atc-lane-config <2 0> and atc-plug-orientation 1, and macOS 27.2 runs the lanes from them by itself: USB3 on lane 0, unswapped, next to an idle DisplayPort lane, as an MMIO trace of macOS on that machine shows. Describe the two values as apple,lane-config and apple,plug-orientation, for T8132 only, each requiring the other. Only the values of that trace are allowed. Signed-off-by: Diljit Singh <hey@djdev.me>
A T8132 PHY with apple,lane-config serves a fixed hub whose SuperSpeed half is wired to the PHY's lanes, with no Type-C mux to ask for USB3. The PHY enters USB3 only from such a mux today, so that half never links and the Mac mini's front ports run at high speed. Bring the lanes up as macOS 27.2 does on the Mac mini's front ports, from an MMIO trace of macOS on that machine: - At probe, with the controller held in reset, the PHY takes the lane configuration <2 0>: USB3 on lane 0 next to a DisplayPort lane (lane mode 0x489, crossbar 0x110, no lane swap), with the AUX calibration and the common block's start (CFG0, BGBIAS, the RCAL poll). That is this driver's USB3 and DisplayPort epoch without DP AUX or a link. - Before the reset is released, the PIPE moves to the USB3 PHY with only the receiver-valid override, and without the PIPE lock, which nothing could acknowledge with the controller in reset. The host BIST is the T8132 one, but its second transition is waited out until STATUS2 bit 7 has cleared next to bit 6 (0xc4, 0xc4, then 0x44), and the native PHY leaves reset with power-down 3 in one write (0x1332 to 0x333). The mux then goes to USB3 and the override comes off; the clamp and the reset are released after that. - The dummy PHY beside it is enabled once the host is set up, before xHCI runs (0x333 to 0x8333), not at probe. The lanes come back the same way when the host's power-off took them down. A handover that fails starts the host on USB2 alone, as for any fixed-hub port, and lanes that cannot start without being touched leave the port on USB2 at probe. Without the property nothing changes: the Type-C ports, the J700's fixed hub and the other generations keep their paths. The host models run the extracted handover against the T8132 MMIO model write for write as in the trace, with negative controls for the bit 6 phase 2 completion and for a PIPE lock, and check the order around the reset release and the dummy PHY in the PIPE handler harness. Signed-off-by: Diljit Singh <hey@djdev.me>
The front USB-C ports' hub has a SuperSpeed half (05ac:800c) on ATC2's SuperSpeed root port next to its USB2 half (05ac:800b), and macOS 27.2 links it at 10 Gb/s on this machine (from an MMIO trace: speed 5 in that root port's PORTSC, with the controller's Gen1 force left clear). Give ATC2's PHY the lane configuration and plug orientation of the ADT's atc-phy2, give the controller its USB3 PHY and SuperSpeed Plus, and describe the hub's SuperSpeed half on raw port 2. The hub's GPIOs stay as they are. Signed-off-by: Diljit Singh <hey@djdev.me>
|
An early read. Selecting this by the two ADT-derived properties, with the binding allowing only the traced values and each one requiring the other, is the right shape: the Type-C ports and the J700's fixed hub can't take the new path by accident. It's also good to see the traced sequence written with named values in The main open question is sleep. The new path runs the lanes from probe on, and I don't see a suspend/resume hook for it in the diff. If ATC2's domains lose power across a deep sleep (or s2idle drops them, as on T6050 in #2664), the hub's SuperSpeed half would come back without the PHY sequence, and only its USB2 half would reconnect. Either repeat steps 2–7 on resume for a fixed-lane PHY, or keep its domains on across the sleep. A row with the front-port hub's SuperSpeed device listed before and after one sleep would show which is needed. Minor: Assisted-by: LLM (Claude:Opus 5.5) |
|
J773g (M4 Mac mini, macOS 27.2 firmware 26B123) row for this PR: the clean-room front-USB3 kit 8e13c8c
usb 1-1: New USB device found, idVendor=05ac, idProduct=800b, bcdDevice=56.15 |
State explicitly that apple,plug-orientation value 1 corresponds to the normal (unswapped) orientation in Apple's device tree, with USB3 on lane 0. Signed-off-by: Diljit Singh <hey@djdev.me>
Add a host test exercising fixed SuperSpeed lanes across suspend-to-idle (retaining the active host epoch) and deep sleep (refusing suspend until the host parks PIPE and powers OFF, then restoring steps 2-7 from cold reset registers on resume). Signed-off-by: Diljit Singh <hey@djdev.me>
|
Pushed two small follow-up commits (fast-forward to
A J773g hardware sleep/resume row confirming Assisted-by: LLM (Gemini:4 Neon) |
|
Thanks, that answers the sleep question in code. Assisted-by: LLM (Claude:Opus 5.5) |
|
Live J773g (
Real J773g Deep Sleep ( Assisted-by: LLM (Gemini:4 Neon) |
|
Verified across 3/3 real Deep Sleep cycles (
0 disconnects, 0 speed downgrades, and 0 kernel oops/warnings/SErrors across all 3 wakes. Assisted-by: LLM (Gemini:4 Neon) |
The Mac mini (M4, J773g) front USB-C ports are an on-board hub on ATC2: its USB2 half (05ac:800b) sits on raw xHCI port 1 and its SuperSpeed half (05ac:800c) on raw port 2, which ATC2's PHY carries on its lanes. There is no port controller on ATC2, so no Type-C mux ever asks the PHY for USB3, and only the USB2 half comes up today. macOS 27.2 links the SuperSpeed half at 10 Gb/s on this machine.
This runs ATC2's SuperSpeed lanes the way macOS 27.2 does, as an MMIO trace of macOS booting on the J773g shows, selected by device tree data and nothing else.
The sequence (from the trace)
Apple's device tree gives ATC2's PHY two properties the Type-C PHYs don't have:
atc-lane-config= <2 0> andatc-plug-orientation= 1. With the controller held in reset and its clamp on, macOS then:Changes
apple,lane-configandapple,plug-orientation, T8132 only, each requiring the other, carrying the ADT values. Only the traced values (<2 0>, 1) are allowed.set_mode, as in step 6, not at probe. After a power-off the lanes come back the same way at the next reset release. A failed handover starts the host on USB2 alone, as for any fixed-hub port, and lanes that cannot start without being touched leave the port on USB2 at probe.&atcphy2, the USB3 PHY andsuper-speed-pluson&dwc3_2(macOS leaves the controller's Gen1 force clear), and the hub's SuperSpeed half ashub@2. The hub GPIO hogs are unchanged.Without the properties nothing changes: the Type-C ports, the J700's fixed hub and the other generations keep their paths (the new branches all depend on the new flag).
Testing
tools/asahi/run-host-tests.py --only atc: 6/6, including the atc-usb3 mutations (58 killed, 3 new).--only dwc3: 1/1.tools/testing/selftests/drivers/apple/atc-t8132-usb3.pygets a new case that runs the extracted handover against the T8132 MMIO model and checks it write for write against the trace values above, with negative controls for the bit-6-only phase 2 completion and for a PIPE lock, plus the start from off (epoch, RCAL, then the handover), the latched failures and no retry. The PIPE handler harness checks the order around the reset release and the dummy PHY, with three new mutations.-Wunused-but-set-global/unused warnings off; with them on, the same 15 cases fail to compile on integration/aurora and on this branch.Untested on hardware.
Not in this change
The trace shows a few things around the link that this does not do. They are the first places to look if the SuperSpeed half doesn't link:
usb3hub_rst, AP GPIO 198) is low until ~260 ms after the PIPE handover in the trace; the DT hogs it high from early boot.Assisted-by: LLM (Claude:Opus 5.5)