Repository navigation
J813: train the N1 Wi-Fi/Bluetooth PCIe link before Linux - #79
Merged
Merged
Conversation
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>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_centauriandbtcentauri.Rebased onto main (077aabe, 2026-11-05). The J813 NVMe change it used to be stacked on is in main as f5831b2.
The sequence follows macOS 25G76
AppleT8142PCIe/APCIECoreRCGen4(decompiled):apcie-phy-tunables, waitrefpll_clk_good(PHY common reg0 bit 31),_initializeGen4Phy(sleep_b_sml/sleep_b_big handshakes on PHY-PHY reg0, PHY IP PLL/AUSPMA tunables, waitmax_pclk_good), PHY enables,apcie-axi2af-tunables.gtb_initialized(0x58).gP13(ADTpKW4('gP13', 0x800000): 0x800000 | level)._resetPortHardwarewrites,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_dtonly when the FDT has an enabledpci-host-ecam-genericnode 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#998 and #1001.Rebased onto main 077aabe (2026-11-05): the image builds with
USE_CLANG=1 RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1andmake format-check/make rustfmt-checkpass. A new Mach-O object from this rebase has not been enrolled on the J813 yet, so the runtime testing above is from the pre-rebase build.cc @Acelogic @DjDeveloperr @RyanTheTide @LiamRay10