Repository navigation
phy: apple: atc, arm64: dts: apple: t8152-j873: enable rear USB host controllers and SuperSpeed switching - #3566
Conversation
Describe usb-drd0 (back-middle, 0x402430000, AIC IRQ 1621) and usb-drd3 (back-right, 0x412430000, AIC IRQ 1834) alongside usb-drd1 (back-left) and usb-drd2 (front internal hub), together with their DART instances (0x403020000/0x403040000, IRQ 1608 and 0x413020000/0x413040000, IRQ 1821) and PMGR power states (ps_atc0_usb at 0x120, ps_atc3_usb at 0x1e0). Drop the now-redundant two-window &dwc3_0_dart and &dwc3_3_dart overrides in t8152-j873g.dts, matching dwc3_1_dart and dwc3_2_dart. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
dwc3_get_extcon() walks phys[0]'s OF graph and calls extcon_find_edev_by_node() on the remote node, even on host- or peripheral-only controllers where dwc->edev is never used. When a host-only DWC3 controller (such as apple,t8152-dwc3) references a Type-C PHY whose OF graph points at a usb-c-connector, this fails probe with -ENODEV (when CONFIG_EXTCON is disabled) or defers indefinitely. Return NULL early from dwc3_get_extcon() whenever CONFIG_USB_DWC3_DUAL_ROLE is disabled or dr_mode explicitly selects host or peripheral mode. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Allow non-fixed-USB3 apple,t8152-atcphy Type-C nodes to describe the optional USB3 PIPE handler register bank alongside core so they can switch between USB3 SuperSpeed and USB4/CIO modes. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Extend T8152 Type-C PHY handling in phy-apple-atc to switch cleanly between OFF, USB3 SuperSpeed (normal and reversed plug orientations), and USB4/CIO while preserving DisplayPort alt-mode arbitration with the display driver: - Map the optional pipehandler window and parse optional apple,tunable-lane0-usb / apple,tunable-lane1-usb lists on T8152 Type-C PHYs. When either is absent (older DTB or bootloader), USB3 falls back to USB2 without affecting USB4 or DisplayPort. - Power up lane 0 for normal USB3, lane 1 for reversed USB3, and both lanes for CIO in atcphy_lanes_up_t8152(); power both lanes down on shutdown. - Register the USB3 PHY provider on T8152 Type-C PHYs with a pipehandler and coordinate xHCI's SuperSpeed root port power off/on around PIPE handover and mode transitions, finding the plain apple,t8152-dwc3 host controller via its phys phandle. - Add KUnit coverage for T8152 reversed USB3 lane setup and Type-C USB3 target-mode mapping. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Describe the USB3 PIPE handler register banks (0x402414000, 0x40a414000, 0x412414000) on atc0_phy, atc1_phy and atc3_phy, attach each rear controller (usb0, usb1, usb3) to its ATC USB3 PHY, and drop the high-speed cap. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
There was a problem hiding this comment.
Verdict: MERGE at 74b7061e (once queued CI checks pass; companion to aura#565)
Blockers: none
Checked:
- Audited all 5 commits (
89cc67b1..74b7061e) across all 6 touched files (+507/-145); zero code blockers found. - Verified
drivers/usb/dwc3/core.c(dwc3_get_extcon()):dwc->edevis consumed strictly by the OTG dual-role paths (dwc3_drd.c/dwc3_core_set_initial_role()), so returningNULLwhen!IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) || (dr_mode != USB_DR_MODE_OTG && dr_mode != USB_DR_MODE_UNKNOWN)is a no-op for OTG controllers while preventing host/peripheral-only controllers behind a Type-C PHY from treating the PHY's connector graph as an extcon. - Verified
drivers/phy/apple/atc.cT8152 Type-C USB3/CIO switching:atcphy_lane_mask_t8152()selects lane 0 (normal) or lane 1 (reversed) for USB3 and both lanes for CIO;atcphy_lanes_down_t8152()powers both lanes down on Type-C ports.atcphy_load_tunables()treatslane_usb3[0..1]as optional oncio_onlyports (ss_tunables = !ss_missing,usb3_tunables = !ss_missing && !usb3_missing), so older Aura builds without USB3 lane tunables keep USB4/CIO working and gracefully fall back to USB2 for USB3.atcphy_cio_mux_set()coordinatesatcphy_usb3_pm_get()/port_off/port_onoutsideatcphy->lock, parks the PIPE handler inatcphy_cio_stop()before power-down, andatcphy_find_usb3_controller()balances OF device-node references properly.
- Verified
Documentation/devicetree/bindings/phy/apple,atcphy.yaml,t8152-j873-usb.dtsi,t8152-j873g.dts, and KUnit tests (atcphy_test_cio_target_mode+atcphy_test_t8152_usb3_reversed_lanes). - Verified exact-head
J873g(mini6) hardware row at74b7061epaired withaura#565265e443c(all 4 USB hosts active, VL817 SSD 10000M339-347 MB/s, VIA hub + RTL8153 GbE 5000M, runtimeUSB3 -> OFF -> USB3switch cycle viasn201202xunbind/bind, front VL822 hub 10000M, 0 failed units, 0 DART faults) and PR text (What/Tested/Risktwo-way door).
Evidence
drivers/usb/dwc3/core.c:2016-2035anddrivers/usb/dwc3/drd.c: alldwc->edevreferences sit inside DRD/OTG role selection; host-only and peripheral-only modes never usedwc->edev.drivers/phy/apple/atc.c:atcphy_find_usb3_controller()dropsargs.npbefore pointer comparison and returnsctrlwith itsfor_each_compatible_node()ref held for the caller's__free(device_node).drivers/phy/apple/atc-test.c: coversTYPEC_STATE_USB,EUDO_USB_MODE_USB3/USB4/USB2, and reversed USB3 lane 1 power-up, crossbar0x111,ATCPHY_T8152_MISC_LANE_SWAP, and lane power-down.
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
J716c (16-inch M5 Max, not T8152) at EvidenceBatched kernel
0 DART faults, no new USB or PHY errors, failed units: |
Update the host test's mock struct apple_atcphy with the cio_only and usb3_tunables flags added for T8152 Type-C SuperSpeed switching so host-tests compiles cleanly. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
There was a problem hiding this comment.
Verdict: MERGE at c7170a5e
Blockers: None (wait for queued hosted CI checks at c7170a5e to pass before merge).
Checked: Commit c7170a5e (tools/asahi/atc-usb3-tests.py), driver and DTS files unchanged from approved 74b7061e, DCO sign-off, J873g hardware row, and J716c non-regression row.
Evidence
- Delta
74b7061e..c7170a5e(tools/asahi/atc-usb3-tests.py,+1/-1, test-only):- Adds
cio_only, usb3_tunablesto the mockstruct apple_atcphyso hostedhost-testscompiles cleanly. - All driver (
drivers/phy/apple/atc.c,atc-test.c,drivers/usb/dwc3/core.c), binding, and J873g DTS files are byte-identical to approved74b7061e(with exact-head J873g row and J716c non-regression row).
- Adds
- Hygiene: DCO
Signed-off-by:present;MERGEABLEonmain. Companion toaura#565.
Add usb3_tunables, cio_only, and regs.pipehandler to the apple-dcp host selftest mock struct apple_atcphy definitions (phy.py, quiesce.py, dwc3/mocks.c) and provide atcphy_find_usb3_controller() in pm.py so all apple-dcp host-tests compile and pass cleanly. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
There was a problem hiding this comment.
Verdict: MERGE at 193cf0d5
Blockers: None (await queued hosted CI checks to complete green before merge).
Checked:
- Audited commit
193cf0d5(selftests/apple-dcp: update mock apple_atcphy for T8152 USB3 switching, DCOSigned-off-by:present): strictly test-only updates acrosstools/testing/selftests/drivers/gpu/apple-dcp/{dwc3/mocks.c,phy.py,pm.py,quiesce.py}addingusb3_tunables,cio_only, andregs.pipehandlerto the mockstruct apple_atcphylayouts and providingatcphy_find_usb3_controller()inpm.py(with__free(device_node)cleanup). - Zero driver or DTS changes relative to previously approved
74b7061e/c7170a5e.
Evidence
tools/testing/selftests/drivers/gpu/apple-dcp/{dwc3/mocks.c,phy.py,pm.py,quiesce.py}: verified mock struct fields andatcphy_find_usb3_controller()stub matchdrivers/phy/apple/atc.c.- Prior J873g + J716c hardware rows remain valid as driver and DTS diffs are byte-identical to
74b7061e.
|
Updated |
|
Hardware row at |
Pick up unrelated CI harness fixes on main; no changes to PR files. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
|
Forward-merged Hardware row at |
|
Held during the parent-first merge pass at |
If USB3 PIPE routing fails in atcphy_cio_start(), pipe_state stays at ATCPHY_PIPEHANDLER_STATE_DUMMY while pipe_pending remains set. Without checking pipe_pending, atcphy_cio_stop() skipped parking the pipehandler and atcphy_configure(APPLE_ATCPHY_MODE_OFF) wedged returning -EBUSY. Check pipe_pending alongside pipe_state != DUMMY in atcphy_cio_stop() and reject pipe_pending in atcphy_cio_in_mode(), and add KUnit test atcphy_test_t8152_pipe_pending_rollback covering the rollback path. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
|
@DjDeveloperr Moved the
Verified locally at
|
|
Hardware row at
Details
|
RyanTheTide
left a comment
There was a problem hiding this comment.
Approve at bd6e79c under the merge bar. Enables J873g's rear USB host controllers and SuperSpeed switching. The pipe_pending rollback fix and its KUnit regression test moved here as Dj asked. Hosted CI 16/16 green, 53/53 KUnit, exact-head J873g row: 4/4 ATC PHYs and 4/4 DWC3/xHCI bound.
What: Enable all three rear USB host controllers on T8152/J873g (
usb0,usb1,usb3) and add native USB3 SuperSpeed switching (normal and reversed plug orientations) tophy-apple-atcalongside existing USB4/CIO and DisplayPort alt-mode arbitration. Companion bootloader PR: aurora-silicon/aura#565.Tested: J873g M6 Mac mini (
mini6) at74b7061e457b(kernel7.3.0-aurora-j873-main-1127+, clean default boot, paired with Aura265e443c): all 4 USB hosts active, both normal (lane 0) and reversed (lane 1) orientations + physical hot-swap verified on back-left and back-right ports (VL817 SSD at 10000M, 331–347 MB/s direct read; VIA hub + RTL8153 GbE at 5000M, IPv4/IPv6 + ping 3/3 0% loss), runtimeUSB3 -> OFF -> USB3cycle viasn201202xunbind/bind verified cleanly, front VL822 hub at 10000M, 12 CPUs,speakerguarddactive, 0 failed units, 0 DART faults.Risk: two-way door · T8152 (J873g);
dwc3_get_extcon()guard touches shareddrivers/usb/dwc3/core.cfor host/peripheral-only DWC3 controllers (no-op for OTG).Not yet: Live USB3 <-> USB4 / DisplayPort alt-mode swap on a rear port, and non-T8152 DWC3 boards.
Details
arm64: dts: apple: t8152-j873g: enable USB2 host on all rear ports(89cc67b1b7ab):usb0(0x402430000, IRQ 1621) andusb3(0x412430000, IRQ 1834), their paired DARTs (dwc3_0_dart/dwc3_0_dart_1IRQ 1608,dwc3_3_dart/dwc3_3_dart_1IRQ 1821), and PMGR states (ps_atc0_usb0x120,ps_atc3_usb0x1e0).&dwc3_0_dartand&dwc3_3_dartblocks fromt8152-j873g.dts.usb: dwc3: skip extcon lookup when OTG is not in use(9dba91bccddc):NULLfromdwc3_get_extcon()whenCONFIG_USB_DWC3_DUAL_ROLEis disabled ordr_modeexplicitly selects host or peripheral mode, preventing host-only controllers referencing a Type-C PHY with an OF graph connector link from failing probe with-ENODEVor deferring forever.dt-bindings: phy: apple,atcphy: allow pipehandler on T8152 Type-C PHYs(d66fda4fa1ac):pipehandlerbank on non-apple,fixed-usb3apple,t8152-atcphynodes.phy: apple: atc: support USB3 SuperSpeed switching on T8152 Type-C PHYs(38ade51065d2):pipehandlerand parse optionalapple,tunable-lane0-usb/apple,tunable-lane1-usbon T8152 Type-C PHYs; when absent (older DTB or bootloader), USB3 stays USB2 while USB4/CIO and DisplayPort continue unchanged.atcphy_lanes_up_t8152(), and power both lanes down on shutdown.PHY_TYPE_USB3whenpipehandleris present and coordinate xHCI SuperSpeed root port power off/on around PIPE handover and mode transitions (resolvingapple,t8152-dwc3via itsphysphandle).display_owned/cio_poweredarbitration witht8152_atc.c.atc-test.c.arm64: dts: apple: t8152-j873: enable SuperSpeed on rear USB-C ports(74b7061e457b):pipehandlerbanks (0x402414000,0x40a414000,0x412414000) onatc0_phy/atc1_phy/atc3_phy, attachusb0/usb1/usb3viaphys = <&atcN_phy PHY_TYPE_USB3>, and removemaximum-speed = "high-speed".Evidence
checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks on all 5 commits.CHECK_DTBS=yonapple/t8152-j873g.dtbagainstphy/apple,atcphy.yaml,usb/apple,dwc3.yaml,iommu/apple,dart.yaml: 0 warnings.apple-dart-pd-check.py: 0 findings on USB DARTs../tools/testing/kunit/kunit.py run --arch=arm64 --kunitconfig=drivers/phy/apple/.kunitconfig.apple-atc --make_options LLVM=1 'phy-apple-atc*'): 51/51 passed (including 9/9phy-apple-atc-t8152subtests).mini6) clean default boot (aurora,trialabsent, default kernel command line):xbar=0x111,misc=0x1800002,ln0=0x1,ln1=0x3e,pipe_mux=0x10):40a430000.usb, back-left):2109:0715VL817 SSD at 10000M, direct read 339–347 MB/s.412430000.usb, back-right):2109:0815VIA USB3.0 hub +0bda:8153RTL8153 GbE (enx00e04c682e37) at 5000M, IPv4/IPv6 up, ping 3/3 0% loss (avg 0.581 ms).xbar=0x110,misc=0x1800000,ln0=0x3e,ln1=0x1,pipe_mux=0x10):40a430000.usb, back-left):2109:0815VIA USB3.0 hub +0bda:8153RTL8153 GbE (enx00e04c682e37) at 5000M, IPv4/IPv6 up, ping 3/3 0% loss (avg 0.779 ms).412430000.usb, back-right):2109:0715VL817 SSD at 10000M, direct read 331 MB/s.sn201202x1-0aunbind/bind): PIPE parked,atc1_common/dp_0/dp_1powered off (off-0), rebind broughtatc1_commonbackonand re-enumerated2109:0715at 10000M with 0 errors.nproc= 12,systemctl --failed= 0 units,speakerguarddactive, 0 DART faults, 0 USB/PIPE/BIST errors.