Skip to content

phy: apple: atc: select the T8103 and T600x tunnel clocks by PHY compatible - #2415

Closed
RyanTheTide wants to merge 5 commits into
mainfrom
hack/drm-board-gates2-b
Closed

RyanTheTide wants to merge 5 commits into
mainfrom
hack/drm-board-gates2-b

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

drivers/phy/apple/atc.c picked the DP tunnel pixel clock sequence of a T8103-generation PHY by the machine's root compatible:

  • apple_atc_tunnel_is_t600x() (~2903) matched apple,t6000 or apple,t6001.
  • apple_atc_tunnel_is_t8103_style() (~5001) matched apple,t8103, apple,t8112 or T600x.

Both came from 49fa065 ("phy: apple: atc: run the t8103 tunnel clock sequence on t600x").

A T8103-style PHY feeds both DP IN adapters from one AUSPLL pixel clock. A T600x PHY also runs PCLK2 and the DPRX clock, and it is opened (apple_atc_dp_tunnel_open()) before the first rate request. Every other PHY took the per-DP-IN T602x sequence. Which sequence applies is a property of the PHY. The T8103, T8112 (by fallback), T600x and T602x PHYs all used the apple,t8103-atcphy match data, so that data could not tell them apart, and the machine list did it instead.

Change

  • New match entries apple,t6000-atcphy and apple,t6020-atcphy. Both carry the T8103 data they already got through the fallback compatible.
  • Two new atcphy_hw flags, documented in the kernel-doc: tunnel_t8103_clock (set for the T8103 entry, which T8112 also uses, and for T600x) and tunnel_dprx_clock (T600x only).
  • The two machine helpers are gone.
  • apple_atc_dp_tunnel_open() now returns -EOPNOTSUPP for a PHY that belongs to another driver (T6050's atc-t6050-dp.c) before it reads the match data. The caller in dcp-fabric.c treats that as "nothing to open".
  • tools/asahi/atc-usb3-tests.py resolves the two new entries.

This is stacked on #2359 (hack/drm-board-gates-b): its two commits appear here too and go in with it; review only the last commit. That PR adds t8122_tunnel_clock and the apple,t6030-atcphy entry next to these lines, and this branch builds on its struct and match table.

Why every SoC is safe:

  • No functional change on T8103, T8112, T6000, T6001 and T602x.
  • T8122/T6031/T8140/T8142 keep their own data. T6030/T8132 use t8122_tunnel_clock from drm/apple, phy: apple: atc: select the T6030 display fabric by its IP compatibles #2359.
  • One SoC changes: T6002 (M1 Ultra). Its PHYs are the same apple,t6000-atcphy blocks (t600x-dieX.dtsi), but its root compatible was missing from the list. It now gets the T600x sequence. Before, it went down the T602x path, which on T6002 answered every rate with -EOPNOTSUPP, because apple_atc_t602x_qualified() only admits T6020/T6021 wiring.

Original work: Christian Bartels (T600x tunnel clock), ported by Chris Kearney.

Testing

  • arm64 LLVM W=1 build of drivers/phy/apple/ (atc.o and the rest): no compiler warnings. The kernel-doc warnings on struct apple_atcphy are the same as on the base.
  • Host tests atc-usb3 (with mutations) and t6030-clock pass, as do the selftests in tools/testing/selftests/drivers/gpu/apple-dcp (phy, transaction).
  • The atc-tunnel KUnit cases do not touch these helpers and were not run: they need an arm64 KUnit boot.

Still to run

  • M1 Pro (T6000 J316s): attach a display through a Thunderbolt dock. dmesg | grep "DP tunnel open" shows the open with TX_DP_CTRL0 set, and the display lights up, the same as on the base kernel. A/B: picture on 5/5 dock replugs on both kernels.
  • M2 (T8112 J413): the same dock row. With dyndbg on atc.c, DP tunnel clock rate lines appear from the T8103 sequence, there is no "DP tunnel open" line, and the picture comes up 5/5 on both kernels.
  • Neo and J616s are not affected (other PHY data). T6002 has no lab Mac.
Hardware rows (combined test kernel, 2026-11-20)

This change was booted in a combined test kernel: integration/aurora 0abc2f3 plus the open gate-sweep drafts plus this and the related drafts (7.3.0-aurora-hk2/pwr1/hk3). It ran once on each lab Mac (M1 Pro J316s, M2 J413, J616s, Neo J700) and was compared against the production kernel on the same Mac, using the same silent row script:

  • kernel errors, failed units and SELinux denials;
  • microphone capture byte counts;
  • camera frame counts;
  • USB speeds;
  • panel brightness steps;
  • every retry/refusal message these drafts touch;
  • 2 s2idle cycles on M1 Pro, M2 and J616s.

M1 Pro, M2 and J616s matched production on every row, apart from the new counters and lines the drafts add. The Neo row found the old-DTB display regression that #2358's follow-up commit fixes.

This PR: M1 Pro and M2 boot clean. No dock display was attached, so the tunnel rows are still to run.

… compatibles

The T6030 display paths were selected by the root compatible
(of_machine_is_compatible("apple,t6030")):

 - dcp-fabric.c: the tunnel pixel clock sources a route may use
   (dcp_route_tunnel_clock_blocked(), dcp_route_clock_rate(),
   dcp_tunnel_set_rate()) and the explicit crossbar link-up of a direct
   output (dcp_direct_crossbar_link());
 - atc.c: the T8122-generation tunnel clock (apple_atc_tunnel_t8122_clock())
   and the matching stop before a mode change (atcphy_configure()).

What these follow is hardware: the T6030 display crossbars, where a
selected output is only routed until its link is brought up and only
external sources 0 and 2 reach the ATC PHY's tunnel pixel clocks, and
the T6030 ATC PHY, which clocks both DP IN outputs from its own AUSPLL
tunnel clock. Every display processor behind those crossbars is an
apple,t6030-dcp or apple,t6030-dcpext, and every such PHY an
apple,t6030-atcphy.

Select them by those compatibles, through match data: a t6030_fabric
flag for the two T6030 processors, read by dcp_is_t6030_fabric(), and a
t8122_tunnel_clock flag for the PHY, set in a new apple,t6030-atcphy
entry (the T8122 PHY data plus the flag) and in the T8132 PHY data. The
PHY's mode change reads the same flag; a T8132 PHY never reaches that
path (atcphy_configure_t8132()), so it is the condition it had.

No functional change on any in-tree device tree: the T6030 machines
(J514s, J516s) carry exactly these compatibles, and no other SoC does
(T6031/T6034 use apple,t6031-*, T8122 apple,t8122-*). Whether the T8122
and T6031 PHYs, of the same generation, want the same tunnel clock
sequence is not known and is not changed here.

The host fixtures that replay these functions model the match data the
way they modelled the machine check, and the ATC USB3 host test now
resolves the new apple,t6030-atcphy entry.

Fixes: 6a6ee2a ("thunderbolt, phy, soc: apple: T6030 USB4/Thunderbolt, Type-C and DP tunnel support")
Fixes: 9e03c19 ("drm/apple: reserve the T6030 HDMI processor with source-aware tunnel clocks")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…s unused

The PHY host fixtures in phy.py define of_machine_is_compatible() for
the ATC functions they extract. Since the T6030 tunnel clock stop in
atcphy_configure() reads the PHY's match data instead of the machine,
no extracted function calls the mock any more, and the units fail to
build under -Werror=unused-function. Mark the two mocks unused, as the
fixtures do for other optional stubs.

Fixes: 6cb4c3e ("drm/apple, phy: apple: atc: select the T6030 display fabric by its IP compatibles")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…atible

The DP tunnel pixel clock sequence of a T8103-generation PHY was picked
by the root compatible: apple_atc_tunnel_is_t600x() (apple,t6000 or
apple,t6001) and apple_atc_tunnel_is_t8103_style() (apple,t8103,
apple,t8112 or T600x). A T8103-style PHY feeds both DP IN adapters from
one AUSPLL pixel clock; a T600x one also runs PCLK2 and the DPRX clock
and is opened before the first rate request; every other PHY took the
per-DP IN T602x sequence.

Which of these a PHY needs is a property of the PHY: the T8103 and
T8112 PHYs ("apple,t8103-atcphy", the T8112 one through its fallback),
the T600x PHY ("apple,t6000-atcphy") and the T602x PHY
("apple,t6020-atcphy") all share the T8103 register generation and match
data today. Give the T600x and T602x PHYs their own match entries (the
T8103 data, which they get now through the fallback) and say in the
match data which tunnel clock they have: tunnel_t8103_clock for the
T8103 entry and T600x, tunnel_dprx_clock for T600x only.
apple_atc_dp_tunnel_open() now answers -EOPNOTSUPP for a PHY of another
driver before it looks at the match data, as it did on every machine
but T6000/T6001.

No functional change on T8103, T8112, T6000, T6001 and T602x. T6002
(M1 Ultra), whose PHYs are the same apple,t6000-atcphy blocks
(t600x-dieX.dtsi) but whose root compatible was not in the list, now
gets the T600x sequence instead of the T602x one; there the T602x path
refused every rate with -EOPNOTSUPP, as T6002 has no T602x tunnel
wiring (apple_atc_t602x_qualified()).

The ATC USB3 host test resolves the two new entries.

Fixes: 49fa065 ("phy: apple: atc: run the t8103 tunnel clock sequence on t600x")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Blockers: 1.

  1. The branch no longer merges into integration/aurora: drivers/gpu/drm/apple/dcp-fabric.c and tools/asahi/dcpext26-crossbar-union-tests.py conflict. The conflict comes from the stacked drm/apple, phy: apple: atc: select the T6030 display fabric by its IP compatibles #2359 commits (merge base 0abc2f3; drm/apple, phy: apple: atc: select the T6030 display fabric by its IP compatibles #2359 is also CONFLICTING). Rebase onto drm/apple, phy: apple: atc: select the T6030 display fabric by its IP compatibles #2359 once that is rebased, and re-run host-tests on the new head.

The last commit (e583b4e) is sound. What I checked:

  • atc.c:8046-8048: every in-tree DT lists apple,t6000-atcphy/apple,t6020-atcphy before the apple,t8103-atcphy fallback, so the new entries do match first. T8112 (apple,t8112-atcphy, apple,t8103-atcphy) still gets atcphy_hw_t8103 with tunnel_t8103_clock set, as before.
  • atcphy_hw_t6000 and atcphy_hw_t6020 (:7951, :7965) match atcphy_hw_t8103 field for field, apart from the two new flags. No code compares hw == &atcphy_hw_t8103. atcphy_has_t8103_usb3_workaround() (:6892) reads gen and is unchanged.
  • apple_atc_dp_tunnel_open() (:5173-5189): the ops check now runs before drvdata is read, and a foreign PHY returns -EOPNOTSUPP. dcp_tunnel_prepare() (dcp-fabric.c:~2318) treats that as "nothing to open". A NULL phy still returns -EINVAL, as on the base.
  1. Not blocking, but call it out: on T6002 (J375d, which shares t600x-j375.dtsi typec-routes with J375c) this enables the T600x open plus the PCLK2/DPRX sequence for the first time, including on the die-1 PHYs. Until now that machine refused every tunnel rate. The commit is right to say so. Keep the PR text clear that M1 Ultra tunnels are untested until someone with one runs the dock row.

HW row: on the rebased head, the dock rows the PR already lists. M1 Pro J316s: "DP tunnel open" with TX_DP_CTRL0 set and a picture on 5/5 replugs. M2 J413: T8103-sequence rate lines, no open line, picture on 5/5. Both A/B against the base kernel, with 0 AVC, 0 failed units and no new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

Conflicts: dcp-fabric.c (dcp_direct_crossbar_link: keep dcp_is_t6030_fabric() plus integration's dcp_t6041_ext_v27()), dcpext26-crossbar-union-tests.py (extract both dcp_t6041_ext_v27 and dcp_is_t6030_fabric).

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
No conflicts: integration/aurora comes in through the updated hack/drm-board-gates-b (81af464), merged cleanly.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merged integration/aurora (f5f023b, through the updated #2359 head 81af464); no conflicts on this branch, drivers/phy/apple/ (arm64 fleet config, LLVM) builds; atc-usb3 host test and apple-dcp selftests (92/92) pass.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

The conflict is gone after the rebase. Still needed: #2359 (whose commits this carries) to land first, then the M1 Pro J316s and M2 J413 dock rows on this head (picture on 5/5 replugs, A/B against the base kernel).

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent source review at 10ccffeb28c1. The refactor drops the root SoC test and uses the ATC block's own match data. Please verify the final combined patch on the J413 with a USB4 dock, including the same negotiated lane rate before and after and reattachment after s2idle. The T6002 functional change also needs its own positive row.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Folded into #2457, which carries this PR's commits unchanged; review continues there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant