Skip to content

phy: apple: atc: Serve USB2 for USB4/TBT on T8132 without CIO calibration - #1702

Merged
RyanTheTide merged 3 commits into
aurora-silicon:mainfrom
techmore:upstream/t8132-atcphy-usb2-fallback-20261111-v2
Nov 26, 2026
Merged

RyanTheTide merged 3 commits into
aurora-silicon:mainfrom
techmore:upstream/t8132-atcphy-usb2-fallback-20261111-v2

Conversation

@techmore

@techmore techmore commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Tested: At bcdc5193a3eb, GitHub Host tests passed. The native ARM64 ATC object built and all 38 ATC host cases passed on Linux. A separate historical J773g diagnostic captured three physical reconnects, detailed below. The exact-head J773g hardware row and calibrated J713/J715 regression remain pending.

Risk: Two-way door. Reverting restores the prior mux behavior. This affects T8132 Macs such as the J773g (M4 Mac mini) when a USB4 or Thunderbolt partner connects to a port without CIO calibration. Calibrated ports, including those on J713/J715, should retain USB4 or Thunderbolt mode.

On a T8132 port without the CIO calibration, serve the partner's USB2 when the port controller enters USB4 or Thunderbolt 3, instead of refusing the mux state. The J773g (Mac mini M4) is such a machine: its device tree has no apple,tunable-cio-* properties.

What the hardware runs below show is that the mux update now succeeds. In USB4, the port's xHCI then starts. In Thunderbolt 3 it also needs the companion tipd patch. They do not show a USB2 device enumerating during a USB4 or Thunderbolt link: the one dock I have showed nothing on D+/D- while in USB4.

Why. The J773g's SN201202x port controllers enter USB4 by themselves with a USB4 dock or another Mac, and Thunderbolt 3 alt mode with a Thunderbolt 3 dock. atcphy_typec_target_mode() maps those states to the USB4 and TBT PHY modes, and atcphy_mux_check() refuses both with -ENODEV when the CIO calibration is missing. The failed mux update makes cd321x_update_work() retry before it sets the USB role, so the port ends with failed to configure Type-C connection: -19 and cable revalidation failed after 3 attempts, and its dwc3 never starts an xHCI. USB 2.0 on D+/D- does not depend on the USB4 or Thunderbolt link.

The change. In atcphy_typec_target_mode(), on T8132 without CIO calibration, map USB4 and TBT to USB2. This works the same way as the existing fallback for DisplayPort pin assignments that the PHY cannot carry. The new fallback has to run before the DisplayPort fallback picks its usb_mode. That fallback compares its result with target_mode, so if it started from USB4 it would put USB4 back. Ports with the CIO calibration (the J713/J715 device trees carry it) are unchanged. A KUnit case covers both cases.

Historical diagnostic hardware on one J773g, natively, with kernels based on #1192 plus local J773g test commits, not on integration/aurora. In those kernels, the atcphy_typec_target_mode() change is behaviour-identical to this patch. They also had a TEST-ONLY log line for each mux request, which is dropped here. The patch on this base has not been booted.

  • Run 53, without the change: a USB4 dock on Back Right and another Mac (USB4) on Back Left. On both ports the mux update failed with -19 three times, then cable revalidation failed after 3 attempts, and no rear xHCI came up.
  • Run 54: a first version ran the new fallback after usb_mode was taken. The DisplayPort fallback put USB4 back and the ports failed with -19 as before. That is why the fallback now runs first.
  • Run 55, this logic: the USB4 dock on Back Right got USB4/Thunderbolt is not available on this port: serving its USB2 only, the mux update returned 0 with the PHY in USB2, and the rear xHCI (41a280000.usb) registered. The dock enumerated nothing on that xHCI while it was in USB4. The Mac on Back Left (we are the UFP there, in USB4) took the same fallback and the mux update returned 0. A keyboard plugged into Back Right later enumerated on the rear xHCI.
  • Run 56, same PHY code: the dock entered Thunderbolt 3 alt mode (SVID 0x8087), and the PHY served USB2 (state mode 2 alt 0x8087 -> PHY mode 1: 0). No rear xHCI came up because the port controller driver sets no USB role in TBT3. That is fixed separately in "usb: typec: tipd: Set a USB role for TBT3 on T8132 ports without a router". The Mac on Back Left: USB4 to USB2 again, mux 0.
  • Run 57, same PHY code: the Mac on Back Left: USB4 to USB2, mux 0. The dock entered DP alt mode this time, so the fallback did not apply to it.
  • The front USB keyboard enumerated in every run.

Runs 56 and 57 also had two TEST-ONLY sn201202x module parameters on the command line, which are not part of this PR. They change which mode the port controller picks for the dock (no USB4 host capability in the DFP VDO, Thunderbolt mode disabled). They do not touch the PHY.

Checks on this branch: scripts/checkpatch.pl --strict reported only the missing Signed-off-by, which the commit now carries. arm64 W=1 build of drivers/phy/apple/ with GCC 15.2.0 / binutils 2.46, also with CONFIG_KUNIT=y and CONFIG_PHY_APPLE_ATC_KUNIT_TEST=y: no new warnings. The existing -Wparentheses in atc-j700-dp.h and the kernel-doc warnings on struct apple_atcphy are unrelated. I ran the phy-apple-atc-mux KUnit suite under UML (x86_64, CONFIG_COMPILE_TEST): the new atcphy_test_target_mode_t8132_cio and the other atcphy_test_target_mode* cases pass. Ten other cases fail the same way on the base, because UML's logic_iomem does not back their test registers. I did not run KUnit on arm64.

Not tested: this exact branch on hardware. Other T8132 boards. A TBT3 or USB4 dock that drives USB2 on D+/D- during the link (the one I have did not). J713/J715, where the path is unchanged.

No dependency: this applies to integration/aurora as is. The companion tipd PR, "usb: typec: tipd: Set a USB role for TBT3 on T8132 ports without a router", needs this one to have any effect on the J773g.

Hardware, 2026-11-19 (J773g, 27.2 stub; this PR's two commits on our display+Ethernet test tree, not this PR's own head; loader with the T8132 USB3 calibration copied, aurora-silicon/aura#113 at 53be8212; rear port, Thunderbolt 4 cable to a MacBook Pro; two boots, the second with one more dwc3-apple.c commit that did not take effect):

  • phy-apple-atc 40aa90000.phy: USB4/Thunderbolt is not available on this port: serving its USB2 only
  • the port takes the device role, 40a280000.usb mode=device, a gadget binds and stays configured at high speed, and the MacBook lists it at 480 Mb/s
  • no failed to configure Type-C connection, no cable revalidation failed

The same cable on the same tree without these two commits: sn201202x 1-0a: failed to configure Type-C connection: -19 three times, then cable revalidation failed after 3 attempts, and no USB device.

Not run: a Thunderbolt dock, host role against a USB4/TBT partner, replug.

Current review update

Rebased onto integration/aurora at 5746ef8a5 and dropped the duplicate dev_info definition in quiesce.py. The fallback still runs before DisplayPort selects its USB mode.

Board-stack A/B diagnostic. Control 779f970e and candidate 9d9e4590 booted on the J773g with the same installed loader and device tree and release-matched modules. The change between these two source trees matches the complete #1702 patch. With the Dell dock on the same rear port, the candidate logged the USB2 fallback and the rear xHCI registered root hubs. The control showed neither. Neither run enumerated a downstream USB device on that rear xHCI. Both carried the same two failed services, and SELinux status was unavailable. These runs use a separate board stack.

A separate candidate boot (2207c2c1) recorded three physical unplug/replug cycles on the same rear port. The trace recorded nine literal typec_mux_apply returns of 0 across the cycles, including two immediately before each attach. The USB2 fallback logged and the rear xHCI root hubs reappeared after each reconnect. No downstream endpoint enumerated on that rear xHCI. The negotiated link mode and peripheral speed remain unverified. There were no new exact kernel error strings relative to the control snapshot. Two services still failed and SELinux status was unavailable. This is diagnostic evidence on a patch-equivalent board stack. The exact-head default-argument enumeration and health requirements remain open.

Outstanding hardware. On bcdc5193a3eb or a fleet candidate carrying the patch unchanged, use the default kernel command line without sn201202x overrides. On a J773g rear port with a USB4 or Thunderbolt partner, capture the USB2 fallback log, mux return 0, downstream USB2 enumeration on that rear xHCI, and three unplug/replug cycles. Record no Type-C configuration or cable-revalidation failures and zero SELinux denials, failed units, and new kernel errors.

Could an owner of a J713 or J715 run the calibrated-port regression on the same source and default arguments? Please confirm that USB4 or Thunderbolt remains selected and report SELinux denials, failed units, and new kernel errors. Calibrated hardware is unavailable locally.

@RyanTheTide

Copy link
Copy Markdown
Contributor

@techmore the change reads correctly and the KUnit case covers both paths. Two things before merge: the commit needs your Signed-off-by, and #1678 edits the line right after your hunk in atcphy_typec_target_mode(), so one of the two will need a rebase. Optional: the "serving its USB2 only" message prints on every USB4/TBT attach of such a port; dev_info would be enough.

@techmore
techmore force-pushed the upstream/t8132-atcphy-usb2-fallback-20261111-v2 branch from 4f9b5df to a4683bd Compare November 13, 2026 13:39
@techmore

Copy link
Copy Markdown
Contributor Author

Thanks, Ryan. I rebased this onto current integration/aurora after #1678 landed. There was one conflict, in atcphy_typec_target_mode(): the CIO fallback is kept first and #1678's DP condition remains directly below it. I also changed the "serving its USB2 only" message to dev_info as suggested, in the same commit.

Testing caveat: for the new head I have only compiled the changed file (atc.o). I have not completed a full J773g kernel build, and the rebased head has not been boot-tested on hardware.

@techmore

Copy link
Copy Markdown
Contributor Author

Hardware test, Mac mini M4 (J773g), 2026-11-14: PASS at this PR's head 0430675d5a04.

Kernel: aurora-silicon/linux integration/aurora 5d112b1d5493 plus the exact heads of #1192 36383187, #1718 5fbbff26, #1191 (first five commits) 3fa83613, #1865 9c71c29f, #1702 0430675d, #1703 9b0ca002 and #1872 2eb84498, merged without conflicts (release 7.3.0-prheads+, native arm64 build with GCC 15.2.0, 0 warnings). One boot on a Mac mini M4 (J773g, T8132) with a Fedora 44 userspace. The device tree came from the boot chain, not from this tree, so DT-only changes were not exercised.

This result comes from a second boot (2026-11-14 03:09 UTC) of that same kernel image (Image SHA-256 9f4d73f7de27).

Device: Apple Magic Keyboard with Touch ID and Numeric Keypad (05ac:029f, USB2 full speed) on a rear USB-C port, plugged in before boot (cold-plug).

Check Result Evidence
Rear-port device enumerates PASS usb 3-1: new full-speed USB device number 2 using xhci-hcd; usb 3-1: New USB device found, idVendor=05ac, idProduct=029f, bcdDevice= 4.20
On the rear controller and port PASS 3-1 05ac:029f speed=12 under 41a280000.usb/xhci-hcd.2.auto/usb3; typec port1: data_role: [host] device, partner present
Topology PASS Bus 003 root hub 480M → keyboard Driver=usbhid, 12M
Keyboard input PASS input: Apple Inc. Magic Keyboard with Touch ID and Numeric Keypad Keyboard as /devices/platform/soc/41a280000.usb/…/input1
USB2 path without calibration observed all three ATC PHYs (402a90000, 40aa90000, 41aa90000): T8132 calibration incomplete, USB2 only
USB/PHY errors PASS 0 error, fail or timeout lines from ATC, dwc3, xHCI, typec, tipd or USB

Not covered: hot-plug, USB 3 SuperSpeed and USB4/Thunderbolt docks on the rear ports.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 1.

The PHY change is sound. cio_tunables is set only when every apple,tunable-cio-* property parses (drivers/phy/apple/atc.c:6229-6244), so the fallback at :5743 depends on the port's own DT calibration, not on the board. Running it before the DisplayPort fallback means usb_mode starts from the mode actually served. The KUnit case covers both the calibrated and the uncalibrated path for USB4 and TBT.

  1. Both commits carry Assisted-by: trailers (5550520 Assisted-by: LLM checkpatch, 0430675 Assisted-by: LLM). Keep only your Signed-off-by in the commits. Make Assisted-by: LLM (<Vendor>:<Model>) the last line of the PR body instead of the free-text note.

Nit: tools/testing/selftests/drivers/gpu/apple-dcp/quiesce.py:33-34: dev_info was already stubbed there, so this hunk adds an identical second #define. Drop it.

HW row: J773g, kernel built from this head, default command line (no sn201202x test parameters): a USB4 partner (dock or Mac) on a rear port logs the USB2 fallback with the mux update returning 0 and no "failed to configure Type-C connection"; a USB2 device behind it or replugged on that port enumerates on the rear xHCI; 3 unplug/replug cycles; then 0 AVC, 0 failed units, 0 new kernel errors. Also one J713 or J715 boot showing USB4/TBT still selected on a calibrated port.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

This still applies cleanly to the current integration/aurora tip 110861f, and the USB4/TBT-to-USB2 fallback for ports without CIO calibration is not on the tip yet. The PHY change was reviewed as sound on 11-21. One small item is left from that review: the hunk in quiesce.py adds a second identical dev_info stub, because the file already has one, so it can be dropped. After that, the J773g row from the review is needed on a kernel built from this head (USB4 partner on a rear port, USB2 device enumerating, 3 replug cycles), plus one J713 or J715 boot showing USB4/TBT still selected on a calibrated port.

Build check of 110861f plus this change (arm64, LLVM=1, Image, dtbs and every directory it touches, Fedora config plus asahi.config): builds, no warnings in the files it touches. Host tests (tools/asahi/run-host-tests.py --only) on 110861f plus this change: apple-dcp passes (1/1); atc-usb3-tests passes (2/2).

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pre-PR checklist review at 0430675d5a04 (checked against integration/aurora 70a00e583b03): 3 blockers (§4 attribution, §2 diff cleanliness, §5 exact-head hardware/regression evidence).

Code, DT, and Safety Audit (§1–§3, §6)

  • Core PHY logic is sound: drivers/phy/apple/atc.c gates the USB4/TBT-to-USB2 fallback on atcphy_mode_is_cio(target_mode) && !atcphy->cio_tunables (the port's DT calibration capability, not board/model gating) before the DisplayPort fallback so usb_mode starts from APPLE_ATCPHY_MODE_USB2. Ports with CIO calibration remain unchanged, and atcphy_test_target_mode_t8132_cio covers both paths. Not superseded on integration/aurora.
  • Live CI: host-tests is green on 0430675d5a04.

Blockers

  1. §4 commit trailers: Both commits carry AI trailers in their git commit messages (5550520f2edf: Assisted-by: LLM checkpatch; 0430675d5a04: Assisted-by: LLM). Per §4, commit messages must carry human author/committer identity and human Signed-off-by: only (zero Assisted-by: or AI trailers in commits; disclosure belongs in the PR description only).
  2. §2 duplicate macro (tools/testing/selftests/drivers/gpu/apple-dcp/quiesce.py:33-34): Commit 0430675d5a04 adds a second identical #define dev_info(...) ((void)0) directly beneath the one already present in quiesce.py. Please drop that hunk.
  3. §5 exact-head hardware & regression evidence: The 2026-11-14 boot on 0430675d5a04 only exercised a cold-plug USB2 keyboard (explicitly excluding USB4/TBT partners and hot-plug), and the 2026-11-19 test was on a different tree without replug or §5 regression counts. On the updated head with the default kernel command line (no sn201202x test parameters), please provide a J773g run with a USB4/TBT partner on a rear port showing the USB2 fallback log, mux returning 0, no Type-C configuration errors, USB2 device enumeration, 3 unplug/replug cycles, and §5 regression counts (0 SELinux denials, 0 failed units, 0 new kernel errors), plus a J713 or J715 calibrated-port check confirming USB4/TBT stays selected (or request a test run on calibrated hardware if unavailable).

…tion

The SN201202x port controllers of the Mac mini (J773g) enter USB4 by
themselves with a USB4 dock or another Mac, and Thunderbolt 3 alt mode
with a Thunderbolt 3 dock. atcphy_typec_target_mode() maps those states
to the USB4 and TBT PHY modes, which atcphy_mux_check() refuses with
-ENODEV on a T8132 PHY without the CIO calibration. The J773g device tree
has none. The failed mux update makes cd321x_update_work() retry before
it sets the USB role, so the port ends up with

  sn201202x 1-08: failed to configure Type-C connection: -19
  sn201202x 1-08: cable revalidation failed after 3 attempts

and its dwc3 controller never starts an xHCI.

USB 2.0 on D+/D- does not depend on the USB4 or Thunderbolt link. As is
already done for the DisplayPort pin assignments this PHY cannot carry,
serve the partner's USB2 instead of refusing the mode.

The CIO fallback has to come before the DisplayPort fallback picks its
USB mode: that one compares its result with target_mode, and started
from the USB4 mode it would put USB4 back.

Ports with the CIO calibration are unchanged. A KUnit case covers both.

Signed-off-by: Sean Dolbec <[email protected]>
The ATC USB3 host test and the apple-dcp phy, pm, quiesce and dwc3
host tests compile functions taken from drivers/phy/apple/atc.c.
Define dev_info() as a no-op beside their existing logging shims so
the generated host C keeps compiling when one of those functions
prints an informational message.

Signed-off-by: Sean Dolbec <[email protected]>
@techmore
techmore force-pushed the upstream/t8132-atcphy-usb2-fallback-20261111-v2 branch from 0430675 to bcdc519 Compare November 24, 2026 03:02

Copy link
Copy Markdown
Contributor Author

Updated to bcdc5193a on 5746ef8a5. Both commit trailers are removed, the PR description carries the assistance disclosure, and the duplicate dev_info stub is gone. The native ARM64 ATC object built and all 38 ATC host cases passed on Linux. The older USB runs do not satisfy the requested matrix. The exact-head J773g rear USB4/TBT partner run with USB2 enumeration and three replug cycles, and the calibrated J713/J715 comparison, are still outstanding.

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (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

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: HOLD at bcdc5193a3eb
Blockers:

  1. PR description (§4): remove the AI assistance disclosure lines at the end of the PR body. Commits 53ffd323537c and bcdc5193a3eb are now clean (human author/committer and Signed-off-by only), but the updated 2026-11-24 policy forbids AI attribution anywhere, including PR bodies.
  2. PR description (§5): add top-level Tested: (Macs, head SHA bcdc5193a3eb, result) and Risk: (door type and affected Macs) lines.
  3. Hardware & regression rows (§5): provide exact-head (bcdc5193a3eb, or a fleet candidate carrying it unchanged) results on the default kernel command line (no sn201202x parameters): (a) J773g rear port with a USB4/TBT partner logging USB4/Thunderbolt is not available on this port: serving its USB2 only, mux returning 0, no failed to configure Type-C connection / cable revalidation failed, USB2 device enumeration on the rear xHCI, 3 unplug/replug cycles, and 0 SELinux denials, 0 failed units, 0 new kernel errors; (b) a calibrated T8132 port (J713/J715) confirming USB4/TBT stays selected with 0 SELinux denials, 0 failed units, 0 new kernel errors (or an explicit regression request if calibrated hardware is unavailable).

Checked: §1–§3 and §6 pass (0 code blockers; prior commit-trailer and quiesce.py duplicate-stub blockers resolved); §4 fails on PR body; §5 fails on Tested:/Risk: lines and exact-head HW/regression rows; mergeable against main (037f7bca6822); exact-head CI host-tests green.

Evidence
  • Changes since prior review (0430675d5a04 → bcdc5193a3eb):
    • Rebased onto 5746ef8a5afd; merges cleanly with current main (037f7bca6822, mergeable: true, not superseded).
    • Prior blocker 1 (commit trailers): resolved in 53ffd323537c and bcdc5193a3eb (both carry human author/committer and Signed-off-by: Sean Dolbec <[email protected]> only).
    • Prior blocker 2 (tools/testing/selftests/drivers/gpu/apple-dcp/quiesce.py duplicate dev_info macro): resolved; hunk dropped (quiesce.py:33 already defines it). Remaining 4 host-test shims (tools/asahi/atc-usb3-tests.py, dwc3/prefix.c, phy.py, pm.py) are clean with no duplicates.
  • Code & safety audit (§1–§3, §6):
    • drivers/phy/apple/atc.c (atcphy_typec_target_mode): gates USB4/TBT→USB2 fallback on atcphy_mode_is_cio(target_mode) && !atcphy->cio_tunables (DT calibration property set in atcphy_load_t8132_cio_tunables, not board/model gating) before the DP fallback takes usb_mode, so APPLE_ATCPHY_MODE_USB2 is preserved and accepted by atcphy_mux_check(). Calibrated T8132 ports and all other generations are unaffected.
    • drivers/phy/apple/atc-test.c: atcphy_test_target_mode_t8132_cio covers USB4 and TBT on both uncalibrated (USB2-only and SS-calibrated) and CIO-calibrated T8132 ports.
    • Non-blocking nit: bcdc5193a3eb's commit message still mentions quiesce even though quiesce.py is no longer modified.
  • CI at bcdc5193a3eb: host-tests passed (45316641279).

@github-actions github-actions Bot added blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) labels Nov 24, 2026
@github-actions github-actions Bot removed the needs-template PR body lacks Tested or Risk (bot) label Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at 19ac7c94: not ready yet

Check Detail
CI at head no failing: host-tests, pr-text / pr-text
Review ok approved by RyanTheTide
Requested changes ok none
Hardware row at head ok comment at 19ac7c94
Conflicts ok none
PR text ok Risk: two-way · . Reverting restores the prior mux behavior. This affects T8132 Macs such as the J773g (M4 Mac mini) when a USB4 or Thunderbolt partner connects to a port without CIO calibration. Calibrated ports, including those on J713/J715, should retain USB4 or Thunderbolt mode. On a T8132 port without the CIO calibration, serve the partner's USB2 when the port controller enters USB4 or Thunderbolt 3, instead of refusing the mux state. The J773g (Mac mini M4) is such a machine: its device tree has no apple,tunable-cio-* properties. What the hardware runs below show is that the mux update now succeeds. In USB4, the port's xHCI then starts. In Thunderbolt 3 it also needs the companion tipd patch. They do not show a USB2 device enumerating during a USB4 or Thunderbolt link: the one dock I have showed nothing on D+/D- while in USB4. Why. The J773g's SN201202x port controllers enter USB4 by themselves with a USB4 dock or another Mac, and Thunderbolt 3 alt mode with a Thunderbolt 3 dock. atcphy_typec_target_mode() maps those states to the USB4 and TBT PHY modes, and atcphy_mux_check() refuses both with -ENODEV when the CIO calibration is missing. The failed mux update makes cd321x_update_work() retry before it sets the USB role, so the port ends with failed to configure Type-C connection: -19 and cable revalidation failed after 3 attempts, and its dwc3 never starts an xHCI. USB 2.0 on D+/D- does not depend on the USB4 or Thunderbolt link. The change. In atcphy_typec_target_mode(), on T8132 without CIO calibration, map USB4 and TBT to USB2. This works the same way as the existing fallback for DisplayPort pin assignments that the PHY cannot carry. The new fallback has to run before the DisplayPort fallback picks its usb_mode. That fallback compares its result with target_mode, so if it started from USB4 it would put USB4 back. Ports with the CIO calibration (the J713/J715 device trees carry it) are unchanged. A KUnit case covers both cases. Historical diagnostic hardware on one J773g, natively, with kernels based on #1192 plus local J773g test commits, not on integration/aurora. In those kernels, the atcphy_typec_target_mode() change is behaviour-identical to this patch. They also had a TEST-ONLY log line for each mux request, which is dropped here. The patch on this base has not been booted. - Run 53, without the change: a USB4 dock on Back Right and another Mac (USB4) on Back Left. On both ports the mux update failed with -19 three times, then cable revalidation failed after 3 attempts, and no rear xHCI came up. - Run 54: a first version ran the new fallback after usb_mode was taken. The DisplayPort fallback put USB4 back and the ports failed with -19 as before. That is why the fallback now runs first. - Run 55, this logic: the USB4 dock on Back Right got USB4/Thunderbolt is not available on this port: serving its USB2 only, the mux update returned 0 with the PHY in USB2, and the rear xHCI (41a280000.usb) registered. The dock enumerated nothing on that xHCI while it was in USB4. The Mac on Back Left (we are the UFP there, in USB4) took the same fallback and the mux update returned 0. A keyboard plugged into Back Right later enumerated on the rear xHCI. - Run 56, same PHY code: the dock entered Thunderbolt 3 alt mode (SVID 0x8087), and the PHY served USB2 (state mode 2 alt 0x8087 -> PHY mode 1: 0). No rear xHCI came up because the port controller driver sets no USB role in TBT3. That is fixed separately in "usb: typec: tipd: Set a USB role for TBT3 on T8132 ports without a router". The Mac on Back Left: USB4 to USB2 again, mux 0. - Run 57, same PHY code: the Mac on Back Left: USB4 to USB2, mux 0. The dock entered DP alt mode this time, so the fallback did not apply to it. - The front USB keyboard enumerated in every run. Runs 56 and 57 also had two TEST-ONLY sn201202x module parameters on the command line, which are not part of this PR. They change which mode the port controller picks for the dock (no USB4 host capability in the DFP VDO, Thunderbolt mode disabled). They do not touch the PHY. Checks on this branch: scripts/checkpatch.pl --strict reported only the missing Signed-off-by, which the commit now carries. arm64 W=1 build of drivers/phy/apple/ with GCC 15.2.0 / binutils 2.46, also with CONFIG_KUNIT=y and CONFIG_PHY_APPLE_ATC_KUNIT_TEST=y: no new warnings. The existing -Wparentheses in atc-j700-dp.h and the kernel-doc warnings on struct apple_atcphy are unrelated. I ran the phy-apple-atc-mux KUnit suite under UML (x86_64, CONFIG_COMPILE_TEST): the new atcphy_test_target_mode_t8132_cio and the other atcphy_test_target_mode* cases pass. Ten other cases fail the same way on the base, because UML's logic_iomem does not back their test registers. I did not run KUnit on arm64. Not tested: this exact branch on hardware. Other T8132 boards. A TBT3 or USB4 dock that drives USB2 on D+/D- during the link (the one I have did not). J713/J715, where the path is unchanged. No dependency: this applies to integration/aurora as is. The companion tipd PR, "usb: typec: tipd: Set a USB role for TBT3 on T8132 ports without a router", needs this one to have any effect on the J773g. Hardware, 2026-11-19 (J773g, 27.2 stub; this PR's two commits on our display+Ethernet test tree, not this PR's own head; loader with the T8132 USB3 calibration copied, aurora-silicon/aura#113 at 53be8212; rear port, Thunderbolt 4 cable to a MacBook Pro; two boots, the second with one more dwc3-apple.c commit that did not take effect): - phy-apple-atc 40aa90000.phy: USB4/Thunderbolt is not available on this port: serving its USB2 only - the port takes the device role, 40a280000.usb mode=device, a gadget binds and stays configured at high speed, and the MacBook lists it at 480 Mb/s - no failed to configure Type-C connection, no cable revalidation failed The same cable on the same tree without these two commits: sn201202x 1-0a: failed to configure Type-C connection: -19 three times, then cable revalidation failed after 3 attempts, and no USB device. Not run: a Thunderbolt dock, host role against a USB4/TBT partner, replug.

Areas: area:gpu, area:usb

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

DjDeveloperr
DjDeveloperr previously approved these changes Nov 25, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: FINISH, then merge at bcdc5193a3eb: the code is ready; it needs only a row at this head.

Blockers: none in the code. Missing row: the J773g rear port at this head with a USB4/TBT partner on the default command line: it logs serving its USB2 only, the mux returns 0, and USB2 devices behind it work. The M4 mini lead can run it. I removed the attribution lines from the body. Thanks.

Because atc.c runs on every Mac, it also needs one boot at this head on another generation with a USB4 partner working as before.

Checked: no Apple material, no gates. Both commits are clean and signed now. CI green.

@DjDeveloperr
DjDeveloperr dismissed stale reviews from themself November 25, 2026 06:28

Superseded by the review at bcdc519

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) merge-conflict Conflicts with the base branch (bot) and removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) ready-to-merge Meets the merge policy: merge it (bot) labels Nov 25, 2026
@DjDeveloperr
DjDeveloperr requested review from a team as code owners November 26, 2026 01:29
@github-actions github-actions Bot added 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) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 26, 2026

Copy link
Copy Markdown
Contributor

J773g (M4 Mac mini, T8132) at 19ac7c942bd1, in batch 61d5c626c013 over main 15695c3ba532, with zero merge-tree differences in the six changed files and the default command line. The USB4 enclosure on the back-middle port (SPMI 0xc) logged serving its USB2 only, and the rear xHCI controller registered. The enclosure exposed no USB2 device. The separate SanDisk stick on the back-right port enumerated at 480 Mb/s. Wi-Fi was associated and no units failed after three RTC s2idle cycles. USB2 enumeration through the USB4 partner and the replug cycles are still open.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Nov 26, 2026

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: MERGE at 19ac7c942bd1 once the J713 regression row is posted (I'm queueing it in our lab)

Blockers: none in the code.

Checked:

  • The fallback depends on what the port's device tree describes: !cio_tunables, meaning no apple,tunable-cio-*. No board check is involved. A port with the calibration still gets USB4/TBT, and the new KUnit case covers both sides (USB4 and TBT, with and without SuperSpeed tunables).
  • The rewrite to USB2 runs before the DP fallback. A 4-lane DP request still lands on USB2 as before, and usb_mode now starts from the mode that is actually served.
  • Dj's J773g row at this head (batch 61d5c626c013): the mux update succeeds, the rear xHCI registers, there are 0 failed units after 3 RTC s2idle cycles, and a USB2 stick enumerates on the next port. As the PR says, USB2 enumeration through the USB4 partner is still unproven.

Non-blocking:

  • The merge from main left a second, identical #define dev_info(...) ((void)0) next to the existing one in atc-usb3-tests.py, dwc3/prefix.c, phy.py (×3) and pm.py. Identical redefinitions compile, but they can go in a follow-up.
  • Question: the new branch sits inside the existing T8132-generation block. Does any other ATC generation have ports without CIO calibration? If one does, the same fallback could key on cio_tunables alone, outside the generation check. If none does, a one-line comment saying so would help the next reader.
  • dev_info prints on every USB4/TBT entry on such a port. dev_info_once or a per-port flag would keep repeated replugs quiet.

The regression row goes on a calibrated T8132 port (J713, M4 Air), where nothing should change.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Nov 26, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

19ac7c9 J615 (M3 Air 15", T8122) + J616s (M4 Pro, T6040) PASS: batched on main 7f00dc6 (0 merge-tree diffs), default cmdline, calibrated ATC ports unchanged (0 "serving its USB2 only" lines; J615 external USB-C DP-1 + eDP-1 connected across 3/3 rtc0 s2idle, J616s 3/3 rtc1 s2idle), 0 failed units, Enforcing, 0 new AVC, 0 new kernel errors; stock defaults restored.

@RyanTheTide
RyanTheTide merged commit a4c5e47 into aurora-silicon:main Nov 26, 2026
6 of 8 checks passed
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merged into main. Thank you! It merged on the hardware rows at this head and a non-author review.

techmore added a commit to techmore/linux that referenced this pull request Nov 28, 2026
Keep the main ATC fallback and host test coverage from aurora-silicon#1702. Retain
the mux capability and role selection in this branch. An unbound
router described in firmware remains a router connection even when
TIPD can probe before its provider binds.

Signed-off-by: Sean Dolbec <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants