aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/nfc/pn544/pn544.c2
-rw-r--r--include/net/nfc/hci.h13
-rw-r--r--net/nfc/hci/command.c7
-rw-r--r--net/nfc/hci/core.c3
4 files changed, 23 insertions, 2 deletions
diff --git a/drivers/nfc/pn544/pn544.c b/drivers/nfc/pn544/pn544.c
index cd8fb16f5416..ece834239852 100644
--- a/drivers/nfc/pn544/pn544.c
+++ b/drivers/nfc/pn544/pn544.c
@@ -833,7 +833,7 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
833 NFC_PROTO_ISO14443_B_MASK | 833 NFC_PROTO_ISO14443_B_MASK |
834 NFC_PROTO_NFC_DEP_MASK; 834 NFC_PROTO_NFC_DEP_MASK;
835 835
836 info->hdev = nfc_hci_allocate_device(&pn544_hci_ops, &init_data, 836 info->hdev = nfc_hci_allocate_device(&pn544_hci_ops, &init_data, 0,
837 protocols, llc_name, 837 protocols, llc_name,
838 phy_headroom + PN544_CMDS_HEADROOM, 838 phy_headroom + PN544_CMDS_HEADROOM,
839 phy_tailroom, phy_payload); 839 phy_tailroom, phy_payload);
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index 834e36481aff..2ff71750c428 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -82,6 +82,16 @@ typedef int (*xmit) (struct sk_buff *skb, void *cb_data);
82 82
83#define NFC_HCI_MAX_GATES 256 83#define NFC_HCI_MAX_GATES 256
84 84
85/*
86 * These values can be specified by a driver to indicate it requires some
87 * adaptation of the HCI standard.
88 *
89 * NFC_HCI_QUIRK_SHORT_CLEAR - send HCI_ADM_CLEAR_ALL_PIPE cmd with no params
90 */
91enum {
92 NFC_HCI_QUIRK_SHORT_CLEAR = 0,
93};
94
85struct nfc_hci_dev { 95struct nfc_hci_dev {
86 struct nfc_dev *ndev; 96 struct nfc_dev *ndev;
87 97
@@ -131,11 +141,14 @@ struct nfc_hci_dev {
131 141
132 u8 *gb; 142 u8 *gb;
133 size_t gb_len; 143 size_t gb_len;
144
145 unsigned long quirks;
134}; 146};
135 147
136/* hci device allocation */ 148/* hci device allocation */
137struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops, 149struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
138 struct nfc_hci_init_data *init_data, 150 struct nfc_hci_init_data *init_data,
151 unsigned long quirks,
139 u32 protocols, 152 u32 protocols,
140 const char *llc_name, 153 const char *llc_name,
141 int tx_headroom, 154 int tx_headroom,
diff --git a/net/nfc/hci/command.c b/net/nfc/hci/command.c
index 7d99410e6c1a..64f922be9281 100644
--- a/net/nfc/hci/command.c
+++ b/net/nfc/hci/command.c
@@ -280,14 +280,19 @@ static int nfc_hci_delete_pipe(struct nfc_hci_dev *hdev, u8 pipe)
280static int nfc_hci_clear_all_pipes(struct nfc_hci_dev *hdev) 280static int nfc_hci_clear_all_pipes(struct nfc_hci_dev *hdev)
281{ 281{
282 u8 param[2]; 282 u8 param[2];
283 size_t param_len = 2;
283 284
284 /* TODO: Find out what the identity reference data is 285 /* TODO: Find out what the identity reference data is
285 * and fill param with it. HCI spec 6.1.3.5 */ 286 * and fill param with it. HCI spec 6.1.3.5 */
286 287
287 pr_debug("\n"); 288 pr_debug("\n");
288 289
290 if (test_bit(NFC_HCI_QUIRK_SHORT_CLEAR, &hdev->quirks))
291 param_len = 0;
292
289 return nfc_hci_execute_cmd(hdev, NFC_HCI_ADMIN_PIPE, 293 return nfc_hci_execute_cmd(hdev, NFC_HCI_ADMIN_PIPE,
290 NFC_HCI_ADM_CLEAR_ALL_PIPE, param, 2, NULL); 294 NFC_HCI_ADM_CLEAR_ALL_PIPE, param, param_len,
295 NULL);
291} 296}
292 297
293int nfc_hci_disconnect_gate(struct nfc_hci_dev *hdev, u8 gate) 298int nfc_hci_disconnect_gate(struct nfc_hci_dev *hdev, u8 gate)
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c
index d9190da4a403..755a6b9774ab 100644
--- a/net/nfc/hci/core.c
+++ b/net/nfc/hci/core.c
@@ -795,6 +795,7 @@ static struct nfc_ops hci_nfc_ops = {
795 795
796struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops, 796struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
797 struct nfc_hci_init_data *init_data, 797 struct nfc_hci_init_data *init_data,
798 unsigned long quirks,
798 u32 protocols, 799 u32 protocols,
799 const char *llc_name, 800 const char *llc_name,
800 int tx_headroom, 801 int tx_headroom,
@@ -838,6 +839,8 @@ struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
838 839
839 memset(hdev->gate2pipe, NFC_HCI_INVALID_PIPE, sizeof(hdev->gate2pipe)); 840 memset(hdev->gate2pipe, NFC_HCI_INVALID_PIPE, sizeof(hdev->gate2pipe));
840 841
842 hdev->quirks = quirks;
843
841 return hdev; 844 return hdev;
842} 845}
843EXPORT_SYMBOL(nfc_hci_allocate_device); 846EXPORT_SYMBOL(nfc_hci_allocate_device);