Repository navigation
J700: bring up Wi-Fi and Bluetooth without boot options or an admission script - #204
Merged
Merged
Conversation
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]>
This was referenced Oct 8, 2026
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.
On the MacBook Neo (J700), Wi-Fi and Bluetooth stay off unless the boot entry and userspace go through the documented admission sequence:
CONFIG_PCIE_APPLE_PIODMA_DIAG=yand boot withpcie_apple_piodma_diag.enumerate=1;performancepolicy;mt7932-fullmac;mt7932_bt_pcie enable=1.A kernel without those steps stops at the root port:
root-port probe only; downstream config is blocked, with nowlanand nohci0.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
pcie_apple_piodma_diag.enumeratenow defaults to on, andenumerate=0keeps the root-port-only path for diagnosis.pci_bus_add_devices()and returned-EBUSYif a driver had already bound. It then closed downstream config access under that driver.regulatory.db.enable) defaults to on, and the transport also disables ASPM on the link.RFKILL=m.j700-radio.configsetsCFG80211=m.5 GHz and station addresses
-EBUSYuntil then, so the activation failed.Review fixes
apple,piodma. The port no longer logs "downstream config blocked" when the bootstrap is about to open it.mt7932-fullmacis bound to function 0. This replaces the module soft dependency, which a built-in driver, insmod or asynchronous probing bypassed.modprobe -r mt7932_bt_pcieno longer unloads Wi-Fi.No device-tree, binding or firmware-path changes. The board DT's
wifi0local-mac-addressis filled by m1n1 from the ADT. Firmware, calibration and country packages stay local files under/lib/firmware, as documented inmt7932-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
Assisted-by: LLMtrailer-format warning.git diff --checkis clean.W=1and no warnings.defconfig+asahi.config+j700-radio.configresolves as intended, with no warnings;MT7932_FULLMAC=ywithRFKILL=mno longer warns.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.mt7932-fullmac.An earlier boot of the first four commits had shown the same bring-up, but only 2.4 GHz on this network.
Known limits
🤖 Generated with Claude Code