Repository navigation
Conversation
…uter cd321x_update_work() derives the USB role only from the USB2 and USB3 connection bits of DATA_STATUS. In Thunderbolt 3 alt mode the controller sets neither: on the Mac mini (J773g) a Thunderbolt 3 dock gives DATA_STATUS 0x86010001, which has the data connection and TBT connection bits and a TBT cable speed, but no USB2, USB3, DisplayPort or USB4 connection bit. The role stays USB_ROLE_NONE and the port's dwc3 never starts an xHCI. That is right for a port with a USB4/Thunderbolt router, which tunnels the partner's USB. The J773g's ports have no router, and their T8132 PHY has no CIO calibration, so the PHY serves the partner's USB2 instead of the Thunderbolt link. Without a USB role nothing uses it. On a T8132 SN201202x port without a router, give a TBT or USB4 connection that reports no USB2 or USB3 connection the USB role of the port's Type-C data role, taken from STATUS, since DATA_STATUS reports no USB connection to take the USB data role from. Ports with a router, and other SoCs, are unchanged. Assisted-by: LLM checkpatch
The lifecycle harness builds cd321x_update_work() from tipd/core.c on the host. It now compares the STATUS data role against TYPEC_HOST for a T8132 TBT3 port without a router, and the shim had no enum typec_data_role, so physical-disconnect, fast-replug-bounce and dropped-swap-teardown failed to compile. Declare the enum as include/linux/usb/typec.h does. Assisted-by: LLM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft, build-only: the new role path has never run on hardware. It builds, and checkpatch reports only the missing
Signed-off-by; see "Hardware runs" below.On a T8132 SN201202x port with no USB4/Thunderbolt router, give a Thunderbolt 3 (or USB4) connection that reports no USB2 or USB3 connection the USB role of the port's Type-C data role. Without a role, the port's USB controller never starts (run 56 below). With one, the controller should start and use the USB2 that the PHY serves, but that has not run on hardware yet.
Why.
cd321x_update_work()takes the USB role only from the USB2 and USB3 connection bits of DATA_STATUS. In Thunderbolt 3 alt mode the controller sets neither. On the J773g (Mac mini M4), a Thunderbolt 3 dock on Back Right gave DATA_STATUS0x86010001. It has the data connection and TBT connection bits and a TBT cable speed, but no USB2, USB3, DisplayPort or USB4 connection bit. With a router that is fine, because the router tunnels the dock's USB. The J773g's rear ports have no router in the device tree, and their T8132 PHY has no CIO calibration. With "phy: apple: atc: Serve USB2 for USB4/TBT on T8132 without CIO calibration", the PHY serves the partner's USB2 there instead. But with the role left atUSB_ROLE_NONE, dwc3 never creates the xHCI that would use it.The change. When the port is connected, is a T8132 SN201202x (
apple,t8132-sn201202x), has no router (cd321x->tbt_switchis NULL), and DATA_STATUS shows a TBT or USB4 connection without USB2/USB3, the USB role comes from the Type-C data role in STATUS: host →USB_ROLE_HOST, device →USB_ROLE_DEVICE. It does not come from DATA_STATUS's USB data role bit, because DATA_STATUS reports no USB connection here. Ports with a router, other SoCs, and connections that report USB2 or USB3 are unchanged. In the current device trees, the only T8132 ports with the CIO calibration (J713/J715) also have a router, so they are excluded.Hardware runs. These ran on one J773g, natively, with kernels based on #1192 plus local J773g test commits. None of them ran this patch's role path:
state mode 2 alt 0x8087 -> PHY mode 1: 0). DATA_STATUS read back0x86010001, from a read-only register dump. No rear xHCI came up; only the front controller's buses were present. This is the failure the patch addresses.Test-only setup, not part of this PR: runs 56 and 57 used local
sn201202xmodule parameters to steer the dock's mode entry.j773g_no_usb4clears USB4 host capability in the DFP VDO (TX_IDENTITY), andj773g_no_tbt3clearsthunderBoltModeEnabled(INTEL_VID_CONFIG). Both replay a pre-Linux connection withDISC. The DFP VDO change is why the dock went to Thunderbolt 3 in run 56 instead of USB4. Those knobs write the controller's configuration and are J773g test aids only.Checks on this branch:
scripts/checkpatch.pl --strictreports only the missingSigned-off-by(see below). arm64W=1build ofdrivers/usb/typec/tipd/with GCC 15.2.0 / binutils 2.46, also withCONFIG_KUNIT=yandCONFIG_TYPEC_TIPD_KUNIT_TEST=m: no warnings. There is no KUnit case: the existing CD321x tests do not drive the USB role fromcd321x_update_work().Not tested:
tbt_switchis NULL, so a Thunderbolt 3 connection gets the USB role. When the router binds later,cd321x_tbt_attach_work()takes its switch and reapplies the cable state. Whether that then drops the role has not been run.Dependency: this builds and applies on integration/aurora alone. On the J773g it has an effect only together with the companion atcphy patch, "phy: apple: atc: Serve USB2 for USB4/TBT on T8132 without CIO calibration". Without it, the TBT mux update fails with
-ENODEVandcd321x_update_work()retries before it reaches the role.Signed-off-by from the author to follow. The commit is posted without one; I'll add mine before it's merged.
Written with help from an LLM; I reviewed it and ran the hardware tests above.