Repository navigation
phy: apple: atc: serve a T8132 device role on USB2 - #2434
DjDeveloperr wants to merge 1 commit into
Conversation
…ce mode A USB3 PHY that cannot run a SuperSpeed device answers the device request with -EOPNOTSUPP and leaves the PIPE alone. The glue already offers the gadget at high speed for that (T6040), but on T8132 and T6050 the check for failed host handoffs ran first and failed the role instead. Its reason is xHCI: a failed BIST or PIPE handoff must not start the host. That does not apply to a gadget whose USB2 PHY already runs as a device. The T8132 ATC PHY refuses the device role while its lanes run USB3, so a T8132 port with a USB3 calibration and a host on the other end lost its USB (seen on the J773g, linux#2434). Take the high-speed path for a device-role -EOPNOTSUPP on every SoC, before that check; other USB3 PHY errors are handled as before. T6050 never gets here, its USB2 PHY has no device mode. The ATC PHYs that answer -EOPNOTSUPP for another reason (a T8103 port whose lanes are all DisplayPort or that has no SuperSpeed tunables) cannot carry a SuperSpeed device either, so the high-speed gadget fits them too; they already took this path. The T8132 selftest now expects the high-speed gadget. This is the generic form of the T8132 fallback in linux#2420 by techmore, whose J773g row (a USB 3 host lists the gadget at 480 Mb/s where the role failed before) is the hardware evidence for it. DjDeveloperr reported the failure and serves the T8132 device role from the PHY side in linux#2434; both changes can land. Link: #2420 Link: #2434 Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Host-tests fix pushed in de20ca2. The failures were mine. What the commit changes:
Local results, through
My host's clang 23 adds 🤖 Generated with Claude Code |
|
This commit is now carried unchanged in #2334 (161cf31, your authorship), as the merge train asked: one head for the device-role work. On top of it, #2334:
The host-tests failure on this PR came from the ATC USB3 harness and the apple-dcp models, which compile atc.c against their own structs. A Still owed: a J773g row at #2334's head ( |
|
Merge-train adversarial review (MERGETRAIN-LINUX2) at de20ca2: NO BLOCKERS. Code read only, nothing built here. Before the merge it still needs Dj's verdict at this head; the missing rows are listed below. Full review#2434 phy: apple: atc: serve a T8132 device role on USB2 @de20ca29VERDICT: NO BLOCKERS in the code. The PR does not prove its feature yet: no host has enumerated the gadget. Treat that as a merge gate. Shared-code check: the new behaviour is reached only through Nits / risks:
Missing rows:
|
On a T8132 port whose SuperSpeed banks are calibrated, a USB device role previously failed in atcphy_usb3_set_mode() with -EOPNOTSUPP, causing dwc3-apple to fail setup and the Type-C port controller to give up after cable revalidation retries. SuperSpeed device mode is not supported by this driver on T8132, so serve a T8132 device role on USB2 instead: - Map APPLE_ATCPHY_MODE_USB3 and pin-D APPLE_ATCPHY_MODE_USB3_DP to APPLE_ATCPHY_MODE_USB2 while the device role is active, keeping four-lane APPLE_ATCPHY_MODE_DP (pin C/E, where USB2 uses its own wires) unchanged. - Set t8132_device only after atcphy_mux_switch() and atcphy_usb3_route() succeed, and clear it on controller role exit (atcphy_usb3_power_off() or PHY_MODE_USB_HOST) rather than on mux SAFE/OFF transitions. - Preserve the partner's un-downgraded mode in typec_mode so a direct device-to-host data role swap restores SuperSpeed lanes before host_active blocks T8132 lane reconfiguration, and subsequent atcphy_usb2_init() calls respect t8132_device. - Update the KUnit test and host selftest fixtures in the same commit so host test builds remain bisectable. Signed-off-by: Diljit Singh <hey@djdev.me>
de20ca2 to
025e7ea
Compare
|
Updated and force-pushed as a single squashed commit (
Verification:
Assisted-by: LLM (Gemini:4 Neon) |
|
Merge-train re-review (MERGETRAIN-LINUX2) at 025e7ea: NO BLOCKERS. The earlier points 1-4 are resolved. Point 5 is still open: KUnit has not been run at this head. Still needed before the merge: a host-side enumeration row (J773g at 480M) and a KUnit run at this head. Full re-review#2434 phy: apple: atc: serve a T8132 device role on USB2 @025e7ea2VERDICT: NO BLOCKERS I read the code only; nothing was built or run. Head 025e7ea is one commit on integration/aurora 24dc422. GitHub reports it MERGEABLE. Line numbers below are atc.c at 025e7ea. The merge gate from the earlier review still stands: no host has enumerated the gadget. The only evidence is still that the -95 error is gone. See the missing rows. Earlier points (review-B.md, @de20ca29)
BlockersNone. New problems / nits
Missing rows
|
|
Re-review at 025e7ea (code read only). Earlier points:
New:
Still missing, at this head:
Assisted-by: LLM (Claude:Opus 5.5) |
|
KUnit at 025e7ea: I ran the ATC KUnit suites under qemu arm64 (
At 025e7ea the ATC host tests also pass: atc-usb3-tests (plain and So the KUnit item is closed. The hardware row is still owed: a real host has to enumerate the gadget at 480M, then a swap or replug as host has to come back at 5000M. Assisted-by: LLM (Claude:Opus 5.5) |
|
Hardware half of the row at 025e7ea: the J713 (13-inch M4 Air) in device role on USB2, enumerated by a real host. The kernel is 7.3.0-aurora-fleet81, the J713's default. It is integration/aurora eb6d9ec plus open heads, including this PR at 025e7ea. It ran on the default command line with no reboot. Port0 was in device role with an NCM gadget from configfs. The host was an M4 Pro MacBook Pro running Linux, on the same cable.
Still to run: the same port back in host role at 5000M. That needs a USB3 device on port0 or a physical swap, and nobody was at the Mac. Assisted-by: LLM (Claude:Opus 5.5) |
On a T8132 port whose lanes run USB3, a device role failed.
atcphy_usb3_set_mode()refusedPHY_MODE_USB_DEVICEwith-EOPNOTSUPP, then:USB3 PHY setup failed, err=-95;cable revalidation failed after 3 attempts.That started once the boot loader passed the T8132 USB3 calibration (aura#113 24812c55). Before that, these ports ran USB2 only, and the device role worked on them. On the M4 Mac mini (J773g) a rear port with a host on the other end lost its USB.
SuperSpeed device mode is not supported by this driver on T8132, so this serves the device role on USB2 instead:
USB3and pin-DUSB3_DPmove toUSB2. Four-lane DisplayPort (pin C/E) keeps USB2 on its own wires and is unchanged.t8132_deviceis set only afteratcphy_mux_switch()andatcphy_usb3_route()succeed, and is cleared on controller role exit (atcphy_usb3_power_off()or switching toPHY_MODE_USB_HOST) rather than onSAFE/OFFmux bounces.typec_modepreserves the partner's un-downgraded SuperSpeed mode so a direct device-to-host data role swap restores SuperSpeed lanes beforehost_activeblocks T8132 lane reconfiguration.atcphy_test_t8132_device_role_usb2), and host selftest fixture updates are squashed into a single bisectable commit.Measured on the J773g, 2026-11-19, default kernel 7.3.0-m4drv8 with this module:
dwc3-apple 40a280000.usb: USB3 PHY setup failed, err=-95(×3), thensn201202x 1-0a: cable revalidation failed after 3 attempts.phy-apple-atc 40aa90000.phy: USB device role: SuperSpeed device mode not supported by driver, using USB2(log message updated from earlier wording). No-95and no revalidation failure; dwc3 enters device mode with run/stop set and a configfs ACM gadget binds to UDC40a280000.usb.Assisted-by: LLM (Gemini:4 Neon)