diff options
author | Ilan Elias <ilane@ti.com> | 2011-12-20 09:57:40 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-04 14:30:39 -0500 |
commit | 637d85a7cdfe4240a56da7d70cf95cca65ea21d3 (patch) | |
tree | 955b49a8a27b871725c0f262f4d475cab59db01c /net/nfc | |
parent | cee0bec58a922976a5f4d70081a3b2fd73e108e9 (diff) |
NFC: Update names and structs to NCI spec 1.0 d22
Addition, deletion, and modification of NCI constants.
Changes in NCI commands, responses, and notifications structures.
Signed-off-by: Ilan Elias <ilane@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/nci/core.c | 22 | ||||
-rw-r--r-- | net/nfc/nci/lib.c | 3 | ||||
-rw-r--r-- | net/nfc/nci/ntf.c | 26 | ||||
-rw-r--r-- | net/nfc/nci/rsp.c | 10 |
4 files changed, 30 insertions, 31 deletions
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 2deb4aebf568..7650139a1a05 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c | |||
@@ -154,14 +154,16 @@ static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt) | |||
154 | if (ndev->supported_rf_interfaces[i] == | 154 | if (ndev->supported_rf_interfaces[i] == |
155 | NCI_RF_INTERFACE_ISO_DEP) { | 155 | NCI_RF_INTERFACE_ISO_DEP) { |
156 | cfg[*num].rf_protocol = NCI_RF_PROTOCOL_ISO_DEP; | 156 | cfg[*num].rf_protocol = NCI_RF_PROTOCOL_ISO_DEP; |
157 | cfg[*num].mode = NCI_DISC_MAP_MODE_BOTH; | 157 | cfg[*num].mode = NCI_DISC_MAP_MODE_POLL | |
158 | cfg[*num].rf_interface_type = NCI_RF_INTERFACE_ISO_DEP; | 158 | NCI_DISC_MAP_MODE_LISTEN; |
159 | cfg[*num].rf_interface = NCI_RF_INTERFACE_ISO_DEP; | ||
159 | (*num)++; | 160 | (*num)++; |
160 | } else if (ndev->supported_rf_interfaces[i] == | 161 | } else if (ndev->supported_rf_interfaces[i] == |
161 | NCI_RF_INTERFACE_NFC_DEP) { | 162 | NCI_RF_INTERFACE_NFC_DEP) { |
162 | cfg[*num].rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; | 163 | cfg[*num].rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; |
163 | cfg[*num].mode = NCI_DISC_MAP_MODE_BOTH; | 164 | cfg[*num].mode = NCI_DISC_MAP_MODE_POLL | |
164 | cfg[*num].rf_interface_type = NCI_RF_INTERFACE_NFC_DEP; | 165 | NCI_DISC_MAP_MODE_LISTEN; |
166 | cfg[*num].rf_interface = NCI_RF_INTERFACE_NFC_DEP; | ||
165 | (*num)++; | 167 | (*num)++; |
166 | } | 168 | } |
167 | 169 | ||
@@ -186,16 +188,16 @@ static void nci_rf_discover_req(struct nci_dev *ndev, unsigned long opt) | |||
186 | || protocols & NFC_PROTO_MIFARE_MASK | 188 | || protocols & NFC_PROTO_MIFARE_MASK |
187 | || protocols & NFC_PROTO_ISO14443_MASK | 189 | || protocols & NFC_PROTO_ISO14443_MASK |
188 | || protocols & NFC_PROTO_NFC_DEP_MASK)) { | 190 | || protocols & NFC_PROTO_NFC_DEP_MASK)) { |
189 | cmd.disc_configs[cmd.num_disc_configs].type = | 191 | cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = |
190 | NCI_DISCOVERY_TYPE_POLL_A_PASSIVE; | 192 | NCI_NFC_A_PASSIVE_POLL_MODE; |
191 | cmd.disc_configs[cmd.num_disc_configs].frequency = 1; | 193 | cmd.disc_configs[cmd.num_disc_configs].frequency = 1; |
192 | cmd.num_disc_configs++; | 194 | cmd.num_disc_configs++; |
193 | } | 195 | } |
194 | 196 | ||
195 | if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && | 197 | if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && |
196 | (protocols & NFC_PROTO_ISO14443_MASK)) { | 198 | (protocols & NFC_PROTO_ISO14443_MASK)) { |
197 | cmd.disc_configs[cmd.num_disc_configs].type = | 199 | cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = |
198 | NCI_DISCOVERY_TYPE_POLL_B_PASSIVE; | 200 | NCI_NFC_B_PASSIVE_POLL_MODE; |
199 | cmd.disc_configs[cmd.num_disc_configs].frequency = 1; | 201 | cmd.disc_configs[cmd.num_disc_configs].frequency = 1; |
200 | cmd.num_disc_configs++; | 202 | cmd.num_disc_configs++; |
201 | } | 203 | } |
@@ -203,8 +205,8 @@ static void nci_rf_discover_req(struct nci_dev *ndev, unsigned long opt) | |||
203 | if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && | 205 | if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && |
204 | (protocols & NFC_PROTO_FELICA_MASK | 206 | (protocols & NFC_PROTO_FELICA_MASK |
205 | || protocols & NFC_PROTO_NFC_DEP_MASK)) { | 207 | || protocols & NFC_PROTO_NFC_DEP_MASK)) { |
206 | cmd.disc_configs[cmd.num_disc_configs].type = | 208 | cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = |
207 | NCI_DISCOVERY_TYPE_POLL_F_PASSIVE; | 209 | NCI_NFC_F_PASSIVE_POLL_MODE; |
208 | cmd.disc_configs[cmd.num_disc_configs].frequency = 1; | 210 | cmd.disc_configs[cmd.num_disc_configs].frequency = 1; |
209 | cmd.num_disc_configs++; | 211 | cmd.num_disc_configs++; |
210 | } | 212 | } |
diff --git a/net/nfc/nci/lib.c b/net/nfc/nci/lib.c index e99adcfb1bcf..6a63e5eb483d 100644 --- a/net/nfc/nci/lib.c +++ b/net/nfc/nci/lib.c | |||
@@ -77,9 +77,6 @@ int nci_to_errno(__u8 code) | |||
77 | case NCI_STATUS_NFCEE_TIMEOUT_ERROR: | 77 | case NCI_STATUS_NFCEE_TIMEOUT_ERROR: |
78 | return -ETIMEDOUT; | 78 | return -ETIMEDOUT; |
79 | 79 | ||
80 | case NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED: | ||
81 | return -EDQUOT; | ||
82 | |||
83 | case NCI_STATUS_FAILED: | 80 | case NCI_STATUS_FAILED: |
84 | default: | 81 | default: |
85 | return -ENOSYS; | 82 | return -ENOSYS; |
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c index 003846b2c326..c8813eda7865 100644 --- a/net/nfc/nci/ntf.c +++ b/net/nfc/nci/ntf.c | |||
@@ -52,6 +52,9 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev, | |||
52 | 52 | ||
53 | /* update the credits */ | 53 | /* update the credits */ |
54 | for (i = 0; i < ntf->num_entries; i++) { | 54 | for (i = 0; i < ntf->num_entries; i++) { |
55 | ntf->conn_entries[i].conn_id = | ||
56 | nci_conn_id(&ntf->conn_entries[i].conn_id); | ||
57 | |||
55 | pr_debug("entry[%d]: conn_id %d, credits %d\n", | 58 | pr_debug("entry[%d]: conn_id %d, credits %d\n", |
56 | i, ntf->conn_entries[i].conn_id, | 59 | i, ntf->conn_entries[i].conn_id, |
57 | ntf->conn_entries[i].credits); | 60 | ntf->conn_entries[i].credits); |
@@ -147,6 +150,11 @@ static void nci_target_found(struct nci_dev *ndev, | |||
147 | nfc_tgt.supported_protocols); | 150 | nfc_tgt.supported_protocols); |
148 | 151 | ||
149 | ndev->target_available_prots = nfc_tgt.supported_protocols; | 152 | ndev->target_available_prots = nfc_tgt.supported_protocols; |
153 | ndev->max_data_pkt_payload_size = ntf->max_data_pkt_payload_size; | ||
154 | ndev->initial_num_credits = ntf->initial_num_credits; | ||
155 | |||
156 | /* set the available credits to initial value */ | ||
157 | atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); | ||
150 | 158 | ||
151 | nfc_targets_found(ndev->nfc_dev, &nfc_tgt, 1); | 159 | nfc_targets_found(ndev->nfc_dev, &nfc_tgt, 1); |
152 | } | 160 | } |
@@ -162,16 +170,21 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev, | |||
162 | set_bit(NCI_POLL_ACTIVE, &ndev->flags); | 170 | set_bit(NCI_POLL_ACTIVE, &ndev->flags); |
163 | 171 | ||
164 | ntf.rf_discovery_id = *data++; | 172 | ntf.rf_discovery_id = *data++; |
165 | ntf.rf_interface_type = *data++; | 173 | ntf.rf_interface = *data++; |
166 | ntf.rf_protocol = *data++; | 174 | ntf.rf_protocol = *data++; |
167 | ntf.activation_rf_tech_and_mode = *data++; | 175 | ntf.activation_rf_tech_and_mode = *data++; |
176 | ntf.max_data_pkt_payload_size = *data++; | ||
177 | ntf.initial_num_credits = *data++; | ||
168 | ntf.rf_tech_specific_params_len = *data++; | 178 | ntf.rf_tech_specific_params_len = *data++; |
169 | 179 | ||
170 | pr_debug("rf_discovery_id %d\n", ntf.rf_discovery_id); | 180 | pr_debug("rf_discovery_id %d\n", ntf.rf_discovery_id); |
171 | pr_debug("rf_interface_type 0x%x\n", ntf.rf_interface_type); | 181 | pr_debug("rf_interface 0x%x\n", ntf.rf_interface); |
172 | pr_debug("rf_protocol 0x%x\n", ntf.rf_protocol); | 182 | pr_debug("rf_protocol 0x%x\n", ntf.rf_protocol); |
173 | pr_debug("activation_rf_tech_and_mode 0x%x\n", | 183 | pr_debug("activation_rf_tech_and_mode 0x%x\n", |
174 | ntf.activation_rf_tech_and_mode); | 184 | ntf.activation_rf_tech_and_mode); |
185 | pr_debug("max_data_pkt_payload_size 0x%x\n", | ||
186 | ntf.max_data_pkt_payload_size); | ||
187 | pr_debug("initial_num_credits 0x%x\n", ntf.initial_num_credits); | ||
175 | pr_debug("rf_tech_specific_params_len %d\n", | 188 | pr_debug("rf_tech_specific_params_len %d\n", |
176 | ntf.rf_tech_specific_params_len); | 189 | ntf.rf_tech_specific_params_len); |
177 | 190 | ||
@@ -204,7 +217,7 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev, | |||
204 | ntf.activation_params_len); | 217 | ntf.activation_params_len); |
205 | 218 | ||
206 | if (ntf.activation_params_len > 0) { | 219 | if (ntf.activation_params_len > 0) { |
207 | switch (ntf.rf_interface_type) { | 220 | switch (ntf.rf_interface) { |
208 | case NCI_RF_INTERFACE_ISO_DEP: | 221 | case NCI_RF_INTERFACE_ISO_DEP: |
209 | err = nci_extract_activation_params_iso_dep(ndev, | 222 | err = nci_extract_activation_params_iso_dep(ndev, |
210 | &ntf, data); | 223 | &ntf, data); |
@@ -215,8 +228,8 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev, | |||
215 | break; | 228 | break; |
216 | 229 | ||
217 | default: | 230 | default: |
218 | pr_err("unsupported rf_interface_type 0x%x\n", | 231 | pr_err("unsupported rf_interface 0x%x\n", |
219 | ntf.rf_interface_type); | 232 | ntf.rf_interface); |
220 | return; | 233 | return; |
221 | } | 234 | } |
222 | } | 235 | } |
@@ -244,9 +257,6 @@ static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev, | |||
244 | ndev->rx_data_reassembly = 0; | 257 | ndev->rx_data_reassembly = 0; |
245 | } | 258 | } |
246 | 259 | ||
247 | /* set the available credits to initial value */ | ||
248 | atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); | ||
249 | |||
250 | /* complete the data exchange transaction, if exists */ | 260 | /* complete the data exchange transaction, if exists */ |
251 | if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags)) | 261 | if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags)) |
252 | nci_data_exchange_complete(ndev, NULL, -EIO); | 262 | nci_data_exchange_complete(ndev, NULL, -EIO); |
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c index 3f444c8a66e9..2840ae2f3615 100644 --- a/net/nfc/nci/rsp.c +++ b/net/nfc/nci/rsp.c | |||
@@ -86,17 +86,11 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
86 | rsp_2->max_ctrl_pkt_payload_len; | 86 | rsp_2->max_ctrl_pkt_payload_len; |
87 | ndev->max_size_for_large_params = | 87 | ndev->max_size_for_large_params = |
88 | __le16_to_cpu(rsp_2->max_size_for_large_params); | 88 | __le16_to_cpu(rsp_2->max_size_for_large_params); |
89 | ndev->max_data_pkt_payload_size = | ||
90 | rsp_2->max_data_pkt_payload_size; | ||
91 | ndev->initial_num_credits = | ||
92 | rsp_2->initial_num_credits; | ||
93 | ndev->manufact_id = | 89 | ndev->manufact_id = |
94 | rsp_2->manufact_id; | 90 | rsp_2->manufact_id; |
95 | ndev->manufact_specific_info = | 91 | ndev->manufact_specific_info = |
96 | __le32_to_cpu(rsp_2->manufact_specific_info); | 92 | __le32_to_cpu(rsp_2->manufact_specific_info); |
97 | 93 | ||
98 | atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); | ||
99 | |||
100 | pr_debug("nfcc_features 0x%x\n", | 94 | pr_debug("nfcc_features 0x%x\n", |
101 | ndev->nfcc_features); | 95 | ndev->nfcc_features); |
102 | pr_debug("num_supported_rf_interfaces %d\n", | 96 | pr_debug("num_supported_rf_interfaces %d\n", |
@@ -117,10 +111,6 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
117 | ndev->max_ctrl_pkt_payload_len); | 111 | ndev->max_ctrl_pkt_payload_len); |
118 | pr_debug("max_size_for_large_params %d\n", | 112 | pr_debug("max_size_for_large_params %d\n", |
119 | ndev->max_size_for_large_params); | 113 | ndev->max_size_for_large_params); |
120 | pr_debug("max_data_pkt_payload_size %d\n", | ||
121 | ndev->max_data_pkt_payload_size); | ||
122 | pr_debug("initial_num_credits %d\n", | ||
123 | ndev->initial_num_credits); | ||
124 | pr_debug("manufact_id 0x%x\n", | 114 | pr_debug("manufact_id 0x%x\n", |
125 | ndev->manufact_id); | 115 | ndev->manufact_id); |
126 | pr_debug("manufact_specific_info 0x%x\n", | 116 | pr_debug("manufact_specific_info 0x%x\n", |