Skip to content

J813: train the N1 Wi-Fi/Bluetooth PCIe link before Linux - #14

Closed
sithglan wants to merge 1 commit into
aurora-silicon:mainfrom
sithglan:thomas/j813-n1
Closed

sithglan wants to merge 1 commit into
aurora-silicon:mainfrom
sithglan:thomas/j813-n1

Conversation

@sithglan

@sithglan sithglan commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Brings up apcie port 0 to the N1 (Wi-Fi/Bluetooth) on T8142 (MacBook Air M5, J813) before the Linux handoff, so Linux can use the root port as a generic ECAM host with apple_centauri and btcentauri.

Rebased onto main (2026-11-02). The J813 NVMe change it used to be stacked on is in main as f5831b2.

The sequence follows macOS 25G76 AppleT8142PCIe / APCIECoreRCGen4 (decompiled):

  • AUS5 PHY: apcie-phy-tunables, wait refpll_clk_good (PHY common reg0 bit 31), _initializeGen4Phy (sleep_b_sml/sleep_b_big handshakes on PHY-PHY reg0, PHY IP PLL/AUSPMA tunables, wait max_pclk_good), PHY enables, apcie-axi2af-tunables.
  • Root complex: RC 0x54 = 0x140, 0x50 |= 1, wait gtb_initialized (0x58).
  • N1 reset release via SMC gP13 (ADT pKW4('gP13', 0x800000): 0x800000 | level).
  • Port 0: _resetPortHardware writes, apcie-config-tunables, port enable, endpoint refclk buffer on the port PHY lane reg 0 (_initializeRefclkBuffer), PERST, lane PIPE reset, RUN, root port DBI tunables, LTSSM.

ADT reg map from AppleT8142PCIe::start: 0 ECAM, 1 APCIe common, 2 PHY (common block at +0x4000 — reg[2]+0 bus-errors), 3 PHY-PHY, 4 PHY IP, 5 AXI2AF, port 0 from 8 (10 = PHY glue). Without the refclk buffer the LTSSM never leaves detect.

It runs from kboot_prepare_dt only when the FDT has an enabled pci-host-ecam-generic node on T8142, and disables that node if any step fails (Linux would hang on its first config access to an untrained link).

Tested on a MacBook Air M5 through the ESP boot path, no host steps: j813-n1: link up (0x9a001001), endpoint 106b:1900, then Linux brings up Wi-Fi (WPA2-PSK, DHCPv4 + SLAAC, ~6 MB/s) and Bluetooth (hci0, LE discovery). The Linux side is aurora-silicon/linux#809 and #812.

cc @Acelogic @DjDeveloperr @RyanTheTide @LiamRay10

On T8142 (MacBook Air M5, J813) bring up apcie port 0 to the N1 when the
FDT describes a pci-host-ecam-generic host, so Linux can use the root
port as a generic ECAM host. The sequence follows macOS 25G76
AppleT8142PCIe / APCIECoreRCGen4: AUS5 PHY tunables and power-up
(sleep_b handshakes, PHY IP PLL/AUSPMA tunables, max_pclk_good), root
complex, N1 reset through SMC gP13 (pKW4, 0x800000 | level), port reset,
config tunables, the endpoint refclk buffer on the port PHY lane, PERST,
root port DBI tunables and the LTSSM.

The PHY common block sits at ADT reg[2] + 0x4000; reg[2] + 0 bus-errors.
Without the refclk buffer the LTSSM never leaves detect.

If any step fails, the ECAM host is disabled in the FDT: Linux would hang
on its first config access to an untrained link.

Tested on J813 through the ESP boot path: "link up, endpoint 106b:1900",
then Linux's apple_centauri brings up Wi-Fi (WPA2, DHCP) and btcentauri
Bluetooth.

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

sithglan commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #79: the same work rebased onto main 077aabe.

@sithglan sithglan closed this Nov 5, 2026
dmitzsaz pushed a commit to dmitzsaz/aura that referenced this pull request Nov 6, 2026
kboot: reserve the T8122 dcpext firmware only with chosen.asahi,t8122-dcpext=1
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