Repository navigation
J873g: USB4 with hotplug on the rear USB-C ports (T8152 routers, PCIe-C, port monitor; M6 Mac mini) - #2178
J873g: USB4 with hotplug on the rear USB-C ports (T8152 routers, PCIe-C, port monitor; M6 Mac mini)#2178sithglan wants to merge 138 commits into
Conversation
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
The driver powered the PS190 DisplayPort-to-HDMI converter through the SMC only when a DCP took the shared HDMI port, and a DCP takes the port once the HDMI HPD line goes high. The PS190 drives that line only while it is powered. The AP AUX controller that reads the USB-C monitors' EDID also gets no reply from any USB-C port while the PS190 is off: every request ends with AUX channel status 2, a timeout. Both only worked because the bootloader's HDMI setup had already powered the PS190. When the bootloader's display setup failed before that point, Linux never saw the HDMI monitor, and the USB-C monitors came up without an EDID, at 1920x1080 and 1680x1050 instead of 2560x1440 and 1920x1200. Power the PS190 when the shared HDMI port is set up in probe, before the DCP is started. If the SMC is not bound yet, defer the probe. Tested on the J873g with the bootloader's internal DCP start failing on purpose (AFK init after the RTKit boot), with HDMI and two USB-C EIZOs connected. Before this change: HDMI HPD low, and the EDID reads failed on both USB-C ports. Writing the SMC values by hand made HPD go high within 200 ms, and DPCD and EDID then read fine on both ports. With this change the same boot brings up HDMI at 2560x1440@60 on the main DCP, and the USB-C monitors at 2560x1440@60 and 1920x1200@60, each from its EDID. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Only the main DCP and DCPEXT0, the two source selects aura uses, took the shared HDMI port. After a boot without the bootloader's HDMI, a monitor plugged into HDMI later stayed dark whenever the main DCP and DCPEXT0 held the two USB-C monitors. Which DCPs end up with those depends on which one polls first when the slower monitor shows up. DCPEXT1 was then free but could not take the port. The phy's source select also takes DCPEXT1's crossbar endpoint, 2. Share the port with every DCP. Tested on the J873g, booted without HDMI, with a test build in which only DCPEXT1 takes the HDMI port and DCPEXT1 stays off the USB-C ports. The main DCP and DCPEXT0 drove the two USB-C EIZOs. With HDMI plugged in, DCPEXT1 took the port, started the phy from cold with source select 2, trained four lanes at HBR3, read the EDID and ran 2560x1440@60. The monitor showed the desktop. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The loader reports whether the internal DCP's RTKit was running at the hand-off (1) or whether it quiesced the coprocessor after a failed display setup (0). apple,dcp-rtkit-quiesced carries the same values under a name that reads the other way round, so the T8152 loader and apple_dcpib use this name instead. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
…ning The loader now publishes the internal DCP's RTKit state at the hand-off as apple,dcp-rtkit-running, 1 running and 0 quiesced, the values that apple,dcp-rtkit-quiesced carried under a name that read backwards. Read the new name. A loader that publishes neither falls back to the existing check for the older J873 loader build. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Describe the PSD service 50 register bank shared by Kopsia and its DART. The service has separate request, state and acknowledgement registers and supplies one power domain. Its initial driver only supports power-on. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8152 decoder and its DART start powered down and do not use the legacy PMGR power-state register protocol. Request active state through PSD service 50, wait for ACK before reading STATE (which consumes ACK), and expose a shared genpd so the DART probes after power is available. Keep the domain always on. Power gating, reset and system-sleep recovery have not been qualified on this hardware. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The AVD Gen3 DART uses the shared TLBI aperture like the display DARTs, but Linux initializes it from an unlocked state with inactive streams. Require its PSD power domain, DMA aperture and initialization tunables. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Admit cold Gen3 setup only for the instance its apple,t8152-avd-dart compatible selects, with version 0x300, 16 streams, its PSD domain, ADT tunables and inactive streams 0..2. Clear those streams, apply their tunables and use the Gen3 TLBI aperture before enabling translation. Map the TLBI aperture before reset and select a two-level 16K page table inside a single 64 GiB high DMA window. Keep the existing locked display DART admission and all other unlocked Gen3 instances unchanged. On J873g this maps all three decoder streams for bit-exact H.264, HEVC, HEVC Main10, VP9 and AV1 decoding. Gen3 fault IRQ handling and suspend recovery remain outside this initial bring-up. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Describe the Kopsia MCU, decoder, wrapper and PIODMA register apertures, its three DART streams and its shared PSD power domain. The initial transport submits from the host with the MCU halted and polls completion; it does not use the PostOffice mailbox or the legacy decoder reset line. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
T8152 Kopsia retains the T8142 codec program format but uses different initialization and completion registers. Add a host backend that halts the MCU, initializes the wrapper and PIODMA, and reuses the existing codec submission and completion logic with one frame in flight. Poll VP/PP status only while a frame is active. Enable H.264, HEVC, VP9 and AV1 on this variant without an external firmware image. Retain the 128-byte H.264 MV and HEVC v5 header quirks. Disable recovery reset: the existing watchdog parks DMA and retires the decoder instead of issuing an unqualified reset. The 346 register tunables are unchanged from the MIT-licensed avd-fw v5/tier2 table. On J873g, forced DRM PRIME decode and download compares exactly with software for 60 frames of each codec, including HEVC Main10; mpv also renders through DRM PRIME and seeks in both directions. This is initial bring-up: PostOffice completion, runtime power gating, suspend/resume and fault-injection testing remain outstanding. Link: https://github.com/aurora-silicon/avd-fw/blob/ea3a65cc9c0c41907e6ad2714b813e4be6858485/src/hw/tunables/tunables_v5t2.h Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Describe the T8152 Kopsia decoder in the SoC peripherals, disabled, so every T8152 board can enable it: its five register banks, PSD service 50 as the power domain shared by the decoder and its DART, and the DART as the apple,t8152-avd-dart instance with its Gen3 TLBI aperture, its initialization tunables and a 64 GiB window at 1 TiB inside the native 1..4 TiB DMA aperture. The tunables are those of the J873g's ADT. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Enable the T8152 decoder, its PSD domain and its DART on the J873g. This enables the request decoder node used by FFmpeg and mpv on the M6 Mac mini. The PSD provider supplies both AVD and DART so translation is initialized only after their shared domain is powered. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Allow the five ACIO register windows, LSTX GPIO and router firmware tunables used by T8142. Describe its native PCIe-C compatible and require the shared MSI vector base. Include the T8142 pinctrl fallback chain used by the AOP LSTX pin. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
T8142 uses the Intr2AXI controller layout but its three-cell AIC interrupt specifier and MSI window differ from T6050. Match it natively and validate the 32-vector slice against the port ECAM aperture and AIC base 1741. This allows a tunnelled NVMe controller to allocate working MSI-X interrupts. The AIC base of the shared MSI window is part of the match data (1506 for T8132, 1741 for T8142), so the slice check selects these two by their controller compatible instead of the machine. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Each T8152 USB4 router's coprocessor has a 0x80-byte mailbox window with the counted FIFOs of the SMC mailbox, at offset 0x80 of its register block. Describe it with apple,t8152-smc-mailbox as the fallback, so the SMC mailbox's match data serves it, and with its send-empty and recv-not-empty interrupts. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8152 CIO reset block resets the rear USB4 routers of the J873g. It has a request and an acknowledge register instead of T8142's control register, so it gets its own compatible. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The rear USB4 routers, their PCIe-C tunnels and the ATC common blocks are PSD services like the AVD's. They switch between state 0 and the cold state 6, because a router reconfiguration only completes from a cold domain. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The DARTs of the J873g rear USB4 routers (NHI streams) and of their PCIe-C tunnels are Gen3 DARTs that start unlocked with inactive streams, like the AVD's. Each has its own slot in the shared TLB invalidation aperture, and its ADT tunables and DMA window. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The PCIe-C ports tunnelled through the J873g rear USB4 routers are laid out like T8142's: Intr2AXI MSI slices, the T6050 tunnel controls, and no port reset of their own. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Add the T8152 ACIO and NHI. The T8152 router CPU is started by a reconfiguration request through its mailbox, so it has no cpu window. A second range maps the shared Gen3 TLB invalidation aperture for the router's DART. Describe a J873g rear USB-C port as its USB4 router sees it. The port has no Type-C driver, because the display driver owns its PD controller for DisplayPort alternate mode. The node gives the ATC PHY, its PMGR power states and PSD service, the PD controller, and the ADT tunables for CIO mode, linked to the router's Thunderbolt switch. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8152 CIO reset block requests a router reset in register 0x68 and acknowledges it in 0x6c. Wait for the router's pair of busy bits to clear, request, wait for the acknowledgment and clear it. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Keeping the CIO PSD services powered makes the next router reconfiguration request stick, and the router start times out. Return them to their cold state 6 when their users stop, and power them on only when the router starts, after the PHY is configured. The AVD domain stays always on. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The DARTs of the T8152 USB4 routers and their PCIe-C tunnels start unlocked with inactive streams, like the AVD's. Initialize the instances their compatibles select the same way: - ACIO DART (apple,t8152-acio-dart): NHI streams 0-11 and 16-27. - PCIe-C DART (apple,t8152-pciec-dart): translated streams 0-252, with 253 and 255 in bypass for host transactions and MSI writes to the AIC (the ADT reserves them), firmware's stream 254 preserved, 16K pages, 42-bit addresses. Without the bypass on 255, NVMe completions were polled and the DART faulted at the AIC. Each DART invalidates through the TLBI slot its "tlbi" resource names. The slot has to be the port's own: with port 3's slot on port 1's DART, reads returned wrong data with DART faults. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8152 tunnelled PCIe-C ports use the T6050 tunnel controls with the Intr2AXI MSI path, like T8142. Their shared MSI window starts at AIC 1879, which goes into the match data next to T8132's and T8142's. The 32-vector slices are 0x60 for the bridge at ECAM 0x1c50000000 (CIO0), 0x80 at 0x1c60000000 (CIO1) and 0xc0 at 0x1c80000000 for CIO3, the third bridge that only T8152 has. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8152 router is a Type 7 MXWrap-v2p3 that a reconfiguration request starts through its counted mailbox. Its DP IN path is not qualified. Release the CIO domains in reverse order and suspend each one synchronously, because deleting the device link only queues an idle request: the PHY reset and the next router start need them cold. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873g's rear USB-C ports have no Type-C port driver, because the display driver uses their ACE3 PD controllers for DisplayPort alternate mode. Add a monitor that polls a port's controller every 250 ms, under the controller's device lock: - A USB4 cable (STATUS plug, DATA_STATUS bit 23): power the ATC up (USB AON, the common block's PSD, DP_0, DP_1) and take the PHY only when its CIO control shows it idle. Apply the ADT tunables, configure both lanes and the crossbar for the orientation, then hand the cable with its EUDO to the router's Thunderbolt switch. - An unplug or a changed cable: stop the router, then run the firmware's CIO shutdown and return the PSD to its cold state, so the next cable starts cold. A switch notification asks for a fresh poll, which catches a reconnect shorter than the poll period. - No cable: wake a sleeping controller with SSPS 0, otherwise it never reports one. - An upstream host (the debug USB link) is left alone. Setup failures are retried three times per cable. A reboot notifier stops the router before the PCIe and DART devices shut down. sysfs "state" shows the PD registers and counters; "enabled" stops and restarts a port. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Describe the three rear USB4 routers (ADT acio0, acio1, acio3) with their mailboxes, NHI, ACIO DARTs, PCIe-C tunnels and their DARTs, the CIO reset block, the PSD services they need, the LSTX pins, and one port monitor per rear USB-C port. Generated from the J873g ADT, including the router, NHI, DART and PCIe-C tunables and the router DROMs, whose UID field is the port index. The ATC PHY tunables are the atc-phyN groups, at the PHY register blocks they apply to. Each router coprocessor's mailbox has apple,t8152-smc-mailbox as its fallback and the two interrupts of the ADT's acio-cpuN node, which list send-empty first, as the SMC mailbox's do. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Build the monitor that starts USB4 on the rear USB-C ports of the M6 Mac mini (J873g), next to the Apple USB4 router driver. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
756f397 to
d134970
Compare
|
Thanks. Two of the three points are done, and the stack is rebased onto the current #2176, #2139 and #2142 (head
Checks on this head:
This head has not run on the J873g yet. The routers now depend on the mailbox interrupts firing in that order, which the M6 run will confirm. One owner of the PD controllers. I agree, and the tree already has the owner:
The port monitor and |
USB4 (Thunderbolt) on the three rear USB-C ports of the M6 Mac mini (J873g, T8152), with hotplug. A USB4 NVMe enclosure works on any rear port, in either orientation, plugged at boot or later.
Stacking. This is stacked on #2176 (three displays, itself on #1800), because the J873 SPMI bus, its PD controllers and
pinctrl_aopcome from the display DT. It also carries #2139's eight Kopsia/AVD commits (the cold Gen3 DART and PSD paths this extends, in their 19 Nov version) and two commits from #2142 in their current version: the T8142 USB4/PCIe-C bindings and "PCI: apple: support T8142 PCIe-C MSI slices". Only the top 14 commits are new.What it adds
"apple,t8152-cio-mailbox", "apple,t8152-smc-mailbox"with the two interrupts of the ADT'sacio-cpuNnode, so the SMC mailbox's match data serves it on its interrupts.apple,t8152-acio-dart/apple,t8152-pciec-dartcompatibles. Each invalidates through the TLBI slot itstlbiresource names.apple-t8152-usb4-portdriver: the J873's rear ports have no Type-C driver, becauseapple_dcpibdrives their PD controllers for DP alt mode. The driver polls each port's PD controller under its device lock. On a USB4 cable it brings the ATC PHY up in CIO mode with the ADT tunables and hands the cable to the router's Thunderbolt switch. On unplug it stops the router and runs the firmware's CIO shutdown, so the next cable starts cold. Sleeping controllers are woken with SSPS 0; the upstream (debug) host is left alone. A reboot notifier stops the router before PCIe and DART shut down. sysfs exposesstateandenabled.t8152-j873-usb4.dtsi, generated from the J873g ADT, plus bindings for every new compatible.Hardware qualification
During bring-up (17 Nov) the same register sequences ran in a private helper module with an ADT-generated DTB. UGREEN ASM2463 enclosure with a Samsung 980 PRO 2 TB:
This PR's version
rangestranslation, including the TLBI slots 0x100/0x180/0x280. The only changes were the J813-styleacio@layout and the mailbox compatible. The PHY tunables are the qualified tables.pcie-tunnel-N, but apple-dart recognizes a tunnelled PCIe-C DART by itsusb4-pcie-tunnel-parent, so the DART failed to probe and NVMe timed out. Both now follow the ADT and the other SoCs' naming, and the DTB comparison checks node names too.Not covered: system sleep with an enclosure, DP tunnelling over USB4, and two enclosures at once.