Repository navigation
Conversation
39bd46e to
9b0ca00
Compare
Codex Review Summary: ✅ CompletedThis 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. |
|
Early note on this draft (no full review yet):
Assisted-by: LLM (Claude:Opus 5.5) |
|
On 110861f, cd321x_update_work() still takes the USB role only from the USB2 and USB3 connection bits, so a TBT3 partner on a port without a router still gets no role. Both commits apply cleanly on 110861f. It pairs with #1702 (PHY serves USB2 without the CIO calibration). @techmore, two things are still open: key the new branch on what the PHY reports instead of the apple,t8132-sn201202x compatible, as in the earlier review note, and a J773g row with a Thunderbolt 3 dock on a rear port that shows the xHCI starting and a USB2 device enumerating. Build check of 110861f plus this change (arm64, LLVM=1, Image, dtbs and every directory it touches, Fedora config plus asahi.config): builds, 1 compiler 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). |
…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 <sdolbec1@gmail.com>
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 <sdolbec1@gmail.com>
When a USB4 or Thunderbolt partner has neither a router nor the usual USB connection status bits, a USB role is appropriate only if the mux supplies USB2 instead of the tunnel. Have the ATC PHY advertise that capability from its calibration result. Use the capability in TIPD and continue to activate the role only after mux configuration. Signed-off-by: Sean Dolbec <sdolbec1@gmail.com>
9b0ca00 to
1d5fa63
Compare
|
Updated the draft to |
Draft: the updated role path builds and has host coverage. It has never run on hardware.
On a port whose PHY supplies USB2 in place of USB4/Thunderbolt and which has no 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. The ATC PHY advertises USB2 tunnel fallback through the Type-C mux after it has checked the port's CIO calibration. TIPD uses that capability when the cable is connected, a TBT or USB4 link is reported without USB2/USB3 status, and no router is present. It derives the role from the Type-C STATUS and starts it after mux configuration. A port without the capability keeps its existing role selection.
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.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: #1702. This branch includes the two #1702 commits atop
integration/auroraat5746ef8a5, with the TIPD change last. Merge the PHY change first or advance the base once it lands.Current review update
On
1d5fa6357, native ARM64 built the ATC, Type-C mux and TIPD objects. The only TIPD compiler warning also appears on the unchanged base. The host disconnect scenarios passed 127 assertions with a scratch-only adjustment for ext26 model definitions that the unchanged base harness also lacks. The focused cases cover TBT/USB4 device-role selection, no fallback capability, a present router, and mux failure. A J773g rear Thunderbolt 3 dock run showing xHCI startup and USB2 device enumeration remains outstanding.The original contribution disclosed LLM assistance without naming a model.
Assisted-by: LLM (OpenAI:Codex)