Skip to content

arm64: apple: t8152-j873g: rear USB-C ports USB2/USB3/USB4/TBT/DP-altmode boot & hotplug - #3617

Merged
DjDeveloperr merged 23 commits into
mainfrom
feat/j873-rear-ports
Dec 1, 2026
Merged

DjDeveloperr merged 23 commits into
mainfrom
feat/j873-rear-ports

Conversation

@sithglan

@sithglan sithglan commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What:
Stacked on #3613 (feat/t8152-j873-dpaudio) and paired with aurora-silicon/aura#565.

Enable full Thunderbolt/USB4, USB2, USB3 SuperSpeed, and DisplayPort Alt Mode on all three rear USB-C ports of Mac mini M6 (J873g, T8152 — ATC0 back-middle, ATC1 back-left, ATC3 back-right) across cold boot and physical hotplug:

  • USB2 host + hotplug: Enable usb0/usb1/usb3 (apple,t8152-dwc3), skip dwc3_get_extcon() when OTG is unused, wire usb2phy/usb2evt banks on atc0_phy/atc1_phy/atc3_phy, and re-synchronize the eUSB2 host PHY with its external repeater on Type-C disconnect/reconnect (and empty-port attach).
  • USB3 SuperSpeed + TBT3/USB4 + Pin D concurrency: Wire pipehandler on atc0_phy/atc1_phy/atc3_phy, add T8152 USB3 SuperSpeed switching, TBT3/USB4 PIPE routing, safe pipe_pending rollback, and concurrent Pin B/D/F 2-lane DP + USB3 SuperSpeed lane bring-up/teardown with port-off/park error propagation and partial-rollback retry in phy-apple-atc.
  • DP Alt Mode hotplug & sleep wake: Coordinate Pin D USB3 and clean PHY/ownership handover in t8152_atc.c / iboot_drm.c / iomfb_iboot.c (propagating and retrying deactivate/select/activate errors and retaining power/ownership on failed park or phy_power_off()), force lane restart when AUX0 crossbar borrowing set needs_retrain, and track HPD drop epochs in t8152_typec.c so active-stream wake-up HPD bounces cleanly reconnect while idle 160 ms pulses stay ignored.

Tested:

  • Mac mini M6 (J873g, T8152, macOS 27.2 firmware) at exact head 1e8cadcc92bf (paired with aura#565 d1d7ca31, default cmdline): PASS — 0 failed units, 0 WARNING:/Call trace/DART faults, all 4 xHCI hosts (Bus 001..008) up, card0-DP-1 HDMI 2560x1440, DisplayPort audio streaming (32a140000 IRQ 112 0 -> 20), live audio-controller-1 unbind/bind, and post-rebind streaming (20 -> 40).
  • Attached rear USB-C matrix verified on J873g at 460f8ea4bda8 / 0ea9645cba84: phy-apple-atc 413000000.phy: USB3 SuperSpeed active alongside 2-lane DP (lane 1) with sleeping Eizo EV2780 cold-boot & empty-port hotplug (Bus 007 480M + Bus 008 5000M + 2560x1440 DP + DP audio), plus USB4 NVMe (ASM2464PD + 980 PRO) hotplug on ATC1 at 40 Gb/s CL0 (2.7 GB/s read) concurrently with Eizo on ATC3.
  • Local automated checks at exact head 1e8cadcc92bf: phy-apple-atc* arm64 KUnit 71/71 passed, tools/asahi/atc-usb3-tests.py --cc gcc --mutations 39/39 passed (all mutations killed), apple-dcp selftests (phy.py 13/13, quiesce.py 19/19, audio.py PASS), display.kunitconfig arm64 KUnit 174/174 passed, dt_binding_check / CHECK_DTBS=y apple/t8152-j873g.dtb / checkpatch.pl --strict 0/0/0.

Risk: two-way · T8152 (J873g) rear USB-C ports (phy-apple-atc, dwc3/core.c non-OTG extcon skip, drm/apple T8152 iBoot display/Type-C).

Not yet:

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>
…n T8152

Extend T8152 Type-C PHY mode switching so all rear USB-C ports support
Thunderbolt 3, USB4 (with tunneled USB3 PIPE routing), standalone USB3,
and simultaneous Pin B/D/F USB3 SuperSpeed alongside 2-lane DisplayPort
on boot and hotplug:

- Allow APPLE_ATCPHY_MODE_TBT alongside APPLE_ATCPHY_MODE_USB4 in
  atcphy_cio_start().
- Route the PIPE handler to ATCPHY_PIPEHANDLER_STATE_USB4 in USB4 mode
  (and coordinate xHCI SuperSpeed root port power off/on across both
  USB3 and USB4 PIPE transitions).
- Convert -EAGAIN from atcphy_usb3_pm_get() in atcphy_cio_mux_set() to
  -ETIMEDOUT so tipd retries cleanly if Type-C probes before xhci-hcd
  registers its SuperSpeed root hub.
- Implement DP PHY set_mode() to bring up and tear down the unused PMA
  and PIPE handler for SuperSpeed USB3 alongside an active 2-lane DP
  link (Pin B/D/F) without touching DPPLL, AUX, or the DP PMA.
- Add KUnit coverage for TBT/USB4 PIPE selection and Pin D lane setup.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
… ATC ports

Coordinate T8152 USB-C DisplayPort activation/deactivation with the ATC
PHY's USB3/USB4/TBT modes for reliable boot and hotplug transitions:

- Notify the ATC DP PHY of the active lane count via phy_set_mode_ext()
  after atc_activate() (and when adopting a bootloader link), and park
  it with PHY_MODE_INVALID before atc_deactivate() tears down the common
  block so Pin B/D/F USB3 SuperSpeed can run alongside 2-lane DP.
- Retry cleanly on -EBUSY from disp->phy->activate() in
  iboot_connector_detect() when DP hotplug races USB3/USB4/TBT teardown.
- Always deactivate the PHY on unplug even if ibootep_set_power(false)
  returns an error, and immediately release atc_owner[] once the Type-C
  sink is gone.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Allow T8152 Type-C PHYs to describe their usb2phy and usb2evt register
banks alongside core and pipehandler so Linux can re-synchronize the
eUSB2 host PHY with its external repeater across Type-C hotplug.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
On T8152 rear Type-C ports, the PD controller resets the port's external
eUSB2 repeater out-of-band on every physical CC disconnect/reconnect.
Because the USB2 host controllers stay running across hotplug, the SoC
eUSB2 PHY becomes desynchronized from the repeater (HOSTDISCONNECT
latched in USB2PHY_SIG) and USB2 devices fail to enumerate after a
physical unplug/replug or into a port that was empty at boot.

Map the optional usb2phy and usb2evt banks on T8152 Type-C PHYs and
power-cycle the eUSB2 PHY back into host mode in atcphy_set_orientation()
when reconnecting after disconnect or when HOSTDISCONNECT is latched,
while leaving live boot connections untouched. Add a KUnit test covering
boot, hotplug disconnect/reconnect, and empty-port attach.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
…plug

Add the usb2phy and usb2evt register banks to atc0_phy, atc1_phy, and
atc3_phy on J873g so the ATC PHY driver can re-synchronize the eUSB2
host PHY with each port's external repeater on physical Type-C hotplug.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
When a sleeping USB-C monitor (such as an Eizo EV2780) wakes up after a
live video stream starts, it finishes initializing ~3.5 seconds later by
emitting a long HPD low->high pulse that clears its DPCD link registers
and expects the source to retrain. Previously, t8152_typec.c dropped
these pulses to avoid looping on an idle monitor's periodic 160 ms HPD
pulses, leaving the freshly awakened monitor black until it returned to
sleep.

Track HPD drop epochs in t8152_typec.c and trigger a rate-limited clean
reconnect in iboot_connector_detect() only when the display is actively
driving a mode (ib->powered && ib->mode_set), while still ignoring idle
HPD pulses. Also force a full lane restart in atc_set_link_rate() when a
prior AUX0 crossbar borrow set needs_retrain, and prefer matching the
exact timing mode flags when restoring cur_mode.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan
sithglan marked this pull request as ready for review November 29, 2026 10:44
@sithglan
sithglan requested review from a team as code owners November 29, 2026 10:44

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FIX, then re-review at 0ea9645c
Blockers:

  1. pipe_pending port wedge on USB3 PIPE routing failure (drivers/phy/apple/atc.c L5785–5792, L5850–5856, L7184–7186): atcphy_configure_pipehandler() sets atcphy->pipe_pending = true before atcphy_configure_pipehandler_usb3() (L2262) and only clears it on success (L2279). If atcphy_configure_pipehandler(atcphy, true) fails in atcphy_cio_start() (L5850), atcphy->pipe_state remains ATCPHY_PIPEHANDLER_STATE_DUMMY while atcphy->pipe_pending remains true. atcphy_cio_start() then calls atcphy_cio_stop() (L5854), whose guard (atcphy->pipe_state != ATCPHY_PIPEHANDLER_STATE_DUMMY, L5786) omits || atcphy->pipe_pending. As a result, atcphy_cio_stop() skips atcphy_park_pipehandler() and calls atcphy_configure(atcphy, APPLE_ATCPHY_MODE_OFF) (L5793), which fails with -EBUSY (L4573 if (atcphy->pipe_pending) return -EBUSY;), leaving cio_powered = true and pipe_pending = true permanently wedged (blocking subsequent atcphy_cio_stop(), atcphy_configure(), and atcphy_cio_dp_power_on()). Check atcphy->pipe_state != ATCPHY_PIPEHANDLER_STATE_DUMMY || atcphy->pipe_pending in both atcphy_cio_stop() (L5786) and atcphy_cio_dp_usb3_stop() (L7185), reject pipe_pending in atcphy_cio_in_mode(), and add a KUnit test covering failed USB3 PIPE routing recovery.
  2. Pin D USB3 silent deferral loss on boot-order race (drivers/phy/apple/atc.c L7095–7099, L7334–7339): While atcphy_cio_mux_set() converts -EAGAIN from atcphy_usb3_pm_get() to -ETIMEDOUT (L7289) so tipd retries before xhci-hcd registers its SuperSpeed root hub, atcphy_cio_dp_usb3_sync() (void) silently returns on atcphy_usb3_pm_get() failure (-EAGAIN) and dp_usb3_only: returns 0 (L7339). Once host_active and dp_lanes == 2 are already set, nothing retries atcphy_cio_dp_usb3_sync(), leaving Pin D SuperSpeed USB3 absent until unplug/replug. Propagate the error from atcphy_cio_dp_usb3_sync() (converting -EAGAIN to -ETIMEDOUT in atcphy_cio_mux_set()) or schedule a retry.
  3. Stacked base & CI: Stacked on linux#3613 (feat/t8152-j873-dpaudio, which currently has requested changes and conflicts with main); hosted CI (DWC3/ATC, kunit, pr-text, readiness) is still queued and needs to pass once #3613 lands and #3617 is retargeted to main (with the J873g verification row referencing the final head SHA).
    Checked: All 11 modified files across Documentation/devicetree/bindings/phy/apple,atcphy.yaml, arch/arm64/boot/dts/apple/t8152-j873-usb.dtsi, t8152-j873g.dts, drivers/usb/dwc3/core.c, drivers/phy/apple/atc.c, atc-test.c, drivers/gpu/drm/apple/iboot_drm.c, iomfb_iboot.h, t8152_atc.c, t8152_display.h, and t8152_typec.c at 0ea9645c.
Evidence
  • Verified clean parts:
    • drivers/usb/dwc3/core.c: skipping dwc3_get_extcon() when !IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) or explicit host/peripheral dr_mode is safe (dwc->edev is only consumed for USB_DR_MODE_OTG / DWC3_GCTL_PRTCAP_OTG in core.c and drd.c).
    • drivers/phy/apple/atc.c & atc-test.c: T8152 atcphy_lane_mask_t8152() (normal lane 0, reversed lane 1, CIO both), atcphy_t8152_usb2_reset() + HOSTDISCONNECT / usb2_need_reset hotplug sequencing (preserving live boot USB2 connections), atcphy_find_usb3_controller() apple,t8152-dwc3 phandle lookup, and all 4 new KUnit cases are clean.
    • drivers/gpu/drm/apple/t8152_typec.c, t8152_atc.c, iboot_drm.c: HPD drop-epoch tracking (hpd_seq) rate-limited to active streams (ib->powered && ib->mode_set, max 2 retries per 30 s), -EBUSY activate retry, unconditional PHY deactivate on unplug, immediate atc_owner[] release, needs_retrain full lane restart in atc_set_link_rate(), and timing-mode flags matching are clean.
    • Documentation/devicetree/bindings/phy/apple,atcphy.yaml & J873g DTS: pipehandler/usb2phy/usb2evt reg banks, usb0/usb1/usb3 + split DARTs (dwc3_0_dart_1, dwc3_3_dart_1) and ps_atc0_usb/ps_atc3_usb power states match the existing usb1/usb2 structure.

… host test

Address review blockers and host-tests compilation on the T8152 Type-C
USB3/CIO path:

- Check pipe_pending alongside pipe_state != DUMMY in atcphy_cio_stop()
  and atcphy_cio_dp_usb3_stop(), and reject pipe_pending in
  atcphy_cio_in_mode(), so a failed USB3 PIPE routing in
  atcphy_cio_start() parks the pipehandler instead of wedging at -EBUSY.
- Add KUnit test atcphy_test_t8152_pipe_pending_rollback covering the
  failed USB3 PIPE routing rollback path.
- Return int from atcphy_cio_dp_usb3_sync() and propagate errors (mapping
  -EAGAIN to -ETIMEDOUT) in atcphy_cio_mux_set() on the dp_usb3_only
  path so tipd retries when xhci-hcd has not registered its SuperSpeed
  root hub yet.
- Add cio_only and usb3_tunables to tools/asahi/atc-usb3-tests.py's mock
  struct apple_atcphy.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan

Copy link
Copy Markdown
Contributor Author

Addressed all blockers in 8e4e3b77b6c0 + merge commit 0dc1623d4f6e:

  1. pipe_pending port wedge (drivers/phy/apple/atc.c, atc-test.c): Added || atcphy->pipe_pending in both atcphy_cio_stop() and atcphy_cio_dp_usb3_stop(), rejected pipe_pending in atcphy_cio_in_mode(), and added KUnit test atcphy_test_t8152_pipe_pending_rollback (phy-apple-atc*: 68/68 PASS).
  2. Pin D USB3 deferral propagation (drivers/phy/apple/atc.c): Changed atcphy_cio_dp_usb3_sync() to return int and propagated errors (mapping -EAGAIN to -ETIMEDOUT) on atcphy_cio_mux_set()'s dp_usb3_only: path.
  3. Host test + stack sync (tools/asahi/atc-usb3-tests.py): Added cio_only and usb3_tunables to mock struct apple_atcphy (atc-usb3-tests.py --mutations: 39/39 PASS, all mutations killed), merged updated feat/t8152-j873-dpaudio (b119fa9cecaa) cleanly at 0dc1623d4f6e, and updated the PR body to match pr-text.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at 0dc1623d — both Round 215 code blockers (pipe_pending rollback wedge and Pin D USB3 -EAGAIN deferral propagation) and the atc-usb3-tests.py mock struct fix are cleanly resolved in 8e4e3b77; awaiting base PR #3613 landing + retarget to main, green hosted CI, and an exact-head J873g hardware row.
Blockers:

  1. Land stacked base PR linux#3613 (feat/t8152-j873-dpaudio) and retarget #3617 to main.
  2. Wait for hosted CI (DWC3/ATC, kunit, host-tests, pr-text, readiness) to pass on the final main-based head.
  3. Post a J873g verification row referencing the final head SHA after 8e4e3b77.
    Checked: Commit 8e4e3b77 (drivers/phy/apple/atc.c, drivers/phy/apple/atc-test.c, tools/asahi/atc-usb3-tests.py) and merge commit 0dc1623d.
Evidence
  • Code blockers resolved (8e4e3b77):
    • drivers/phy/apple/atc.c: atcphy_cio_stop() and atcphy_cio_dp_usb3_stop() now check (atcphy->pipe_state != ATCPHY_PIPEHANDLER_STATE_DUMMY || atcphy->pipe_pending) before parking, and atcphy_cio_in_mode() returns false when atcphy->pipe_pending is set. New KUnit test atcphy_test_t8152_pipe_pending_rollback verifies recovery without -EBUSY wedge (phy-apple-atc* 68/68 PASS).
    • drivers/phy/apple/atc.c: atcphy_cio_dp_usb3_sync() now returns int (mapping -EOPNOTSUPP to -ENODEV on port-off and preserving port_on errors) and atcphy_cio_mux_set()'s dp_usb3_only: path propagates the error with -EAGAIN -> -ETIMEDOUT so tipd retries when xhci-hcd has not yet registered its SuperSpeed root hub.
    • tools/asahi/atc-usb3-tests.py: adds cio_only, usb3_tunables to the mock struct apple_atcphy.
  • Nit (non-blocking): Merge commit 0dc1623d omits a Signed-off-by: trailer; include DCO sign-off on any final merge commit when retargeting to main.

…dcp mocks

Address follow-up review blockers and host-tests compilation on T8152
rear Type-C ports:

- Check TYPEC_STATE_SAFE before USB_TYPEC_TBT_SID in
  atcphy_cio_target_mode() so SAFE always maps to APPLE_ATCPHY_MODE_OFF.
- Make atcphy_cio_dp_usb3_stop() return int and refuse to power down
  the USB3 lane or clear dp_usb3_active when atcphy_park_pipehandler()
  fails (same guard in atcphy_cio_dp_usb3_sync() rollback), propagating
  the error in atcphy_cio_dp_power_off(), atcphy_cio_dp_set_mode(), and
  atcphy_cio_mux_set().
- Propagate atcphy_cio_dp_usb3_sync() errors (including -EAGAIN) from
  atcphy_cio_dp_set_mode() instead of returning 0.
- Add KUnit coverage for TBT+SAFE precedence and failed PIPE park
  during Pin D USB3 teardown (phy-apple-atc* 69/69 PASS).
- Update apple-dcp host selftest mock structs and helpers (pm.py,
  phy.py, quiesce.py, dwc3/mocks.c) for T8152 USB3/USB2 fields.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan

Copy link
Copy Markdown
Contributor Author

Addressed all follow-up blockers and selftests in fb450c0650aa + DCO-signed merge 9fe042aa76fb (merging feat/t8152-j873-dpaudio ed0fdb178ef5):

  • atcphy_cio_target_mode(): check TYPEC_STATE_SAFE before USB_TYPEC_TBT_SID (+ KUnit assertion).
  • atcphy_cio_dp_usb3_stop() / atcphy_cio_dp_usb3_sync() rollback: return int and refuse to power down the USB3 lane or clear dp_usb3_active if atcphy_park_pipehandler() fails (+ KUnit atcphy_test_t8152_dp_usb3_stop_park_fail).
  • atcphy_cio_dp_set_mode(): propagate atcphy_cio_dp_usb3_sync() / atcphy_cio_dp_usb3_stop() errors instead of returning 0.
  • Updated apple-dcp host selftest mocks (pm.py, phy.py, quiesce.py, dwc3/mocks.c) for T8152 USB3/USB2 fields: phy 13/13, quiesce 19/19, atc-usb3-tests.py 39/39, phy-apple-atc* KUnit 69/69 PASS, checkpatch --strict 0/0/0.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FIX, then re-review at 9fe042aa

Blockers:

  1. atc_deactivate() ignores phy_set_mode_ext(atc->phy, PHY_MODE_INVALID, 0) failure (drivers/gpu/drm/apple/t8152_atc.c L487–527): fb450c06 now properly returns an error from atcphy_cio_dp_usb3_stop() / atcphy_cio_dp_set_mode() and refuses to power down the USB3 lane or clear dp_usb3_active when atcphy_park_pipehandler() fails, and refuses to drop power domains in atcphy_cio_dp_power_off(). However, atc_deactivate() discards the return value of phy_set_mode_ext(atc->phy, PHY_MODE_INVALID, 0) at L487, so if PIPE parking fails it still powers down ATC_AON and puts ATC_CFG into small-sleep under an unparked USB3 PIPE, sets atc->active = false at L514, and then hits phy_power_off() failure at L516 — leaving display_owned = true and phy->power_count = 1 permanently stranded (while L523–527 also clears atc_owner[atc->index] = NULL and future atc_deactivate() calls short-circuit on !atc->active). Abort atc_deactivate() before touching the common block when phy_set_mode_ext(atc->phy, PHY_MODE_INVALID, 0) returns a non-zero error (other than -EOPNOTSUPP), matching the existing atc_dp_stop() early return at L488, and avoid releasing atc_owner if phy_power_off() fails.
  2. Stacked base & merge readiness: Land base PR linux#3613 (feat/t8152-j873-dpaudio) and retarget #3617 to main.
  3. CI & exact-head hardware evidence: Wait for hosted CI (source, pr-text, kunit, DWC3/ATC, host-tests, readiness) to pass on the final main-based head, and post a J873g hardware verification row referencing the exact final head SHA.

Checked:

  • Verified fb450c06 in drivers/phy/apple/atc.c and drivers/phy/apple/atc-test.c: TYPEC_STATE_SAFE now precedes USB_TYPEC_TBT_SID in atcphy_cio_target_mode(); atcphy_cio_dp_usb3_stop() and atcphy_cio_dp_usb3_sync() rollback keep the USB3 lane up and dp_usb3_active set if atcphy_park_pipehandler() fails; atcphy_cio_dp_power_off(), atcphy_cio_dp_set_mode(), and both paths of atcphy_cio_mux_set() propagate stop/sync errors cleanly; KUnit cases cover both fixes.
  • Verified apple-dcp host selftest mock updates (dwc3/mocks.c, phy.py, pm.py, quiesce.py) and clean DCO-signed merge 9fe042aa of feat/t8152-j873-dpaudio (ed0fdb17).
Evidence
  • drivers/phy/apple/atc.c L5998–6001: TYPEC_STATE_SAFE checked before USB_TYPEC_TBT_SID; covered by atcphy_test_cio_target_mode().
  • drivers/phy/apple/atc.c L7264–7281, L7308–7353: atcphy_cio_dp_usb3_sync() rollback and atcphy_cio_dp_usb3_stop() guard atcphy_cio_dp_usb3_lane_down() / dp_usb3_active = false on !park_ret / !ret; covered by atcphy_test_t8152_dp_usb3_stop_park_fail().
  • drivers/gpu/drm/apple/t8152_atc.c L487: phy_set_mode_ext(atc->phy, PHY_MODE_INVALID, 0); return value discarded before L493–514 common-block teardown and L516 phy_power_off(atc->phy) / L523–527 atc_owner release.
  • git merge commit 9fe042aa76fb46b694bb540ab6cb32ecf2f9f66e: parents fb450c06 + ed0fdb17, DCO-signed, zero conflicts.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FIX, then re-review at 460f8ea4

Blockers:

  1. atc_deactivate() still ignores phy_set_mode_ext(atc->phy, PHY_MODE_INVALID, 0) failure (drivers/gpu/drm/apple/t8152_atc.c L487–527): Carried forward from 9fe042aa (460f8ea4 only merges e4f3bebf from feat/t8152-j873-dpaudio). Because L487 discards the return value of phy_set_mode_ext(atc->phy, PHY_MODE_INVALID, 0), a failed PIPE park in atcphy_cio_dp_usb3_stop() still allows atc_deactivate() to power down ATC_AON and put ATC_CFG into small-sleep under an unparked USB3 PIPE, clear atc->active = false (L514), hit phy_power_off() failure (L516), and clear atc_owner[atc->index] = NULL (L523–527) while leaving display_owned = true and phy->power_count = 1 permanently stranded. Abort atc_deactivate() before touching the common block when phy_set_mode_ext(atc->phy, PHY_MODE_INVALID, 0) returns a non-zero error (other than -EOPNOTSUPP), and do not clear atc_owner if phy_power_off() fails.
  2. Stacked base & merge readiness: Land base PR linux#3613 (feat/t8152-j873-dpaudio) and retarget #3617 to main.
  3. CI & exact-head hardware evidence: Wait for hosted CI (source, pr-text, kunit, DWC3/ATC, host-tests, readiness) to pass on the final main-based head, and post a J873g hardware verification row referencing the exact final head SHA.

Checked:

  • Verified 9fe042aa..460f8ea4 is solely a clean, conflict-free DCO-signed merge of feat/t8152-j873-dpaudio (e4f3bebf, drivers/gpu/drm/apple/audio.c +13/-5); no changes to drivers/gpu/drm/apple/t8152_atc.c or drivers/phy/apple/atc.c.
Evidence
  • git merge 460f8ea4bda8868436143db51049a47a1ea61e9d: brings in e4f3bebf (dcpaud_probe() device_is_bound() + av_audiosrv_ready() guard before device_link_add()).
  • drivers/gpu/drm/apple/t8152_atc.c L487–527 unchanged from 9fe042aa.

@sithglan

Copy link
Copy Markdown
Contributor Author

Exact-head hardware verification on Mac mini M6 (J873g, T8152, FW 27.2) at 460f8ea4bda8 (paired with aurora-silicon/aura#565 Stage 2 at d1d7ca31):

  • Kernel: Linux mini6 7.3.0-aurora-j873-main-1127+ #2 SMP PREEMPT Sun Nov 29 15:00:23 CET 2026 aarch64 (built from 460f8ea4bda8 + t8152-j873g.dtb)
  • dmesg errors/warnings: 0 WARNING:, 0 Call trace, 0 BUG:, 0 DART/IOMMU faults; systemctl --failed: 0 failed units
  • Rear USB-C / ATC PHY + Pin D USB3 alongside 2-lane DP:
    • All 4 xHCI hosts registered (Bus 001..008: front hub 382430000 with 480M + 10000M hub, rear ATC0 402430000, ATC1 40a430000, ATC3 412430000)
    • phy-apple-atc 413000000.phy: USB3 SuperSpeed active alongside 2-lane DP (lane 1)
    • Eizo EV2780 on ATC3 (port1-partner): Bus 007 480M Hub + EIZO USB HID Monitor + Cypress Billboard, Bus 008 5000M SuperSpeed Hub (usb 8-1), simultaneous with 2560x1440 DP (card1-DP-2)
  • Displays & DisplayPort/HDMI audio (including the #3613 e4f3bebf7735 devlink fix):
    • card0-DP-1 (HDMI, 2560x1440) + card1-DP-2 (USB-C DP, 2560x1440) both connected
    • DisplayPort (32a140000.dma-controller, IRQ 103 0 -> 20) and DisplayPort_1 (502140000.dma-controller, IRQ 104 0 -> 20) both passed 1 s silent 48 kHz S16_LE stereo zero-buffer playback cleanly
    • Devlinks: audio-controller-0 dormant (sync_state_only=1), audio-controller-1 & audio-controller-2 active (sync_state_only=0 rpm=1).

Base automatically changed from feat/t8152-j873-dpaudio to main November 30, 2026 10:39
Pick up unrelated CI harness fixes on main; no changes to PR files.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Nov 30, 2026
@sithglan

Copy link
Copy Markdown
Contributor Author

Forward-merged main (e6c7b032633c) into this branch at ea9c4729d76b (normal merge commit, no force-push) to pick up tools/aurora-sep/tests/test_trusted_readiness.py (fffee85c5489) that caused the unrelated source CI failure.

Hardware row at ea9c4729d76b: Mac mini (M6, J873g / T8152): PASS and Mac mini (M2, J473 / T8112): PASS (carried from 1e8cadcc and Ryan's J473 peer row; PR diff is unchanged).

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Nov 30, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at ea9c472

Blockers: Hosted DT/schema and DWC3/ATC profiles are queued.

Checked: The new J873g report confirms all rear Type-C ports registered, their PHY and xHCI bindings came up, and the stock kernel returned cleanly. The row measures rear-port registration and controller bring-up. The earlier physical DP/USB3 and USB4 hotplug cases remain the protocol evidence. Compared the two heads and confirmed the J873g DTS delta is limited to the fan node, with no change to the USB DTSI or ATC, DWC3 and iBoot display sources.

@sithglan

Copy link
Copy Markdown
Contributor Author

Exact-head hardware verification on Mac mini M6 (J873g, T8152, FW 27.2) at merge head ea9c4729d76b (paired with aura#565 d1d7ca31, one-shot aura-try, default cmdline): PASS

  • Kernel / DTB: 7.3.0-aurora-j873-pr3617+ built from exact head ea9c4729d76bc2399f3cc1c50050451735e9ead6 with t8152-j873g.dtb.
  • Rear USB-C / xHCI / Type-C:
    • All 4 phy-apple-atc PHYs bound (383000000.phy, 403000000.phy, 40b000000.phy, 413000000.phy) and all 4 dwc3 controllers bound (382430000.usb, 402430000.usb, 40a430000.usb, 412430000.usb).
    • All 4 xHCI host pairs (Bus 001..008, 480M + 10000M each) up; front USB2/USB3 hub enumerated cleanly on Bus 007 (480M) + Bus 008 (10000M).
    • All 3 rear Type-C ports registered and wired to their ACIO links (port0 1-0c / acio@401ac0000, port1 1-08 / acio@411ac0000, port2 1-0a / acio@409ac0000).
  • Display & HDMI DisplayPort Audio:
    • card0-DP-1 HDMI connected at 2560x1440.
    • DisplayPort (hw:1,0, 32a140000.dma-controller IRQ 100) passed 1 s silent zero-buffer 48 kHz S24_LE playback (0 -> 20), live unbind/bind of audio-controller-1 under dcp-dp-audio, and post-rebind 1 s silent playback (20 -> 40).
  • J873g fan node (brought in by main merge):
    • /sys/firmware/devicetree/base/soc/smc@30c600000/hwmon/fan-F0Ac present; macsmc_hwmon (hwmon1) live with fan1_input=999, fan1_min=1000, fan1_max=4900, fan1_target=1000.
  • Health & stock return: 0 WARNING:, 0 Call trace, 0 BUG:, 0 DART/IOMMU faults, 0 failed systemd units, end0 + wlp1s0f0 UP. Removed trial ESP files and modules and verified clean stock return to 7.3.0-aurora-j873-main-1127+ (chosen/aurora,trial absent, 0 failed units).

Mark the atcphy_t8152_usb2_reset() stub in dwc3/mocks.c with
__attribute__((unused)) to match phy.py and fix the clang
-Werror,-Wunused-function failure in host-tests case dwc3-teardown.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan

Copy link
Copy Markdown
Contributor Author

Fixed host-tests failure not ok 74 - dwc3-teardown in 09987918c5ca (tools/testing/selftests/drivers/gpu/apple-dcp/dwc3/mocks.c: marked atcphy_t8152_usb2_reset() with __attribute__((unused)) to resolve -Werror,-Wunused-function under clang). Verified apple-dcp selftest lifecycle (35/35, including ok 11 - dwc3-teardown) and full C/Python suite (98/98) pass locally with clang-22.

Hardware row at 09987918c5ca: Mac mini (M6, J873g / T8152): PASS and Mac mini (M2, J473 / T8112): PASS (carried from exact-head ea9c4729d76b J873g run above and Ryan's J473 peer row; 09987918c5ca touches only a 1-line host selftest mock, kernel/DTB unchanged).

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at 0998791

Blockers: Current-head hosted Host, DT and USB checks remain pending.

Checked: The forward delta only marks the DWC3 selftest mock as unused, addressing the Clang warning without changing the tested kernel or DT paths. The author reports 35/35 lifecycle and 98/98 full Apple DCP host tests with Clang 22. The prior J873g target and J473 peer rows carry forward across this test-only change.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 09987918c5ca

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: The forward delta only marks the DWC3 selftest mock as unused, addressing the Clang warning without changing the tested kernel or DT paths. The author reports 35/35 lifecycle and 98/98 full Apple DCP host tests with Clang 22. The prior J873g target and J473 peer rows carry forward across this test-only change.

Follow-ups (not blocking): current-head host/DT/USB checks

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed area:gpu Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) labels Dec 1, 2026
@sithglan

sithglan commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged main (a17872841ad7, including #3566) into feat/j873-rear-ports at f74b2a59d469 (normal merge commit, no force-push).

Hardware row at f74b2a59d469: Mac mini (M6, J873g / T8152): PASS

Machine SoC Head Test Result
Mac mini (M6, J873g) T8152 f74b2a59d469 One-shot aura-try boot (7.3.0-aurora-j873-pr3617+, in-tree t8152-j873g.dtb) + rear USB/Type-C/ATC PHY/DCP binding PASS
Details
  • Paired with Aura Stage 2 1.0.0b17-gd1d7ca31 (aura#565).
  • All 3 rear PHYs (phy@403000000, phy@40b000000, phy@413000000) carry reg-names = "core", "pipehandler", "usb2phy", "usb2evt"; all 4 phy-apple-atc PHYs and all 4 dwc3/xhci-hcd host controllers bound cleanly (8 USB buses + front Apple USB2.0/USB3.1 Gen 2x1 hubs).
  • Both apple-dcp (32ae00000.display, 502e00000.display) registered USB-C display on ATC0 (3 ports) cleanly; 0 failed systemd units, 0 ATC/DWC3/xHCI/DCP kernel errors.
  • Local verification at f74b2a59d469: arm64 QEMU KUnit (.kunitconfig.apple-atc) 72/72 PASS; atc-usb3-tests.py 39/39 PASS; atc-dp-drive-tests.py 8/8 PASS; apple-dcp host selftests (run.sh / lifecycle group) PASS (dwc3-teardown + usb-kconfig).

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Dec 1, 2026
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan

sithglan commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Forward-merged main (cafee219b1e9, including #3778 host-tests fix) into feat/j873-rear-ports at 0f05e17e9a4a (normal merge commit, no force-push).

  • Clean merge (ort), zero conflicts.
  • Zero runtime/kernel/DT file overlap with this PR (only a clean auto-merge in host selftest tools/testing/selftests/drivers/gpu/apple-dcp/pm.py where #3778 dropped two unused stubs at line 529, unrelated to our 1-line change at line 113).
  • Local pm.py and phy.py host selftests pass; the J873g hardware verification row from f74b2a59d469 (#issuecomment-7310830468) still stands.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 0f05e17

Delta re-check from the App approval at 0998791 (ORCH5 ask; one round).

Checked:

  • 0998791..0f05e17 has no new non-merge commits: only two forward merges of main (f74b2a5, 0f05e17).
  • Tried to find logic slipped in through conflict resolution. Across the 14 files the PR touches, git diff 09987918 0f05e17e equals main's own change between the two merge bases (e6c7b03..cafee21), as a sorted line set. The merges added nothing of their own.
  • The PR's diff against main is smaller than at 0998791 (17 files to 14) because the stacked parent #3613 has merged. The 6 drm/apple files carry exactly the same change as before. In atc.c the cio_only/fixed_usb2 usb3_port_ready logic is identical at both heads.

Follow-ups (not blocking):

  • Exact-head CI and the merge gate's row are on B2-MERGE. The J873g rows in the body are at 1e8cadc/460f8ea4, before these main merges.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Dec 1, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed rear-port reset, PIPE routing and rollback, and display reconnect ordering. Verified all ten touched runtime, DT, and binding blobs match the J873g boot from f74b2a5. The J473 display peer result carries through the clean forward merges. Hosted Apple build, DT, host, DWC3/ATC and DCP checks passed at this commit.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 1, 2026
@DjDeveloperr
DjDeveloperr merged commit f5436fe into main Dec 1, 2026
18 checks passed
@DjDeveloperr
DjDeveloperr deleted the feat/j873-rear-ports branch December 1, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bringup Area from CODEOWNERS (bot) area:display Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants