Thread (6 messages) 6 messages, 2 authors, 10d ago

[PATCH v5 3/4] nfc: st-nci: map proprietary RF protocol 0x90 to MIFARE

flat view
COOLING10d

From: Kristian Brox <hidden>
Date: 2026-10-05 20:52:07
Also in: linux-arm-msm, linux-devicetree, lkml, oe-linux-nfc
Subsystem: nfc subsystem, the rest · Maintainers: David Heidelberg, Linus Torvalds

Revision v5 of 6 in this series.

Revisions (6)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v4 [diff vs current]
  6. v5 current
From: Tim auf der Landwehr <redacted>

ST21NFCD reports MIFARE Classic with proprietary RF protocol 0x90
(a Classic 4K, and a Classic 1K on the Fairphone 5). That value is
not an NFC Forum protocol. st_nci_get_rfprotocol() returned 0 for it,
and nci_add_new_protocol() then drops the tag.

Map 0x90 to NFC_PROTO_MIFARE_MASK. ISO15693 (0x83) is unchanged.

Signed-off-by: Tim auf der Landwehr <redacted>
Signed-off-by: Kristian Brox <redacted>
---
 drivers/nfc/st-nci/core.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/nfc/st-nci/core.c b/drivers/nfc/st-nci/core.c
index d7802434a..d83221566 100644
--- a/drivers/nfc/st-nci/core.c
+++ b/drivers/nfc/st-nci/core.c
@@ -15,6 +15,12 @@
 #define DRIVER_DESC "NCI NFC driver for ST_NCI"
 
 #define ST_NCI1_X_PROPRIETARY_ISO15693 0x83
+/*
+ * Proprietary RF protocol the controller reports for MIFARE Classic.
+ * Not an NFC Forum protocol, so it must be mapped here or
+ * nci_add_new_protocol drops the tag.
+ */
+#define ST_NCI1_X_PROPRIETARY_MIFARE 0x90
 
 static int st_nci_init(struct nci_dev *ndev)
 {
@@ -76,8 +82,14 @@ static int st_nci_send(struct nci_dev *ndev, struct sk_buff *skb)
 static __u32 st_nci_get_rfprotocol(struct nci_dev *ndev,
 					 __u8 rf_protocol)
 {
-	return rf_protocol == ST_NCI1_X_PROPRIETARY_ISO15693 ?
-		NFC_PROTO_ISO15693_MASK : 0;
+	switch (rf_protocol) {
+	case ST_NCI1_X_PROPRIETARY_ISO15693:
+		return NFC_PROTO_ISO15693_MASK;
+	case ST_NCI1_X_PROPRIETARY_MIFARE:
+		return NFC_PROTO_MIFARE_MASK;
+	default:
+		return 0;
+	}
 }
 
 static int st_nci_prop_rsp_packet(struct nci_dev *ndev,
-- 
2.55.0

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help