Repository navigation
nfc: Apple Stockholm NFC/SE controller: identity and power-off on the AOP SPMI bus - #1042
Merged
Merged
Conversation
Some SMC-controlled enables are not plain gPxx GPIOs: they are written as a key with a per-line command template (a lowercase gp bank on T6040, pcIO lines on J700). Describe them with apple,output-templates and drive them through the same gpio_chip, reading back the SMC output latch where the key supports it. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
The NFC controller with embedded secure element on Apple silicon Macs sits on its own SPMI bus and carries NCI packets through a non-incrementing data register. Add a transport that powers it through its VEN line, checks the follower identity with side-effect-free register reads, registers it with the NCI core and parks VEN low whenever the device is closed, which is the controller's lowest power state. The NCI core reads the controller identity on first open. No secure element commands are implemented. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
…nd J700 aop-spmi0 is driven by the application processor (there is no AOP ownership handoff), so give it its interrupt controller and parent interrupt, add the T8140 node, and describe the Stockholm NFC/SE controller at SID 9 with its VEN line on the J616s and J700. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
Use the separate receive FIFO, drain its two-byte wire footer, and report the native diagnostic status registers on a transport error. Drop the unsupported CRC-CCITT transform. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
The corrected wire transport drains its opaque footer without applying a CRC transform, so CRC_CCITT is no longer needed. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
The follower identity register of a model 96 controller reads 0x19 and its IRQ-offset register reads the base of the follower's interrupt block, 0xe0; neither is the SPMI address. Check them against the model data instead of the follower's SID. Seen on the J616s with the controller powered. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
On the J616s a model 96 controller delivers each NCI packet as header and payload only. Reading two more bytes runs into the next packet or past the end of the FIFO, fails the SPMI frame parity check and raises the transport error interrupt. Drain nothing after the payload. Tested on J616s (trial device tree, fleet17 base): CORE_RESET and CORE_INIT complete, the NCI core reports NCI 1.0 and the controller identity, no parity or transport errors, VEN parked low on close. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
Bring the Stockholm branch up to date with integration/aurora 43c790f. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
On the J616s the model 96 controller answers CORE_RESET (NCI 1.0) and CORE_INIT, but CORE_INIT reports no RF interfaces, a zero-size listen mode routing table and no discovery features. The NCI core then sends RF_DISCOVER_MAP with no mappings, which the controller rejects with a syntax error, so nfc0 can never be brought up. There is no NFC antenna on these Macs either: the controller only fronts the embedded Secure Element. Registering an NFC device that can never be powered would only confuse neard and other NFC users. Drop the NCI core registration and make the driver what the hardware supports: check the follower ID and IRQ base, do one CORE_RESET/CORE_INIT exchange to log the NCI version, manufacturer, firmware identity and RF interface count, then disable standby and drive VEN low. The controller stays in that deepest state for the life of the system, so suspend, resume and runtime PM need no callbacks; a failed identity read still parks it. Also drop the unused CRC property from the binding, rename the binding after its compatible, use the Aurora copyright line and add the files to the Apple MAINTAINERS entry. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
The driver holds the Stockholm NFC controller and Secure Element in its deepest power state on the J616s and the J700 once their device trees describe it. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
…616c Use the smc_gpio_low label the J616c already uses for the same bank. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
The ADT places aop-spmi0 at 0x100914000 in the arm-io space, which is 0x310914000 in the SoC address map like every other t8140 arm-io node (nub-spmi0 0xf8714000 -> 0x308714000, smc 0xfc600000 -> 0x30c600000). The node used the arm-io offset as an absolute address. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
No functional change. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
This was referenced Nov 7, 2026
Bring the Stockholm branch up to date with integration/aurora a20af80. #1034 added the same T8140 aop_spmi0 node this branch carries; keep integration's copy (identical node, plus its nub_spmi1 neighbour). Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
RyanTheTide
marked this pull request as ready for review
November 7, 2026 12:49
RyanTheTide
added a commit
that referenced
this pull request
Nov 7, 2026
Brings aurora-wip up to fleet25: DT descriptions (#1029, #1030, #1112), the J715 board (#1129), Stockholm NFC (#1042, #1136), the AV1 tile check (#1100), the M4 Max ANE profile and AVD quirk (#1088, #1091), boot-log fixes (#1103, #1104) and the Neo ANE memory floor (#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 <[email protected]> Assisted-by: LLM
Contributor
Author
|
J616s confirmation on the fleet kernel (2026-11-08 04:53 AEDT): 7.3.0-aurora-fleet27 (integration/aurora 95e30d5) with the integration J616s Stage 2 DTB (e4292d96) committed.
|
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.
What
Linux support for "Stockholm", the NFC controller with an embedded Secure Element (NXP-built) that sits on its own SPMI bus on the M4-generation Macs and the MacBook Neo.
gpio: macsmc: templated SMC output lines, for enables written as an SMC key with a per-line command (the lowercasegpbank on T6040,pcIOlines on J700), with output-latch readback where the key supports it.nfc: apple-stockholm: the controller is follower 9 on the AOP SPMI bus and carries NCI through non-incrementing FIFO registers (transmit and receive are separate registers; receive frames have no trailer). At probe the driver raises VEN, checks the follower ID and IRQ base (side-effect-free reads), does one CORE_RESET + CORE_INIT exchange, logs one line (NCI version, manufacturer, firmware identity, RF interface count), then disables standby and drives VEN low. The controller stays in that deepest power state for the life of the system. It sends no Secure Element commands.asahi.configbuilds the driver.Model-specific transport constants live in the driver's match data; the DT carries only the bus address, interrupts and the VEN line.
Why no NFC device
On the hardware the controller answers CORE_RESET (NCI 1.0) and CORE_INIT, but CORE_INIT reports zero RF interfaces, a zero-size listen-mode routing table and no discovery features (decoded response in the test notes below). The NCI core then sends RF_DISCOVER_MAP with no mappings, which the controller rejects as a syntax error, so an
nfc0could never be powered. There is no NFC antenna on these Macs either: Apple Pay on a Mac is online-only and the controller only fronts the Secure Element. Registering an NFC device that can never come up would only confuse neard and other NFC users, so the driver does not register one. The Secure Element's card manager and applets are Apple's; nothing in it is usable for Linux keys (on-device keys belong to the SEP).This also covers power: whatever state an earlier OS left, the controller is parked off at boot, so suspend, resume and runtime PM need no callbacks.
Testing
Hardware, one-shot only (aura-try trial Stage 2 = the live image with only these DT lines, plus a one-shot kernel; nothing committed, both Macs returned to their fleet kernel and Stage 2):
MacBook Neo (J700), this head's driver (kernel = this branch + a test-only commit that logs CORE_INIT and tries one RF discovery; 11-07 23:44):
NCI 1.0 controller, manufacturer 0x04, firmware 37010160, 0 RF interfaces; parked off;00 | 00 00 02 00 | 00 | 02 | 00 00 | ff | 02 00 | 04 | 60 01 01 37: no RF interfaces, routing table size 0, only the switched-off power state feature;J616s (M4 Pro), earlier revision (11-07 05:55, same transport, NCI core registration still in): CORE_RESET/CORE_INIT OK,
NCI 1.0, manufacturer 0x4, firmware 0x41010160, the same zero-RF CORE_INIT_RSP, and the NCI core's RF_DISCOVER_MAP refused (0x05); VEN low verified on the SMC output latch (gp0e). A J616s run of this head follows when the machine is free.Built on the buildbox: W=1 clean (
apple-stockholm.o,gpio-macsmc.o);dt-doc-validate+ yamllint clean for the new binding andapple,smc-gpio.yaml;CHECK_DTBSon t6040-j616s and t8140-j700: no warnings on the new nodes (only the pre-existing atcphyportslines on J616s). checkpatch --strict clean on the final driver.Not covered
🤖 Generated with Claude Code