Skip to content

usb: dwc3: apple: keep a T8132 device role on USB2 without SuperSpeed device mode - #2420

Closed
techmore wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
techmore:m4/dwc3-t8132-device-usb2
Closed

techmore wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
techmore:m4/dwc3-t8132-device-usb2

Conversation

@techmore

@techmore techmore commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Draft: the fallback works on hardware (below). Still not run: a SuperSpeed host session on the same port after a fallback device session, which is what the speed-limit restore is for.

What fails. The T8132 ATC PHY refuses USB device mode with -EOPNOTSUPP once it is in a USB3 mode, which it is whenever the boot loader supplied its SuperSpeed calibration (aura #113). dwc3-apple treats every USB3 PHY error on apple,t8132-dwc3 as fatal, so a port where the machine is the USB device fails (USB3 PHY setup failed, err=-95), where with a USB2-only PHY it ran as a USB2 device. Reported by DjDeveloperr on a J773g (26.6.2).

Change. drivers/usb/dwc3/dwc3-apple.c, +21 -1. On apple,t8132-dwc3, -EOPNOTSUPP for the device role starts the role on USB2 with the gadget limited to high speed and logs USB3 PHY has no SuperSpeed device mode, USB2 only. The limit is removed before the next session's core start. The compatible test is needed: other ATC PHYs return the same error for other reasons (an M1 PHY that is off or without SuperSpeed tunables) and keep today's handling. Every other error on T8132 stays fatal. The host role is not touched.

Not handled: if the role is selected before the Type-C mux update has put the PHY into a USB3 mode, the PHY accepts the device role and nothing here runs.

What was run. Builds (W=1), checkpatch clean.

J773g, 27.2 stub, loader with the T8132 USB3 calibration (aurora-silicon/aura#113), rear port to the USB-C data port of a dock on a MacBook Pro, so a plain USB 3.x host through the dock's hub; this commit on our test tree with #1702's two commits, one boot each:

Without this commit With it
Log 3 × dwc3-apple 40a280000.usb: USB3 PHY setup failed, err=-95, then sn201202x 1-0a: cable revalidation failed after 3 attempts dwc3-apple 40a280000.usb: USB3 PHY has no SuperSpeed device mode, USB2 only
Controller no role, no UDC mode=device, UDC present
Gadget does not bind binds, configured at high speed for 60 s
Host sees nothing lists the gadget under the dock's USB2.0 hub at 480 Mb/s

Observed, not caused by this commit: after unbinding a gadget that had been configured (the host drops it; the kernel prints wait for SETUP phase timed out and ep0 data phase end transfer failed: -110) and binding it again, the UDC stays not attached (watched for 60 s) and the host does not list it again. The same happens, with the same two lines, on the kernel without this commit when the port runs its device role on USB2 for a USB4/Thunderbolt partner (#1702's case), so it is behaviour of the gadget unbind path on this controller. A rebind before the gadget was configured works on both.

The other rear port kept its host role (a mouse). No WARNING or Oops.

Not run: a physical replug; a SuperSpeed host session on the same port after a fallback device session; any machine but the J773g.

With a USB4/Thunderbolt partner (#1702's case) this commit does not take effect: the PHY serves USB2 only and accepts the device role by itself.

… device mode

The T8132 ATC PHY refuses USB device mode with -EOPNOTSUPP once it is
in a USB3 mode, which it is whenever the boot loader supplied its
SuperSpeed calibration. dwc3-apple treats every USB3 PHY error on
apple,t8132-dwc3 as fatal, so a port where the machine is the USB
device fails its role ("USB3 PHY setup failed, err=-95"), where with
a USB2-only PHY it ran as a USB2 device.

On apple,t8132-dwc3, take -EOPNOTSUPP for the device role as the PHY
having no SuperSpeed device mode: start the role on USB2, with the
gadget limited to high speed, and say so. The controller compatible
is how this file already selects per-SoC behaviour, and it is needed
here: other ATC PHYs return the same error for other reasons (an M1
PHY that is off or has no SuperSpeed tunables), and their handling is
unchanged. Every other error on T8132 stays fatal.

The host role is not touched; the speed limit is removed when the
session ends.

If the role is selected before the Type-C mux update has put the PHY
into a USB3 mode, the PHY accepts the device role and nothing here
runs; that ordering was not changed.

Assisted-by: LLM
Signed-off-by: Sean Dolbec <sdolbec1@gmail.com>
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-19T15:07:36.098831Z
We couldn’t complete this review. Comment @codex review to try again.
5f05554 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@techmore
techmore marked this pull request as draft November 19, 2026 15:14
RyanTheTide added a commit that referenced this pull request Nov 19, 2026
…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>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the J773g row. It shows the fallback doing the right thing: the role used to fail with -95, and now a USB 3 host lists the gadget at 480 Mb/s.

linux#2334 already has the same mechanism for T6040. When the USB3 PHY answers a device request with -EOPNOTSUPP, the gadget is clamped to high speed and the saved maximum speed comes back at the next core init. I've now pushed 055fed8 to #2334. It moves that path ahead of the T8132/T6050 hard-fail, for every SoC, so a T8132 port gets the same high-speed gadget your commit gives it. The commit credits this PR and cites your table as its hardware evidence.

About the compatible check: the other ATC -EOPNOTSUPP answers (a T8103 port whose lanes are all DisplayPort, or one without SuperSpeed tunables) can't carry a SuperSpeed device either, and #2334 already sends them to the same clamp. So the check doesn't select different behaviour, and under the current tree rules a gate needs a hardware reason it encodes.

Two ways forward, your choice: rebase this onto #2334, where it reduces to nothing, or close it in favour of #2334. Dj's #2434 (the PHY moves the lanes to USB2) can land alongside either.

The unbind/rebind not attached you saw looks separate from this. On T6040 we see one request ... was not queued per gadget unbind, and that's being looked at as its own issue.

@techmore

Copy link
Copy Markdown
Contributor Author

Closing in favour of #2334, which has the same fallback for every SoC as of 055fed8.

@techmore techmore closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants