Skip to content

J873g: USB3 on the front ports (T8152 in the ATC PHY driver, M6 Mac mini) - #1799

Open
sithglan wants to merge 93 commits into
aurora-silicon:integration/aurorafrom
sithglan:thomas/j873-usb3
Open

sithglan wants to merge 93 commits into
aurora-silicon:integration/aurorafrom
sithglan:thomas/j873-usb3

Conversation

@sithglan

@sithglan sithglan commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1797 (aurora-wip merge for the J873g, which brings #1205's USB2 hosts) and #2459 (T8152 PSD power domains; its two commits are included unchanged). Review the last three commits.

The J873g's (Mac mini M6, T8152) front USB-C ports sit behind an on-board VL822 hub on ATC2. With #1205 the hub's USB2 side works through usb-drd2. This adds its USB3 side in the shared ATC PHY driver:

  1. dt-bindings: phy: apple,atcphy: add the T8152 fixed-USB3 PHY. Adds apple,t8152-atcphy and apple,fixed-usb3, the PHY's power domains, and its common-a, common-b and lane0-usb tunable groups.
  2. phy: apple: atc: add T8152 for a fixed-USB3 port.
    • Layout in the match data. The T8152 match data reuses the T8142 PIPE handler fields. Three new layout fields are zero for every other SoC:

      • cfg_offset: the power and reset block is at 0x60000, behind the controller's DARTs.
      • lane_swap: bit 1 there.
      • sync_reset: the sync reset at 0x60030.

      Crossbar 0x110 is the existing USB3 setting. T8152 has no lane-mode register to write.

    • T8152-specific code:

      • lane 0's explicit power-up and power-down;
      • the crossbar write right after the power-up;
      • the BIST hold of lane 0's PIPE reset and power-down while the PIPE switches.
    • PIPE lock. The T8152 PIPE handler never acknowledges the lock. The PIPE changes under the request without waiting for an acknowledge (pipe_lock_unacked).

    • apple,fixed-usb3 marks a host-only port. Only the USB3 PHY is registered: no reset controller, Type-C mux or switch. The PIPE is routed when dwc3 powers the PHY on.

    • Power through genpd: ATC2's USB_AON and COMMON_DP_0/1 via pmgr-pwrstate, and PSD service 57 via pmdomain: apple: T8152 PSD services as power domains #2459.

    • Tests: KUnit cases, and the host-test fixtures that copy atc.c structures get the new fields.

  3. arm64: dts: apple: j873: USB3 on the front ports. Adds ATC2's power states, its PSD service and the PHY node. usb2 gets the PHY as its usb3-phy and drops maximum-speed = "high-speed".

Things to know

  • The front controller now waits for phy-apple-atc and the PSD and power-state providers. If the PHY isn't built or fails to probe, the front ports lose USB2 as well.
  • USB_AON is apple,always-on. It holds the USB controller's reset and the PIPE handler state that the loader sets up. Switched off (for example, by unloading the PHY driver while USB_AON was still switchable), the controller stays in reset until the next boot.
  • aura's J873 USB prep has to run first, as it does today. It powers USB_AON and the USB PSD, sets up the eUSB2 PHY in host mode, takes the DWC3 out of reset and releases the VL822 reset line.
  • The tunables come from this machine's ADT (26A434). There is deliberately no atcphy2 alias, so the loader's ATC tunable copy leaves them alone.
  • Suspend and kexec are not exercised; the J873g can't suspend yet (wifi: apple: centauri: Quiesce Alpha for sleep on every N1 board #2385).

Testing (M6, this exact head on #1797 + #2459)

Restacked on 2026-11-22 onto #1797 e9724fe, which gives the USB DARTs ATC1_USB/ATC2_USB. The ATC PMGR node now holds those two states next to ATC2's DP and USB_AON states. That tree, as part of #2178's head, booted on the J873g with the front hub, keyboard and receiver as before.

Earlier rows:

  • The front xHCI has a 480M and a 10000M root. The VL822 appears on both, at 480M and at 10000M ("new SuperSpeed Plus Gen 2x1"). The keyboard and mouse behind it work, and the back-left controller is unchanged.
  • 5 dwc3 unbind/bind cycles: the hub comes back at 10000M each time.
  • Controller unbound, rmmod/modprobe phy-apple-atc: the three switchable domains go off and on again, and the hub comes back on USB2 and USB3.
  • PIPE lock: a test build that waited up to 150 ms got no acknowledge in 8 tries, in either direction, while the switch itself worked. With atc.c's 1 ms wait as a hard failure, every USB3 start failed.
  • KUnit phy-apple-atc*: 41/41, including phy-apple-atc-t8152. It covers the crossbar, lane 0 up and down, the power block at 0x60000/0x60030 with the DART words left untouched, and the unacknowledged lock.
  • tools/asahi/run-host-tests.py: 427/427.
  • scripts/dtc/apple-dt-check.sh against Merge aurora-wip 210c8f6e into integration/aurora (J873g NVMe, 10GbE, power off, USB2, audio) #1797 (ec172bbcc1ed): 0 new and 0 removed warnings (137 DTBs). Both changed bindings pass dt_binding_check.
  • Image, modules and DTBs build (LLVM 22). checkpatch --strict is clean.

cc @Acelogic @RyanTheTide @DjDeveloperr @LiamRay10

Assisted-by: LLM (Claude:Opus 5.5)

sithglan and others added 30 commits November 6, 2026 11:23
The T8152 (M6) Always-On Processor differs from the T8140 one: its setup
port is not reachable from the AP, so it has one mailbox, and its audio
service uses six serializer power domains and the jack, speaker and
speaker-sense ADMAC channels.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Add the Mac mini M6 (J873) sound card.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873 (Mac mini M6) AOP runs the same firmware generation as T8140
(EPIC v4, iBoot-loaded, started by the AP), but the T8140 "setup port"
is not reachable from the AP: mailbox 1 of the AOP's mailbox bank and the
ADT aop-exclave-mailbox both bus-error. The firmware boots without it:
RTKit protocol 12, then its "audio" EPIC service. Add apple,t8152-aop
with the T8140 configuration minus the setup port, starting every
advertised endpoint.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The Mac mini (M6, J873) speaker runs a 250-BCLK TDM frame, which the
SN012776's ratio auto-detection rejects. Describe the property that fixes
the ratio instead.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873 (Mac mini M6) AOP runs the speaker frame at 250 BCLKs of 12 MHz.
The SN012776 cannot auto-detect that ratio and mutes with "fault: bad
TDM clock". With TAS2764_CLK_CFG (register 0x60) set to 0x30 and
TDM_CFG0 bit 6 set it accepts the frame and plays. Do that when the new
ti,bclk-ratio property names the ratio; only this one ratio is supported.

Source of the value: the register write was first seen in the macOS
SN012776 driver; it is a single register value, and its effect (no fault,
correct playback) was verified on J873 hardware. No table or code was
taken from macOS.

The field is initialised in probe, so non-OF matches keep auto-detection.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The SDOUT1 mux offers the ASP receive channels as a source, but no DAPM
route connected them, so selecting "ASP RX CH1" or "ASP RX CH2" left the
capture path without an input. The J873 and J813 AOP audio services use
it to loop the playback stream back.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
On T8152 (J873, Mac mini M6) the AOP firmware owns the audio fabric, as
on T8140. Its "audio" EPIC service offers cout/cin (the CS42L84 jack,
base-ns ADMAC TX5/RX5, MCA4) and spkr (the SN012776 speaker, TX1, MCA0).

Each service is an ASoC back-end DAI: startup attaches it, requests pw0
(which raises the audio fabric) and powers the MCA leaves, all of which
are required. pwrd starts the serializer clocks at prepare, before ASoC
unmutes the codecs: the jack codec locks its PLL to the bit clock, and
the speaker amplifier reports "bad TDM clock" whenever it runs without
one. The jack restarts its clocks on every prepare so that a stream
restarted after an underrun begins on a frame boundary; the mono speaker
(one slot per frame) keeps them running. The front-ends are dmaengine
PCMs on the base-ns channels: the jack in stereo, the speaker in mono
(its serializer runs one 32-bit slot; stereo frames play at half pitch).

The firmware's serializer configuration (property 701) is byte-identical
to the one macOS publishes, so the driver leaves it alone.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873 (Mac mini M6) uses the T8152 AOP audio driver as its CPU
component: the CS42L84 jack on "cout" (DSP_A | IB_NF, one-BCLK sync
pulse) and one SN012776 on "spkr" (I2S, NB_IF: data sampled on the rising
edge, as macOS programs the amp).

Each AOP front-end owns the DMA channel of one serializer, so the speaker
can only be fed from the secondary front-end; the new spk_secondary_only
sets the speaker mux accordingly, and spk_dai_fmt gives the speaker link
its own format.

There is no qualified speaker protection for J873 yet (no verified sense
path, thermal model or power budget), so the speaker fails closed: it is
only enabled with please_blow_up_my_speakers. Opted in, it runs as macOS
runs it: amp gain 15 (ADT speaker-config) and no volume lock (safe_vol 0),
since there is no sense stream for a protection daemon. The jack is not
affected.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8142 AOP keeps its crash buffer in its own slot of its DART stream
and asks for it on endpoint 1 with that IOVA. A client without
shmem_setup refused the request, so the firmware never got its crash
buffer acknowledged.

APPLE_RTKIT_FIRMWARE_OWNED_CRASHLOG takes such a buffer as the firmware's,
without a CPU mapping, and acknowledges the request unchanged; a later
crash is reported without a log. RtKit::new_with_firmware_crashlog()
selects it at runtime, so a driver can use it for one SoC only.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8142 AOP (MacBook Air J813) waits for the host on a setup port, as
the T8140 one does: the ADT's aop-exclave-mailbox at 0x3d067c000 (AOP
ASC + 0x4007c000, not behind the arm-io translation). Its EPMAP announces
other service endpoints than T8140's fixed set (0x4, 0x20, 0x23 and 0x32
on J813), so take the endpoints that must get buffers from the EPMAP when
the match data says so.

The firmware places its own crash log buffer in its firmware-mapped DART
slot; accept it as the firmware's, as for G17P.

After the setup boot all AFK endpoints start, and with the audio fabric
left to the firmware (see the J813 device tree) the firmware announces
its "audio" EPIC service.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Behind an AOP the serializer feeding a capture channel is the firmware's,
and it stops in the middle of a frame whenever it likes. A capture that
stays open across such stops (the speaker V/I sense, which a protection
daemon reads for as long as it runs) then carries the partial frame
forward: every later frame is off by its words, and the samples of one
amplifier are read as another's. On the MacBook Air J813 one restart in
three slipped by one 16-bit word.

Let a client pass the frame size in bytes as a u32 in
dma_slave_config.peripheral_config. A paused cyclic capture on such a
channel resumes at the next frame boundary of its current period: the
reports completed before the pause are accounted for, the rings are
reset and the rest of the period is submitted from the aligned address,
then whole periods as before. Without a frame size nothing changes.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J813 speaker stream (ADT iop-audio-controller/audio-speaker) differs
from J873's: four SN012776 in 32-bit playback slots 0-3, and their voltage
and current sense back on the same stream's RX side (base-ns RX0) as eight
16-bit slots. Make the speaker and sense shapes per-SoC match data:
J873 keeps one playback channel; T8142 gets four, and an 8-channel S16_LE
"Speaker Sense" front-end.

The sense capture is the speaker serializer's RX, which the firmware
stops anywhere in a frame. Before every `pwrd` of the speaker, restart a
running sense capture at a frame boundary (apple-admac realignment, the
partial frame reads as zeros), so that a protection daemon that keeps it
open attributes each amplifier's voltage and current to the right one.

The sense back-end also attaches the speaker service and requests `pw0 `
at startup: its front-end requests the ADMAC channel next, and the ADMAC
only answers while the firmware holds the audio fabric up. Opening the
sense before any other stream since the AOP started (speakersafetyd at
boot) otherwise faults the bus.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
MacBook Air 13" M5 (T8142): as on J873 the AOP firmware owns the audio
fabric and the CPU component is the T8152-style AOP audio driver. The
jack is a CS42L84 on "cout", the speakers four SN012776 (one woofer and
one tweeter per side) on "spkr", with their V/I sense on the same stream.
As on the other SN012776 laptops the speaker volume stays locked until a
protection daemon (speakersafetyd) holds it.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The MacBook Air J813's three microphones are the AOP's "hpai" service
(ADT iop-audio-controller/audio-hp-mic): the firmware runs the PDM part
and delivers 48 kHz float32 frames of three channels (the ADT's
audio-hp-mic-proxy description: 12 bytes per frame) on leap-s ADMAC RX0.
There is no codec, so it gets a card of its own with one capture PCM,
named like the other AOP microphone cards (AppleJ813HPAI, "MacBook Air
J813 High-Power Audio Interface", driver aop_audio) so that the existing
UCM and DSP configurations for those apply.

As on T8140: open attaches the service and requests pw0 (which raises
the LEAP fabric), powers the LEAP leaves (leap-s ADMAC, RX0, LEAP MCA),
and only then requests the channel, whose registers fault without them.
The trigger starts the DMA and queues pwrd behind it; started earlier,
the LEAP produces into a channel nobody services. Close releases the
channel, then pw0 and the leaves.

The card exists only where the DT gives the LEAP power domains (all
three); J873 is unchanged. The dmaengine substream setup moves into a
helper shared with the ASoC front-ends.

Tested on J813: a tone from the speakers reads -44 to -49 dBFS on all
three channels, 70 dB over the quiet floor, exactly while it plays;
PipeWire picks up the card with asahi-audio's J613 beamformer graph.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
integration/aurora added the nCal boot argument and word-wise boot-argument
access to AopHwConfig. Both machine configurations keep the firmware's own
boot arguments unchanged, so set ncal to zero and leave word access off.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Every boot on the J616s logged "spi-nor spi0.0: supply vcc not found,
using dummy regulator". The M1, M2, M3, J713 and J700 trees describe the
flash's always-on PMU rail as a fixed regulator; the M4 Pro/Max tree
came later and has none. Add the same regulator and point the flash at it.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Preserve current RTKit crashlog and GPU handling while retaining the expanded macaudio bindings and adding J813/J873 compatibles. Original audio commits and authorship are preserved.
…ation

Test whether COUT standby supplies the missing cold-boot fabric setup. A muted zero-data jack stream permitted HPAI capture and subsequent capture-only opens on J813; standby without any playback is the next hardware qualification step.

Preserve Thomas Glanzmann’s driver and adapt the T8140 DMA sync-stop pattern from Ryan Murray, also flushing queued HPAI work before DMA teardown. No LPAI buffer binding or codec unmute is performed.
…queue

Describe the T8142 microphone DMA and LEAP power domains and card names in the shared audio binding. Queue sleeping firmware power requests on system_dfl instead of the deprecated system workqueue, as directed by the runtime warning observed during hardware capture tests.
…-initialization-20261106

ASoC: apple: integrate J813 audio with first-open microphone initialization
…616-nor-vcc

arm64: dts: apple: t604x-j614-j616: Describe the boot NOR flash supply
Resolves sound/soc/apple/macaudio.c: aurora-wip added spk_dai_fmt and
spk_secondary_only (J813/J873) where integration added tweeter_hpf_granted
(speaker protection ownership); the struct keeps all three.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
…nc-20261107

Merge integration/aurora into aurora-wip (11-07)
Brings aurora-wip up to integration/aurora 068dfce: pcie-apple endpoint
reset retry (aurora-silicon#1069) and the
tools/aurora-sep PKGBUILD checksum fix
(aurora-silicon#1068).

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
…n/wip-sync-20261107b

aurora-wip <- integration/aurora 068dfce (aurora-silicon#1068, aurora-silicon#1069). Clean merge, W=1 pcie-apple.o 0 warnings on the merged tree, CI host-tests/rust-build/source pass. Merge train (MTR).
Brings aurora-wip up to the tested release branch: CTXR execmem
(aurora-silicon#985, aurora-silicon#1079), KFIX speaker sleep and resume fixes (aurora-silicon#1077, aurora-silicon#1080),
JPEG v2 (aurora-silicon#1072), Jonathan's G17 and USB work (aurora-silicon#1073-aurora-silicon#1076), brcmfmac
flowring count (aurora-silicon#1081), ANE H16 startup restart (aurora-silicon#1066) and the
Touch ID per-prompt match (aurora-silicon#904).

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Adds the 11-07 evening batch: t8140 disabled SPI3/FPWM0/SPMI nodes
(aurora-silicon#1034), J700 CPU zones (aurora-silicon#1043), J616C fans (aurora-silicon#1092) and the thunderbolt
DP PM workqueue fix (aurora-silicon#1098).

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
…n/wip-sync-20261107c

Gate on the exact head tree 6c684e8 (buildbox): fleet22-config Image+modules+dtbs build rc=0, 0 errors, 0 warnings, 5890 modules (= fleet); run-host-tests 193/193; apple-dcp host selftests 86/86 (fleet baseline 86/86). CI host-tests/source/rust-build green. Brings aurora-wip up to integration/aurora 810b92c.
Brings aurora-wip up to fleet25: DT descriptions (aurora-silicon#1029, aurora-silicon#1030, aurora-silicon#1112),
the J715 board (aurora-silicon#1129), Stockholm NFC (aurora-silicon#1042, aurora-silicon#1136), the AV1 tile check
(aurora-silicon#1100), the M4 Max ANE profile and AVD quirk (aurora-silicon#1088, aurora-silicon#1091), boot-log
fixes (aurora-silicon#1103, aurora-silicon#1104) and the Neo ANE memory floor (aurora-silicon#1137).

Conflicts: macaudio.c and apple,macaudio.yaml, where aurora-wip's J813
and J873 entries and integration's J715 entries were added at the same
spot. Keep all of them.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
@sithglan

Copy link
Copy Markdown
Contributor Author

Thanks. I've done the second point. The head is now 6e2ae8b6f4e0, on #1797's new head:

  • The aciophy-usb3.c file header now describes the bring-up by its steps: the power-down/reset release, the efuse/PLL tunables, crossbar 0x110, the remaining tunables, the PHY reset release, then the PIPE handler switch under the BIST overrides.
  • The lane 0 up/down, BIST override and PIPE switch comments now say what the code does, with no macOS class or function names.
  • I removed the same names from the two commit messages, the tunable comment in t8152-j873-usb.dtsi and the PR description.

No functional change: the driver builds with no W=1 warnings, and the diff is comments only.

I agree with the first point, moving the PHY into atc.c, and it's next: T8152 match data, plus a fixed-USB3 mode selected by a property on the PHY node, reusing atc.c's power-down/reset, tunable and lane power-up code. The T8152-specific parts are crossbar 0x110, the BIST hold around the PIPE handler switch, and lane 0's explicit power-up. It also needs the ATC's PMGR power states and PSD domain as real power domains rather than registers the PHY writes itself, which is the same PSD provider question I raised on #1797. Because it changes the bring-up path, I'll test it on the M6 before pushing.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for cleaning up the comments and commit messages. The description by registers and steps reads well. The plan for atc.c sounds right to us: T8152 match data, a fixed-USB3 mode selected by a PHY-node property, and only crossbar 0x110, the BIST hold and lane 0's explicit power-up as T8152-specific code. The power-domain question is the same one as on #1797, so the shared PSD provider there should cover it. When the atc.c version is pushed, we'll run no-regression rows for the shared PHY path.

The J873g USB controllers and their DARTs are powered by PMGR2 PSD
services 175 (usb-drd1) and 176 (usb-drd2). Say so on the DART nodes,
and that the domain waits on the T8152 PSD provider and has to stay on
until Linux can restore the USB2 PHY setup the loader leaves.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan
sithglan force-pushed the thomas/j873-usb3 branch 2 times, most recently from 6655b2d to 78a6311 Compare November 19, 2026 21:49
@sithglan sithglan changed the title J873g: USB3 on the front ports (T8152 ACIOPHY, M6 Mac mini) J873g: USB3 on the front ports (T8152 in the ATC PHY driver, M6 Mac mini) Nov 19, 2026
@sithglan

Copy link
Copy Markdown
Contributor Author

The atc.c version is pushed. The head is now 78a6311eeeb6 (was 6655b2d6d0df). It is #1797 plus #2459's two PSD commits, unchanged, plus three commits. The standalone aciophy-usb3.c driver and its config line are gone.

phy: apple: atc: add T8152 for a fixed-USB3 port

  • Match data atcphy_hw_t8152. It uses the T8142 PIPE handler fields. Three new layout fields are zero for every other SoC:

    • cfg_offset: the power and reset block sits at 0x60000, behind the controller's DARTs.
    • lane_swap: bit 1 there.
    • sync_reset: 0x60030, released first and asserted last.

    Crossbar 0x110 is atc.c's existing USB3 setting. T8152 has no lane-mode register to write.

  • T8152 code is limited to the three pieces you listed: lane 0's explicit power-up (with its power-down when the PHY powers down), the crossbar write right after it, and the BIST hold while the PIPE switches.

  • apple,fixed-usb3 selects a host-only port. Only the USB3 PHY is registered: no reset controller, mux or switch. The PIPE is routed when dwc3 powers the PHY on.

  • Power goes through genpd: ATC2's USB_AON and COMMON_DP_0/1 through pmgr-pwrstate, and PSD service 57 through pmdomain: apple: T8152 PSD services as power domains #2459.

Two things came up only on hardware:

  • The T8152 PIPE handler never acknowledges the PIPE lock. With atc.c's 1 ms wait, every USB3 start failed and the hub stayed on USB2. In a test build that waited 150 ms, no acknowledge came in 8 tries, in either direction, while the PIPE still moved to USB3 and back under the request. So T8152 sets the request and does not wait (pipe_lock_unacked). That is what the old driver did, in effect: it waited 150 ms and then went on.
  • USB_AON is apple,always-on. I unbound the controller and unloaded phy-apple-atc, so genpd switched all four domains off. After reloading, dwc3 failed with "this is not a DesignWare USB3 DRD Core": the controller's reset and the PIPE handler state that the loader sets up are in that domain. With USB_AON kept on, the other three domains go off and on, and the hub comes back on both USB2 and USB3.

Tests on the J873g (exact head):

  • The VL822 enumerates at 480M and at 10000M ("new SuperSpeed Plus Gen 2x1"). The keyboard and mouse behind it work, and the back-left controller is unchanged.
  • 5 dwc3 unbind/bind cycles: USB3 at 10000M each time.
  • rmmod/modprobe phy-apple-atc: the hub comes back on USB2 and USB3.
  • KUnit phy-apple-atc*: 41/41, including the new phy-apple-atc-t8152 cases. They check the crossbar, lane 0 up and down, that the power block goes to 0x60000/0x60030 while the DART words at 0x20000/0x20008 stay untouched, and the unacknowledged lock.
  • apple-dt-check.sh against Merge aurora-wip 210c8f6e into integration/aurora (J873g NVMe, 10GbE, power off, USB2, audio) #1797 (ec172bbcc1ed): 0 new and 0 removed warnings over 137 DTBs. Both changed bindings pass.
  • tools/asahi/run-host-tests.py: 427/427. The host-test fixtures that copy atc.c structures now have the new fields, and the units for the older generations get T8152 stubs that assert.
  • checkpatch --strict is clean.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the atc.c port. With aciophy-usb3.c and its config line gone, T8152 as match data plus apple,fixed-usb3 on the PHY node, and only lane 0's power-up, crossbar 0x110 and the BIST hold as T8152 code, this resolves our duplication point. Recording the unacknowledged PIPE lock and the USB_AON loss as measured on the J873g is the kind of reason we like next to a hardware difference. Since this changes the shared ATC path, we will run no-regression rows on our M1 Pro, M2, M4 Pro and A18 Pro (USB3 enumeration, a plug cycle, s2idle) and post them here.

@RyanTheTide

Copy link
Copy Markdown
Contributor

@sithglan, a tidy-up pass over the open PRs here. These of yours need something:

If any of these are no longer needed, closing them helps; otherwise a merge or rebase onto integration/aurora is usually all they need. Thanks!

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

Copy link
Copy Markdown
Contributor Author

@RyanTheTide thanks. All eight are rebased onto integration/aurora d1b022dc34fb and GitHub reports each of them as mergeable:

PR new head stacked on
#1799 2603161c3e00 #1797
#1800 31f34f5d87e7 #1797
#2486 2880a16f6e74 #1800
#2178 82291cc244a6 #2486
#2749 bbd6690155a0 #1800
#2139 6a2bbe86dfa1 integration/aurora
#2142 b28768e3debc integration/aurora
#2238 bada74cc817b #2142

#1797 (7f2d14f96a69): the J873g PRs stack on it, so I merged integration/aurora d1b022dc34fb into it, as a merge commit with no conflicts. Its diff against integration is unchanged.

Conflicts, all small:

Two host tests that are new on integration, bcm4377-radio-sids and atc-t8132-usb3, copy apple-dart.c and atc.c structures. With the stacks they failed to compile on the new fields. Each fixture gets those fields in the commit that adds them:

  • apple_dart_hw.gen3, in "support the locked Gen3 DARTs";
  • cold_gen3 and its stream fields, in the two cold-DART commits;
  • fixed_usb3, cfg_offset, sync_reset and atcphy_cfg(), plus a stub for the T8152-only lane power-down, in "add T8152 for a fixed-USB3 port";
  • cio_only, in the CIO-mode commit.

Both tests now pass at every commit of every branch. Apart from these fixture lines and the context lines around the conflicts, git range-diff shows no change.

Checks on every head:

None of these heads have been booted on hardware yet.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of 2603161: thanks for the rebase, it merges cleanly now. The ATC commit's driver code is unchanged. It only adds the new fields and a T8152-only stub to the atc-t8132-usb3 host test, and the PSD commits are #2459's current two. Our view stands, and the shared ATC no-regression rows on M1 Pro, M2, M4 Pro and A18 Pro remain on our side.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Contributor Author

Restacked on #1797 e9724fe, which gives the USB DARTs and DWC3 nodes ATC1_USB/ATC2_USB. The only conflict was t8152-j873-usb.dtsi. The ATC PMGR node now holds ATC1_USB_AON, ATC1_USB and ATC2_USB next to ATC2's DP and USB_AON states, and the comment that pointed the USB DARTs at #2459 is gone. This tree booted on the J873g as part of #2178's head: the front hub (USB3), keyboard and receiver behave as before. See #1797 for the row.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-checked at 283270c: a rebase onto #1797's DART power-domain commit. The only changed commit is the front-port USB3 one, and the change is the merged ATC PMGR node plus ps_atc2_usb on the USB3 controller; driver code is unchanged. Our view stands.

Assisted-by: LLM (Claude:Opus 5.5)

…t DARTs

Every enabled DART must name the power state of the engine it serves
(scripts/dtc/apple-dart-pd-check.py). The J873g USB and Ethernet DARTs
named none.

USB: the controllers' state is the ATC PMGR's ATC1_USB (usb-drd1, on
atc-phy1) and ATC2_USB (usb-drd2, on atc-phy2), as for the dwc3 DARTs on
T8132. The ADT also gives usb-drd1/2 service-gates 175/176, but those PSD
service blocks take a bus error from the CPU. The loader leaves ATCn_USB
and ATCn_USB_AON on (read back as 0x3ff on J873g), and they hold the
controllers' reset and the USB2 PHY setup it did, which Linux cannot redo
yet. So all four stay on, without automatic power management. ATCn_USB
is a child of ATCn_USB_AON, as on T8132, so the order holds if that ever
changes. The DWC3 nodes take the same state as their DARTs.

Ethernet: dart-apcie2 takes APCIE_SYS_GP (child of APCIE_GP), as
pcie2_dart does on T8142. iBoot leaves both on (0x2ff and 0x1f0003ff),
and the loader's PHY and lane setup for port 2 cannot be redone by
Linux, so both stay on. APCIE_GP has no automatic state set, and
automatic power management would power gate it, so it stays off for
both.

Offsets are from the 26A434 ADT pmgr device list.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
On T8152 the video decoder, the USB4 routers and their PHYs and the USB
controllers are powered through PMGR2 PSD services instead of PMGR
power-state registers. Each service has a 0x100-byte block with a target
state, an acknowledge bit and the current state.

Describe one service per node as a power domain, with an optional
apple,always-on for a service whose consumers cannot restore what
another agent set up in its blocks yet.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Provide each T8152 PMGR2 PSD service as a power domain. Power-on
requests state 0 and power-off the cold state 6. The driver waits for the
acknowledge before it reads the state, because reading the state
consumes the acknowledge. A service marked apple,always-on is powered at
probe and kept on. Otherwise the domain starts in the state the
hardware reports, so genpd powers off a service that nothing uses.

The consumers include IRQ-safe devices, the DARTs, so the domains are
IRQ-safe and a transition is polled atomically, as the PMGR power states
are. On the J873g the AVD service (50) reaches state 0 in 390-500 us and
the cold state in about 240 us; the timeout is 10 ms.

The AVD and the USB4 routers' CIO services, which so far each had their
own variant of this, and the USB controllers (services 175 and 176) use
it.

It has its own Kconfig symbol, APPLE_PMGR_PSD, on by default with
ARCH_APPLE and built in by the shared asahi.config profile.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The two front USB-C ports of the Mac mini (2026, J873g) sit behind an
on-board USB3 hub. The hub's SuperSpeed lanes are wired to the Type-C
PHY of the SoC's ATC2 directly, without a Type-C mux or port controller
in between, so that PHY only ever runs one fixed USB3 configuration.

Describe the T8152 variant in that role, with a boolean
apple,fixed-usb3 that marks such a port: the PHY runs USB3 on lane 0
from probe on, ignores mux and orientation changes and provides only
the USB3 PHY of its controller. The controller's USB2 side and reset
stay with the bootloader, so the T8152 PHY has no #reset-cells and no
Type-C switch properties.

The PHY is described by its core and pipehandler banks. On T8152 the
core bank also holds the USB controller's DARTs, and the PHY's power
and reset block sits behind them. It needs four power domains, listed
in the order they are powered up: the ATC's USB_AON power state, its
common PSD service and its COMMON_DP_0 and COMMON_DP_1 power states.
The other variants keep their single power domain and #reset-cells.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873g front ports reach their on-board USB3 hub through ATC2's
Type-C PHY, wired to the hub without a Type-C mux. So far the hub ran at
USB2 only: the bootloader leaves the PHY powered down and the PIPE on
the controller's dummy PHY. Support the T8152 PHY in that role in the
shared ATC driver.

T8152 shares the T8142 generation's power and reset block, tunables and
PIPE handler, with a different layout: the USB controller's DARTs sit
at 0x20000 and 0x40000 of the ATC window, so the power and reset block
follows at 0x60000, its lane swap is bit 1 there, and the reset the
power-up releases first is a separate always-on sync reset at 0x60030.
The crossbar is at 0x4c and the USB3 mode's existing setting, USB3+DP
with single PMA 0x008, gives the value 0x110; there is no lane mode
register to program. Describe this in the match data, with zero for the
layout of the other SoCs, and leave the power-up and power-down, the
tunables, the crossbar and the PIPE switch to the existing code.

What remains T8152 code:
 - Lane 0 is powered up on its own after the common-a tunables (LFPS
   receivers, sleep, clamp, AHB reset) and down again with the PHY.
   Without it the lane registers stay in AHB reset, drop the lane
   tunables and the PHY never reports PIPE PhyStatus. The crossbar is
   set right after, before the remaining tunables, as in the T8152
   sequence.
 - While the PIPE moves to the PHY, the BIST overrides hold lane 0's
   PIPE reset and power-down, stepping from P2 to P3, and the
   non-selected PHY override is released under them.

The T8152 PIPE handler takes the lock request but does not acknowledge
it: with the controller out of reset, no acknowledge came within 150 ms
in either direction, while the PIPE moved to USB3 and back to the dummy
PHY under the request. So T8152 changes the PIPE under the request
without waiting for the acknowledge; otherwise every USB3 start fails.

A fixed-USB3 port, apple,fixed-usb3, is a host by construction. Probe
maps only the core and PIPE windows, the core without claiming it as
it holds the DARTs, powers the PHY's power domains in the order they
are listed and brings the PHY up in USB3. It registers only the USB3
PHY: no reset controller, Type-C mux or switch, as the controller's
reset and USB2 side stay with the bootloader. The PIPE is routed when
the controller powers the USB3 PHY on, after its core reset, which also
sets the PHY up again after a power-off. If that fails the host starts
with its PIPE parked, so the hub keeps USB2.

The T8152 register sequence is the one of the earlier standalone
driver, with which the hub enumerated at 10 Gb/s. The other SoCs keep
their register accesses: the new layout fields are zero for them, and
the new code runs for T8152 or a fixed-USB3 port only. KUnit cases
check the T8152 crossbar, lane and power block accesses.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The two front USB-C ports sit behind an on-board VL822 hub on usb-drd2.
The hub's USB2 side is on the controller's eUSB2 PHY, which the loader
sets up, and its USB3 side on ATC2's Type-C PHY, wired directly without
a Type-C mux. So far the controller was limited to high speed and the
hub ran at USB2 only.

Describe ATC2's PHY as an apple,t8152-atcphy with apple,fixed-usb3,
hand it to usb-drd2 as its USB3 PHY and drop the controller's high-speed
limit. Nothing changes for usb-drd1 (the back-left port).

The PHY's power domains are ATC2's USB_AON, COMMON_DP_0 and COMMON_DP_1
PMGR power states, in a new node for the ATCs' block of PMGR states at
0x308290000, and its common domain, PSD service 57 (ADT clock-gates
57). The T8152 USB3 bring-up runs the power states without automatic
power management, so they are marked apple,no-auto-pm.

The tunables are the groups of the ADT's atc-phy2 node (26A434) that
apply to USB3 on lane 0, in the order they are applied: the common and
PLL defaults as common-a, the fabric, PLL and USBC0 groups as common-b
and the lane 0 groups as lane0-usb. Some of them differ between the
four ATCs of the same machine, so they likely carry per-device
calibration. There is no atcphy2 alias, as the loader's ATC tunable
copy would replace them with values for another PHY layout.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
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.

6 participants