Skip to content

J700: bring up Wi-Fi and Bluetooth without boot options or an admission script - #204

Merged
RyanTheTide merged 12 commits into
aurora-wipfrom
j700/radio-bringup
Oct 8, 2026
Merged

RyanTheTide merged 12 commits into
aurora-wipfrom
j700/radio-bringup

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

On the MacBook Neo (J700), Wi-Fi and Bluetooth stay off unless the boot entry and userspace go through the documented admission sequence:

  • build CONFIG_PCIE_APPLE_PIODMA_DIAG=y and boot with pcie_apple_piodma_diag.enumerate=1;
  • select the global PCIe ASPM performance policy;
  • load mt7932-fullmac;
  • load mt7932_bt_pcie enable=1.

A kernel without those steps stops at the root port: root-port probe only; downstream config is blocked, with no wlan and no hci0.

This series makes the kernel do that sequence on its own. The board device tree selects the radio, udev autoloads both drivers, and no command-line option or admission script is needed. It also reaches 5 GHz channels above 48, and lets NetworkManager's per-network station addresses work.

Bring-up

  1. PCI: apple: run the J700 radio bootstrap by default. pcie_apple_piodma_diag.enumerate now defaults to on, and enumerate=0 keeps the root-port-only path for diagnosis.
  2. PCI: apple: let drivers bind the J700 radio functions. The cold-state check (no bus mastering) now runs before the two functions are published. Before, the host checked after pci_bus_add_devices() and returned -EBUSY if a driver had already bound. It then closed downstream config access under that driver.
  3. wifi: mt7932: disable ASPM on the J700 radio link. The driver turns off ASPM and clock power management on its own link. Before, userspace had to change the global policy first. The docs now say to build the driver as a module and explain how cfg80211 finds regulatory.db.
  4. Bluetooth: mt7932: probe the J700 transport by default. The probe gate (enable) defaults to on, and the transport also disables ASPM on the link.
  5. wifi: mt7932: depend on cfg80211 instead of selecting it. This avoids forcing cfg80211 built in, which warned about an unmet dependency with RFKILL=m. j700-radio.config sets CFG80211=m.

5 GHz and station addresses

  1. wifi: mt7932: support the 5 GHz channels above channel 48.
    • The station now advertises every 20 MHz primary in 36–64, 100–144 and 149–165, with correct 40/80 MHz pairing. Channel 165 stays at 20 MHz. The cfg80211 regulatory domain decides which channels are usable.
    • The same pairing decodes association channel events and selects the unit's own calibration records, which cover the whole band.
    • Radar (DFS) channels used to make the driver refuse the whole regulatory domain.
      • They now go to the firmware with their cfg80211 flags.
      • They are scanned passively while not associated, never probed, never joined, and skipped by scans made while associated.
      • DFS client operation is not qualified.
    • A channel with a restriction the driver cannot apply, such as a power cap below the qualified 20 dBm, is disabled on its own instead of blocking every channel.
  2. wifi: mt7932: honour the channel permissions of the country package. The per-country package already sent to the firmware leaves every power limit undefined for a channel the country forbids. Examples: UNII-3 in Japan, UNII-2e in China, 120–128 in Australia, 144 in most of Europe. Such channels are now left out of the firmware domain and disabled in cfg80211.
  3. wifi: mt7932: let an address change wait for a retiring scan.
    • NetworkManager sets a per-network address by taking the interface down. Fedora's default is a stable per-SSID address.
    • Taking the interface down cancels a scan, and the firmware retires that scan asynchronously.
    • The driver used to refuse the change with -EBUSY until then, so the activation failed.
    • On a down interface it now waits up to 2 s for the retirement.

Review fixes

  1. PCI: apple: keep T8140 hosts without a bootstrap link root-port-only. The bootstrap is looked up only when the host's DT has apple,piodma. The port no longer logs "downstream config blocked" when the bootstrap is about to open it.
  2. PCI: apple: remove the J700 radio functions when publication fails.
    • If the memory-window or cold check fails, the host now removes the scanned functions before it closes config access.
    • A later rescan therefore cannot publish them through a closed window.
    • Both functions are checked and quiesced.
  3. Bluetooth: mt7932: wait for the Wi-Fi function before starting.
    • The transport defers its probe until mt7932-fullmac is bound to function 0. This replaces the module soft dependency, which a built-in driver, insmod or asynchronous probing bypassed.
    • It adds a device link, so the driver core unbinds Bluetooth before Wi-Fi.
    • modprobe -r mt7932_bt_pcie no longer unloads Wi-Fi.
    • Bluetooth stays unbound while Wi-Fi is missing or failed, which matches the qualified sequence.
  4. wifi: mt7932: warn when link power management cannot be disabled. Bluetooth does the same in commit 11.

No device-tree, binding or firmware-path changes. The board DT's wifi0 local-mac-address is filled by m1n1 from the ADT. Firmware, calibration and country packages stay local files under /lib/firmware, as documented in mt7932-neo.rst.

Recommended configuration is arch/arm64/configs/j700-radio.config: PCIE_APPLE_PIODMA_DIAG=y, CFG80211=m, MT7932_FULLMAC=m, BT_MTK7932_PCIE=m, BT_LE=y.

Provenance: written for this tree; tested on the MacBook Neo (J700).

Checks

  • Strict checkpatch on every commit: only the project's Assisted-by: LLM trailer-format warning.
  • git diff --check is clean.
  • Every commit compiles the touched objects with W=1 and no warnings.
  • Full arm64 J700 builds (Image, modules, DTB) have 0 warnings.
  • Kconfig spot-checks:
    • defconfig + asahi.config + j700-radio.config resolves as intended, with no warnings;
    • MT7932_FULLMAC=y with RFKILL=m no longer warns.
  • Host tests of the channel helpers: all 25 primaries; 40/80 MHz centres and calibration centres match the unit's calibration records.
  • Host tests of the country-package filter on the real packages: AU drops 120–128, JP drops 149–165, CN drops 100–144, DE drops 144, and US and the world package keep all channels.

Tested on the MacBook Neo

The final series was merged with current aurora-wip (df7801c436ca) and booted once, one-shot, on the public device tree. There were no radio boot options and no admission script.

  • PCIe: the bootstrap validates and both functions are published at 1.4 s.
  • Drivers:
    • After the root filesystem mounts, udev loads cfg80211 and mt7932-fullmac.
    • The Bluetooth transport starts only after the Wi-Fi firmware is up.
    • ASPM is disabled on the link, and the loader-provided MAC is used.
  • Regulatory: the distribution hook sets AU. The firmware domain holds 35 channels: 120–128 are excluded, and 13 DFS channels are passive.
  • 5 GHz:
    • The station joins the test network's 5 GHz access point on channel 149 (5745 MHz, −46 dBm).
    • Gateway ping: 58/60 at a 0.5 s interval, average 5.5 ms. 20/20 in the earlier check.
    • HTTPS works.
  • Scans: while associated, scans skip the DFS channels. Scans made while not associated listen on them passively.
  • NetworkManager addresses: the per-network address goes permanent → stable → permanent. Each step reconnects, with 0 address-change failures.
  • Bluetooth: registers, powers on with its existing address and scans. No pairing was attempted.
  • Health: no faults and no failed units.

An earlier boot of the first four commits had shown the same bring-up, but only 2.4 GHz on this network.

Known limits

  • The bootstrap is one-shot and retained until a full reset; there is no removal, kexec or hibernation support.
  • DFS client operation is not supported yet.
  • While associated, wpa_supplicant runs a background scan about every 30 s. The likely cause is that the driver has no CQM RSSI reporting yet, so wpa_supplicant stays on its short interval. Each scan causes a brief latency spike, which is most visible on 2.4 GHz.
  • The Bluetooth address and calibration still come from local files.

🤖 Generated with Claude Code

The J700 Wi-Fi and Bluetooth functions sit behind port 0 of the T8140
PCIe host, which only opens downstream configuration access after the
PIODMA bootstrap has completed. The bootstrap provider is already
selected per board: it only binds on J700, and only when the device tree
points the host's "apple,piodma" property at the engine. It nevertheless
also required pcie_apple_piodma_diag.enumerate=1 on the kernel command
line, so a kernel built with the provider still left both radio
functions undiscovered unless the boot entry carried that option.

Make the device tree the switch and run the bootstrap by default.
Keep the parameter so enumerate=0 still selects the root-port-only path
for diagnosis, and update the Kconfig help and documentation to match.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
After the J700 bootstrap, the host adds both radio functions to the
bus and only then checks that neither is bus mastering and that neither
has a driver. If either function has a driver by then, the host reports
-EBUSY and closes downstream configuration access again, under a driver
that has already bound and started using the function. That happens
with a built-in driver, or with a module that udev loaded while the bus
was being scanned.

Check the cold state, with bus mastering off, before the functions are
added and their drivers can probe. Treat drivers binding during
publication as the normal outcome. Do not report the host as
root-port-only once a bootstrap supplier has been found.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
On devicetree platforms the PCI core enables ASPM L0s/L1 by default.
The station driver was qualified with the PCIe ASPM "performance" policy
selected before it was loaded, so the documented admission sequence had
userspace change that global policy first. If the module is autoloaded,
nothing changes the policy.

Disable all ASPM and clock power management states on the link before
the driver starts the device, as other MediaTek PCIe Wi-Fi drivers do.
This removes the userspace step and leaves the policy for other links
alone.

The function is probed before the root filesystem is mounted, and the
driver reads its firmware while probing, so recommend building it as a
module. Document that, and how cfg80211 finds the regulatory database.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The transport only probes after userspace loads it with enable=1, so an
autoloaded module leaves the Bluetooth function unbound. The gate was
meant to keep the probe away until the root filesystem holds the unit's
firmware and calibration. A module already loads from the root
filesystem, and the probe validates a cold, unbound function before it
starts. Open the gate by default and keep enable=0 to leave the function
unbound.

The documented admission sequence also selected the PCIe ASPM
"performance" policy and loaded the Wi-Fi driver first. Disable ASPM and
clock power management on the link in this probe as well, so the
transport does not depend on the Wi-Fi driver for it. Add a module soft
dependency so that modprobe loads mt7932_fullmac, which probes function
0, before the transport, keeping the tested firmware start order when
udev loads both.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
MT7932_FULLMAC selects CFG80211. Built in, that forces CFG80211=y even
when RFKILL=m, and Kconfig then warns about an unmet dependency, because
CFG80211 depends on RFKILL || !RFKILL. Wireless drivers normally depend
on CFG80211 rather than select it. Do the same, so that cfg80211's own
constraints decide whether the driver can be built in.

The J700 radio fragment relied on the select. Enable cfg80211 there as a
module, which also lets it load regulatory.db from the root filesystem.
Record the modular cfg80211 in the tested configuration.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The station only advertises 5 GHz channels 36 to 48, so access points
on UNII-2, UNII-2e or UNII-3 channels are invisible. On the MacBook Neo
used for testing, the network's 5 GHz radio is on channel 149, and the
station falls back to its 2.4 GHz radio.

Advertise every 20 MHz primary from 36 to 64, 100 to 144 and 149 to 165,
and let the cfg80211 regulatory domain decide which are usable. Each
gets its 40 and 80 MHz pairing (165 stays at 20 MHz). The same pairing
is used to decode association channel events and to pick the unit's own
calibration records, which cover the whole band.

Radar channels were previously rejected by refusing the whole regulatory
domain. Pass them to the firmware with cfg80211's flags instead, and
keep the station passive there. cfg80211 marks them RADAR, not NO_IR, so
scans listen on them without probing. Scans made while associated skip
them, and connects never target them: DFS client operation is not
qualified, and a passive dwell only takes time away from the home
channel. A channel whose limits the driver cannot apply, such as a power
cap below the qualified 20 dBm, is now disabled on its own rather than
blocking every channel.

The firmware scan request has 32 channel slots, which holds the larger
5 GHz list in one batch. A scan request left with no eligible channel
now completes at once.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The country package that the driver sends to the firmware has a
per-rate power limit table for every channel. Where a country does not
permit a channel, every limit of that channel is undefined. Examples are
UNII-3 in Japan, UNII-2e in China, 120 to 128 in Australia and 144 in
most of Europe. The driver still listed such channels in the firmware
domain whenever the cfg80211 regulatory domain allowed them.

Drop channels the loaded package does not permit from the firmware
domain, and disable them in cfg80211 too, so that scans and connects do
not offer them. cfg80211 recomputes channel flags on each regulatory
change, and the package is reloaded for each change, so the two stay in
step.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
NetworkManager sets a per-network station address before each
connection by default: Fedora uses a stable per-SSID address. It takes
the interface down, changes the address and brings the interface back
up. Taking the interface down cancels any running scan, but the
firmware completes the cancellation asynchronously. Until then the
driver refuses the address change with -EBUSY, so the activation fails
with "set-hw-addr: failed to set-cloned MAC address" and NetworkManager
moves on to another profile.

When the interface is down, wait for the scan to retire, for up to two
seconds, before checking whether the address can change. Changes on a
running interface are still refused, as eth_mac_addr() requires. Log
the busy state at debug level when a change is still refused.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
With the J700 bootstrap on by default, every T8140 host now looks up its
"apple,piodma" engine. A host whose device tree has no such property
fails its probe with -EINVAL instead of falling back to the root-port-only
path. That is the opposite of the intent that the board device tree
selects the bootstrap.

Only look up a supplier when the property is present. A property that
names a missing or wrong engine still fails the probe. Also stop logging
"downstream config blocked" for the port of a host whose bootstrap is
about to open it.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
If the root memory-window check or the cold check fails after the
downstream scan, the host closes downstream configuration access but
leaves both functions on the bus, scanned and unpublished. A later bus
rescan would publish them and let their drivers probe through a closed
config window, with memory decoding off.

Remove the scanned functions, while still holding the rescan lock and
before closing configuration access. A later rescan then finds nothing.
Also check and quiesce both functions in the cold check instead of
stopping at the first failure, so that a second function left bus
mastering is cleared too.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Bluetooth admission was qualified with the Wi-Fi function already
running its firmware. The module soft dependency added for that only
orders a modprobe of both modules. A built-in transport, insmod,
asynchronous probing or a failed Wi-Fi probe all bypass it. Removal is
affected too: "modprobe -r mt7932_bt_pcie" now also unloads the Wi-Fi
driver, as kmod removes pre-softdeps after the module.

Enforce the order in the driver instead. Defer the probe until
mt7932-fullmac is bound to function 0, and add a device link so that
the driver core unbinds Bluetooth before Wi-Fi. Drop the soft
dependency. Bluetooth now stays unbound while the Wi-Fi driver is
missing or failed, which matches the qualified sequence.

Also warn when the link's power management cannot be disabled, and
update the help text and documentation, which still called the
transport opt-in.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
pci_disable_link_state() fails when the OS has no ASPM control, for
example with pcie_aspm=off. The link is then left as the firmware set
it up, while station operation was qualified with it disabled. Report
that instead of ignoring the error.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
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