[PATCH v4 0/6] nfc: s3fwrn5: support the S3NRN4V variant
From: Jorijn van der Graaf
Date: Thu Aug 06 2026 - 22:16:18 EST
This adds support for the Samsung S3NRN4V, a later part in the Samsung
NCI NFC controller line the s3fwrn5 driver covers, found e.g. on the
Fairphone 6 (SM7635).
The S3NRN4V differs from the already-supported parts in three ways:
it ships with working firmware, and its bootloader reports a hardware
version the driver has no flash base address for (so the firmware
download step is skipped); it loads its RF calibration data through
a different proprietary command (DUAL_OPTION); and its reference
clock speed is set with the single-byte FW_CFG form the vendor HAL
uses on this generation.
Patches 1-2 are preparatory cleanups from the v2 review; patch 3 adds
the compatible to the binding and documents the PVDD supply; patch 4
makes the driver enable that supply; patch 5 implements the variant;
patch 6 adds the Fairphone 6 board nodes -- included so the hardware
can be tested, per David's v2 request; it depends on patch 3 and is
expected to be picked up via the qcom tree (linux-arm-msm) once the
binding has landed.
Tested on a Fairphone 6 running a milos-mainline kernel: reader mode
polls and reads ISO 14443-4 tags reliably, from a fresh boot and
across driver reloads, with the calibration files present and also
absent (the chip keeps its stored calibration and still reads).
The v4 driver and board nodes were re-verified the same way. The
test kernel is v7.1.2-based and predates this base's net/nfc/nci
fixes: response/notification parse hardening (rsp.c, ntf.c) and a
data-completion race fix (data.c), none changing behaviour for
well-formed traffic; the rest of the delta (a conn-close leak fix
for dynamic NCI connections this driver never creates, LLCP,
nfc-digital, the UART transport) is off the NCI/I2C path this
driver uses.
Luca, you were right about the clock: the schematic net into the
chip's XI is PMK_CLK7_LN_NFC. On your "always on anyways" half: not
quite, but not simply our vote either -- v3 voted RPMH_RF_CLK2 and
still read tags, and only with no clocks property at all does the
chip stop activating tags. A clock vote is required; what keeps
that buffer running when the vote names a different clock is not
something we have identified. RPMH_LN_BB_CLK2 is independently
sufficient on hardware. The two questions from the v2 thread
(calibration-table variance, linux-firmware submission) are still
open; nothing here depends on them.
David, the calibration scheme follows our v2 exchange: fixed
chip-scoped paths, with a DT table selector deferred until a second
table set exists. If you'd rather have the selector now
(samsung,calibration-variant, or the generic firmware-name), say so
and v5 will add it.
The series is based on the nfc tree's for-next.
Changes in v4:
- Drop the clk-req-gpios property and the driver's clock-gating
machinery: on-device A/B testing showed the machinery has no
effect -- the chip reads tags with the clock gated on CLK_REQ,
with it left always-on, and with the CLK_REQ pad described in
pinctrl or left undescribed. The S3NRN4V uses the existing
always-on clock path.
- Drop Conor's Acked-by on the binding patch: clk-req-gpios, its
dependencies clause and the S3NRN4V example are gone (rationale in
that patch's notes).
- Reference the buffer the chip is wired to: RPMH_LN_BB_CLK2, not
RPMH_RF_CLK2 (Luca); verified on hardware that the reference is
load-bearing (no clocks reference -> no tag activation).
- New patch 4: enable the PVDD supply, before any pin or clock of
the chip is touched, so the property the binding requires is
actually consumed (flagged by the Sashiko AI review of v3).
- Send FW_CFG from the ->init hook, before CORE_RESET, matching the
vendor stack's ordering (v3 wrongly called ->setup the earliest
hook available); verified on hardware that the command is
required (without it the chip stops answering RF_DISCOVER and
never reads a tag).
- Allocate the merged calibration stream with kvmalloc(); reject an
empty blob pair up front. Abort the update session if a section
transfer fails, and version-gate the upload on DUAL_OPTION
GET_VER -- both as the vendor stack does.
- Declare the calibration blobs with MODULE_FIRMWARE(); log an
actual calibration update at dev_info, like the legacy path.
- Correct why the firmware download is skipped: the bootloader does
answer GET_BOOTINFO, but reports a hardware version the driver
has no flash base address for (v1-v3 said the bootloader protocol
was unimplemented; tested).
- State what the FW_CFG selector means: the vendor's own test tool
decodes 0x11 as the 19.2 MHz reference (v3 called the encoding
undocumented).
- Board DTS style (Konrad): interrupts-extended, grouped -gpios
properties, one nfc-default-state with per-function sub-nodes, and
the two node comments dropped -- their surviving substance is in
the commit message, the CLK_REQ half retired with the machinery
(also Luca).
Changes in v3 (full list in the lore thread):
- Calibration data handling reworked per David's review: chip-scoped
samsung/s3nrn4v/{hwreg,swreg}.bin paths, "RF calibration data"
naming, firmware_request_nowarn(), calibration-variant property
deferred until a device needs a second table set.
- New patches 1-2 (of_match_ptr drop, driver-name string literal),
new board DTS patch; rebased onto the nfc tree's for-next.
v3: https://lore.kernel.org/20260726222405.153008-1-jorijnvdgraaf@xxxxxxxxxxxxx
v2: https://lore.kernel.org/20260705190621.128257-1-jorijnvdgraaf@xxxxxxxxxxxxx
v1: https://lore.kernel.org/20260703202601.78563-1-jorijnvdgraaf@xxxxxxxxxxxxx
Jorijn van der Graaf (6):
nfc: s3fwrn5: drop of_match_ptr() from the I2C driver
nfc: s3fwrn5: use the "s3fwrn5_i2c" string literal directly
dt-bindings: net: nfc: samsung,s3fwrn5: add the S3NRN4V
nfc: s3fwrn5: enable the PVDD supply
nfc: s3fwrn5: support the S3NRN4V variant
arm64: dts: qcom: milos-fairphone-fp6: Add NFC
.../bindings/net/nfc/samsung,s3fwrn5.yaml | 19 +-
.../boot/dts/qcom/milos-fairphone-fp6.dts | 33 +++-
drivers/nfc/s3fwrn5/core.c | 34 +++-
drivers/nfc/s3fwrn5/i2c.c | 26 ++-
drivers/nfc/s3fwrn5/nci.c | 179 +++++++++++++++++-
drivers/nfc/s3fwrn5/nci.h | 23 ++-
drivers/nfc/s3fwrn5/s3fwrn5.h | 14 +-
drivers/nfc/s3fwrn5/uart.c | 2 +-
8 files changed, 314 insertions(+), 16 deletions(-)
base-commit: f0054d864e6e734add71e29961f5ae15211ad24d
--
2.55.0