Repository navigation
arm64: dts: apple: t8132, t8142: describe the USB-C ports as dual-role - #2511
RyanTheTide wants to merge 1 commit into
Conversation
The USB-C ports of the T8132 and T8142 Macs are dual-role: each port's controller is the dwc3 behind an ATC PHY, with a role switch driven by the port controller, and the T8132 SoC .dtsi already describes these controllers as dr_mode = "otg" with usb-role-switch. Several board files override that with dr_mode = "host" (T8132: t8132-jxxx.dtsi ports 0 and 1, J604 port 3, J624 ports 2 and 3, J773g port 3), and the T8142 J704 and J813 USB files describe every USB-C controller as host-only and every connector with data-role = "host". Nothing depends on the host-only values: dwc3-apple sets the controller's mode itself on every role change, and the port controller drivers do not read the connector's data-role. They only misdescribe the hardware. Drop the T8132 overrides, so the SoC's "otg" applies, and describe the T8142 controllers as "otg" and their connectors as "dual", as on the T8132 boards. The J773g's port 2, which feeds a fixed USB hub, stays host-only. Every T8132 and T8142 DTB changes only in these properties. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
There was a problem hiding this comment.
Approve after one T8132 boot.
I checked the claim that dr_mode and data-role are description only, and it holds. dwc3-apple overwrites dwc->dr_mode in dwc3_apple_set_role() before xHCI or the gadget starts, skip_core_init_mode keeps dwc3_drd_init() and dwc3_core_exit_mode() out of the path, and the only first-probe check (dwc3_core_set_initial_role()) refuses host only for peripheral. host_only comes from Kconfig and the compatible. The SN201202x takes its data capability from SYSTEM_CONF through tps6598x_register_port(); only the TPS25750 path reads DT data-role. The #2434 J773g log already shows dwc3_1 taking the device role while its DT said host.
J773g port 2 staying host with its fixed hub is right.
Before merge: one boot on a J773g or J713 with a device on each changed port, unplug and replug, no new dwc3 or role-switch lines. Every enabled T8132 controller had dr_mode = "host" until now, so this is the first time any of them probes with otg. The T8142 row can come after merge.
Two notes:
- #2434 and #2334 are still open. On this base a calibrated T8132 port in the device role still fails in atcphy_usb3_set_mode(). This PR is consistent with #2334 (device capability from the PHY, not DT) and does not depend on it, but "dual-role" on T8132 only works for USB2 until #2334 lands.
- j813.config builds CONFIG_USB_DWC3_HOST=y, so with otg in DT each J813/J815 controller now logs "Configuration mismatch. dr_mode forced to host" at first probe. Please switch that config to DUAL_ROLE in a follow-up, or mention the line in the row.
|
T8132 row on a J713 (M4 MacBook Air, 13"): PASS. The J713's DTB with this PR's change applied (
Not covered: SuperSpeed host (the hub is USB 2.0 only), a physical unplug (software PD rebind instead), and T8142. Details
Assisted-by: LLM (Claude:Opus 5.5) |
|
Merge-train adversarial review (MERGETRAIN-LINUX2) at f8c5e27: 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#2511 arm64: dts: apple: t8132, t8142: describe the USB-C ports as dual-role @f8c5e279VERDICT: NO BLOCKERS I verified the PR's claim that "nothing depends on the value":
Nits:
Missing rows (the PR lists them as still to run; none are done):
|
Problem. On the T8132 (M4) and T8142 (M5) Macs, every USB-C port is dual-role: a dwc3 controller behind an ATC PHY, with a role switch the port controller drives. Several board files still call these controllers host-only. The T8132 SoC
.dtsisetsdr_mode = "otg"withusb-role-switch, butt8132-jxxx.dtsi(ports 0 and 1), J604 port 3, J624 ports 2 and 3 and J773g port 3 override it withdr_mode = "host". On the T8142, the J704 and J813 USB files mark every USB-C controllerdr_mode = "host"and every connectordata-role = "host".Nothing depends on those values:
dwc3-applesets the controller's mode itself on every role change, and the port controller drivers don't read the connector'sdata-role. They only misdescribe the hardware.Change. Drop the T8132 overrides so the SoC's
otgapplies. On the T8142, describe the controllers asotgand the connectors asdual, matching the T8132 boards. J773g port 2 feeds a fixed USB hub and stays host-only.Testing. Every T8132 and T8142 DTB in the tree was built before and after and decompiled. Only these properties change:
dr_modehost -> otg on 3, 2, 4, 2, 2 and 3 controllersdr_modehost -> otg anddata-rolehost -> dual on 3, 2 and 2 portsdtc warnings are unchanged (the same pre-existing ones on J713, J813 and J815).
dt-validatewith the tree's schema reports 40 messages before and after, 0 new.Still to run. One boot per family with a USB device on each USB-C port, then unplug and replug: the device enumerates as before and
dmesgshows no new dwc3 or role-switch errors.Why dr_mode does not change runtime behaviour
drivers/usb/dwc3/dwc3-apple.cregisters its own role switch (dwc3_usb_role_switch_set). On a role change it writesdwc.dr_modeitself: host before core init on a new cable session, or host/peripheral from the switch's role. The DTdr_modeonly seeds the core's first probe, and the controller starts in host (role-switch-default-mode = "host", which stays). The T8132 boards J623, J713 and J715 get their ports 0 and 1 fromt8132-jxxx.dtsithrough the shared laptop/desktop files, so their DTBs change too.Assisted-by: LLM (Claude:Opus 5.5)