From: Adil Hüsrev Tepe <redacted>
Hi Jorijn,
I tested this series on a Samsung Galaxy XCover5 (Exynos850), which has
an S3NRN4V wired to the same lines, so I could exercise the new variant
path with real hardware and a tag. Patches 1-4 are fine here (separate
mail). On this patch I hit a hardware-dependent problem with the fixed
clock-speed byte.
+/* S3NRN4V single-byte FW_CFG payload; 0x11 selects the 19.2 MHz reference. */
+#define NCI_PROP_FW_CFG_CLK_SPEED 0x11
[...]
quoted hunk ↗ jump to hunk
+int s3fwrn5_nci_clk_cfg(struct s3fwrn5_info *info)
+{
+ u8 clk_speed = NCI_PROP_FW_CFG_CLK_SPEED;
+
+ return nci_prop_cmd(info->ndev, NCI_PROP_FW_CFG, 1, &clk_speed);
+}
The XCover5 feeds the S3NRN4V a 26 MHz reference (PMU CLKOUT0 -> TCXO),
not 19.2 MHz. With the byte hardcoded to 0x11 the chip ACKs FW_CFG with
status 0 -- there is no "failed to configure the reference clock" error --
but the RF front end is then off-frequency and the reader never sees a
tag. The failure is completely invisible to host-side polling; only a
physical tag exposes it.
A/B on the XCover5, same tag held on the antenna, 12 s initiator poll per
run (NFC_EVENT_TARGETS_FOUND over the netlink 'events' group):
FW_CFG 0x11 (19.2 MHz, this patch as posted) : no target in 12 s
FW_CFG 0x12 (26 MHz, only that byte changed) : TARGETS_FOUND in ~0.1 s,
ISO14443-A, proto 0x10
So the single byte is purely board-dependent: 0x11 is correct for a
19.2 MHz part like the FP6, 0x12 for a 26 MHz board like this one, and a
hardcoded value breaks whichever board it does not match.
The driver already holds the reference clock (phy->clk, "failed to get
clock" in this same patch), so the byte can be derived instead of fixed.
Something like:
unsigned long rate = info->phy ? clk_get_rate(phy->clk) : 0;
u8 clk_speed;
switch (rate) {
case 19200000: clk_speed = 0x11; break;
case 26000000: clk_speed = 0x12; break;
default:
/* keep the posted default when the rate is unknown */
clk_speed = 0x11;
break;
}
(exact plumbing of the clk handle into s3fwrn5_nci_clk_cfg() is yours to
decide; the point is the value must follow clk_get_rate(), not a #define).
With that change the XCover5 reads tags reliably, so I'm happy to give a
Tested-by on a v6 that derives the byte from the clock rate. I did not
Tested-by this patch as posted because it does not bring up NFC on a
26 MHz board.
Two smaller observations on this board, neither a blocker:
- A prop notification 6F-3F arrives during polling and logs
"nci_ntf_packet: unsupported ntf opcode 0xf3f" on every poll. A no-op
handler would silence it.
- RF calibration blobs: the driver looks for samsung/s3nrn4v/{hwreg,
swreg}.bin; the stock XCover5 firmware ships them as
sec_s3nrn4v_{hwreg,swreg}.bin. Just a note for linux-firmware naming;
NFC works without them here ("RF calibration data update failed: -2"
is non-fatal).
This was tested on 7.4-rc1 (s3fwrn5 sources at
7.4.0-rc1-00023-gdcb8b91fb779) with patches 1-5 applied, built as
out-of-tree modules and bound to the S3NRN4V via a runtime DT overlay
(compatible = "samsung,s3nrn4v", en/wake GPIOs, pvdd 1.8 V, 26 MHz clk).
The clock-rate finding was located with the help of an AI coding
assistant (Claude Code, Anthropic) during XCover5 mainline bring-up; I
reviewed, reproduced and verified it on hardware myself.
Thanks for doing this series -- it is most of the way to working on a
second board.
Assisted-by: LLM
-- Adil Hüsrev Tepe