aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/nfc/st21nfcb/st21nfcb.c10
-rw-r--r--include/net/nfc/nci_core.h9
-rw-r--r--net/nfc/nci/ntf.c9
3 files changed, 23 insertions, 5 deletions
diff --git a/drivers/nfc/st21nfcb/st21nfcb.c b/drivers/nfc/st21nfcb/st21nfcb.c
index 90d37156169e..e72dae816e72 100644
--- a/drivers/nfc/st21nfcb/st21nfcb.c
+++ b/drivers/nfc/st21nfcb/st21nfcb.c
@@ -25,6 +25,8 @@
25 25
26#define DRIVER_DESC "NCI NFC driver for ST21NFCB" 26#define DRIVER_DESC "NCI NFC driver for ST21NFCB"
27 27
28#define ST21NFCB_NCI1_X_PROPRIETARY_ISO15693 0x83
29
28static int st21nfcb_nci_open(struct nci_dev *ndev) 30static int st21nfcb_nci_open(struct nci_dev *ndev)
29{ 31{
30 struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); 32 struct st21nfcb_nci_info *info = nci_get_drvdata(ndev);
@@ -64,10 +66,18 @@ static int st21nfcb_nci_send(struct nci_dev *ndev, struct sk_buff *skb)
64 return ndlc_send(info->ndlc, skb); 66 return ndlc_send(info->ndlc, skb);
65} 67}
66 68
69static __u32 st21nfcb_nci_get_rfprotocol(struct nci_dev *ndev,
70 __u8 rf_protocol)
71{
72 return rf_protocol == ST21NFCB_NCI1_X_PROPRIETARY_ISO15693 ?
73 NFC_PROTO_ISO15693_MASK : 0;
74}
75
67static struct nci_ops st21nfcb_nci_ops = { 76static struct nci_ops st21nfcb_nci_ops = {
68 .open = st21nfcb_nci_open, 77 .open = st21nfcb_nci_open,
69 .close = st21nfcb_nci_close, 78 .close = st21nfcb_nci_close,
70 .send = st21nfcb_nci_send, 79 .send = st21nfcb_nci_send,
80 .get_rfprotocol = st21nfcb_nci_get_rfprotocol,
71}; 81};
72 82
73int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int phy_headroom, 83int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int phy_headroom,
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 1f9a0f5272fe..75d10e625c49 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -64,10 +64,11 @@ enum nci_state {
64struct nci_dev; 64struct nci_dev;
65 65
66struct nci_ops { 66struct nci_ops {
67 int (*open)(struct nci_dev *ndev); 67 int (*open)(struct nci_dev *ndev);
68 int (*close)(struct nci_dev *ndev); 68 int (*close)(struct nci_dev *ndev);
69 int (*send)(struct nci_dev *ndev, struct sk_buff *skb); 69 int (*send)(struct nci_dev *ndev, struct sk_buff *skb);
70 int (*setup)(struct nci_dev *ndev); 70 int (*setup)(struct nci_dev *ndev);
71 __u32 (*get_rfprotocol)(struct nci_dev *ndev, __u8 rf_protocol);
71}; 72};
72 73
73#define NCI_MAX_SUPPORTED_RF_INTERFACES 4 74#define NCI_MAX_SUPPORTED_RF_INTERFACES 4
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index 25e44cebd60a..205b35f666db 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -167,6 +167,13 @@ static __u8 *nci_extract_rf_params_nfcv_passive_poll(struct nci_dev *ndev,
167 return data; 167 return data;
168} 168}
169 169
170__u32 nci_get_prop_rf_protocol(struct nci_dev *ndev, __u8 rf_protocol)
171{
172 if (ndev->ops->get_rfprotocol)
173 return ndev->ops->get_rfprotocol(ndev, rf_protocol);
174 return 0;
175}
176
170static int nci_add_new_protocol(struct nci_dev *ndev, 177static int nci_add_new_protocol(struct nci_dev *ndev,
171 struct nfc_target *target, 178 struct nfc_target *target,
172 __u8 rf_protocol, 179 __u8 rf_protocol,
@@ -195,7 +202,7 @@ static int nci_add_new_protocol(struct nci_dev *ndev,
195 else if (rf_protocol == NCI_RF_PROTOCOL_T5T) 202 else if (rf_protocol == NCI_RF_PROTOCOL_T5T)
196 protocol = NFC_PROTO_ISO15693_MASK; 203 protocol = NFC_PROTO_ISO15693_MASK;
197 else 204 else
198 protocol = 0; 205 protocol = nci_get_prop_rf_protocol(ndev, rf_protocol);
199 206
200 if (!(protocol & ndev->poll_prots)) { 207 if (!(protocol & ndev->poll_prots)) {
201 pr_err("the target found does not have the desired protocol\n"); 208 pr_err("the target found does not have the desired protocol\n");