Repository navigation
Conversation
… 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>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…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>
|
Thanks for the J773g row. It shows the fallback doing the right thing: the role used to fail with linux#2334 already has the same mechanism for T6040. When the USB3 PHY answers a device request with About the compatible check: the other ATC 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 |
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-dwc3as 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. Onapple,t8132-dwc3, -EOPNOTSUPP for the device role starts the role on USB2 with the gadget limited to high speed and logsUSB3 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:
dwc3-apple 40a280000.usb: USB3 PHY setup failed, err=-95, thensn201202x 1-0a: cable revalidation failed after 3 attemptsdwc3-apple 40a280000.usb: USB3 PHY has no SuperSpeed device mode, USB2 onlymode=device, UDC presentconfiguredat high speed for 60 sObserved, 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 outandep0 data phase end transfer failed: -110) and binding it again, the UDC staysnot 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.