Commit e8c0dacd9836dc2dcb28d236c9cc3cfaa9965a20

Authored by Ilan Elias
Committed by John W. Linville
1 parent e999882a05

NFC: Update names and structs to NCI spec 1.0 d18

Addition, deletion and modification of NCI constants.
Changes in NCI commands, responses and notifications structures.

Signed-off-by: Ilan Elias <ilane@ti.com>
Acked-by: Lauro Ramos Venancio <lauro.venancio@openbossa.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 7 changed files with 193 additions and 114 deletions Side-by-side Diff

include/net/nfc/nci.h
... ... @@ -36,24 +36,23 @@
36 36 /* NCI Status Codes */
37 37 #define NCI_STATUS_OK 0x00
38 38 #define NCI_STATUS_REJECTED 0x01
39   -#define NCI_STATUS_MESSAGE_CORRUPTED 0x02
40   -#define NCI_STATUS_BUFFER_FULL 0x03
41   -#define NCI_STATUS_FAILED 0x04
42   -#define NCI_STATUS_NOT_INITIALIZED 0x05
43   -#define NCI_STATUS_SYNTAX_ERROR 0x06
44   -#define NCI_STATUS_SEMANTIC_ERROR 0x07
45   -#define NCI_STATUS_UNKNOWN_GID 0x08
46   -#define NCI_STATUS_UNKNOWN_OID 0x09
47   -#define NCI_STATUS_INVALID_PARAM 0x0a
48   -#define NCI_STATUS_MESSAGE_SIZE_EXCEEDED 0x0b
  39 +#define NCI_STATUS_RF_FRAME_CORRUPTED 0x02
  40 +#define NCI_STATUS_FAILED 0x03
  41 +#define NCI_STATUS_NOT_INITIALIZED 0x04
  42 +#define NCI_STATUS_SYNTAX_ERROR 0x05
  43 +#define NCI_STATUS_SEMANTIC_ERROR 0x06
  44 +#define NCI_STATUS_UNKNOWN_GID 0x07
  45 +#define NCI_STATUS_UNKNOWN_OID 0x08
  46 +#define NCI_STATUS_INVALID_PARAM 0x09
  47 +#define NCI_STATUS_MESSAGE_SIZE_EXCEEDED 0x0a
49 48 /* Discovery Specific Status Codes */
50 49 #define NCI_STATUS_DISCOVERY_ALREADY_STARTED 0xa0
51 50 #define NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED 0xa1
  51 +#define NCI_STATUS_DISCOVERY_TEAR_DOWN 0xa2
52 52 /* RF Interface Specific Status Codes */
53 53 #define NCI_STATUS_RF_TRANSMISSION_ERROR 0xb0
54 54 #define NCI_STATUS_RF_PROTOCOL_ERROR 0xb1
55 55 #define NCI_STATUS_RF_TIMEOUT_ERROR 0xb2
56   -#define NCI_STATUS_RF_LINK_LOSS_ERROR 0xb3
57 56 /* NFCEE Interface Specific Status Codes */
58 57 #define NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED 0xc0
59 58 #define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED 0xc1
... ... @@ -73,6 +72,21 @@
73 72 #define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83
74 73 #define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85
75 74  
  75 +/* NCI RF Technologies */
  76 +#define NCI_NFC_RF_TECHNOLOGY_A 0x00
  77 +#define NCI_NFC_RF_TECHNOLOGY_B 0x01
  78 +#define NCI_NFC_RF_TECHNOLOGY_F 0x02
  79 +#define NCI_NFC_RF_TECHNOLOGY_15693 0x03
  80 +
  81 +/* NCI Bit Rates */
  82 +#define NCI_NFC_BIT_RATE_106 0x00
  83 +#define NCI_NFC_BIT_RATE_212 0x01
  84 +#define NCI_NFC_BIT_RATE_424 0x02
  85 +#define NCI_NFC_BIT_RATE_848 0x03
  86 +#define NCI_NFC_BIT_RATE_1696 0x04
  87 +#define NCI_NFC_BIT_RATE_3392 0x05
  88 +#define NCI_NFC_BIT_RATE_6784 0x06
  89 +
76 90 /* NCI RF Protocols */
77 91 #define NCI_RF_PROTOCOL_UNKNOWN 0x00
78 92 #define NCI_RF_PROTOCOL_T1T 0x01
79 93  
... ... @@ -82,11 +96,18 @@
82 96 #define NCI_RF_PROTOCOL_NFC_DEP 0x05
83 97  
84 98 /* NCI RF Interfaces */
85   -#define NCI_RF_INTERFACE_RFU 0x00
  99 +#define NCI_RF_INTERFACE_NFCEE_DIRECT 0x00
86 100 #define NCI_RF_INTERFACE_FRAME 0x01
87 101 #define NCI_RF_INTERFACE_ISO_DEP 0x02
88 102 #define NCI_RF_INTERFACE_NFC_DEP 0x03
89 103  
  104 +/* NCI Reset types */
  105 +#define NCI_RESET_TYPE_KEEP_CONFIG 0x00
  106 +#define NCI_RESET_TYPE_RESET_CONFIG 0x01
  107 +
  108 +/* NCI Static RF connection ID */
  109 +#define NCI_STATIC_RF_CONN_ID 0x00
  110 +
90 111 /* NCI RF_DISCOVER_MAP_CMD modes */
91 112 #define NCI_DISC_MAP_MODE_POLL 0x01
92 113 #define NCI_DISC_MAP_MODE_LISTEN 0x02
... ... @@ -98,8 +119,6 @@
98 119 #define NCI_DISCOVERY_TYPE_POLL_F_PASSIVE 0x02
99 120 #define NCI_DISCOVERY_TYPE_POLL_A_ACTIVE 0x03
100 121 #define NCI_DISCOVERY_TYPE_POLL_F_ACTIVE 0x05
101   -#define NCI_DISCOVERY_TYPE_WAKEUP_A_PASSIVE 0x06
102   -#define NCI_DISCOVERY_TYPE_WAKEUP_B_PASSIVE 0x07
103 122 #define NCI_DISCOVERY_TYPE_WAKEUP_A_ACTIVE 0x09
104 123 #define NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE 0x80
105 124 #define NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE 0x81
... ... @@ -111,8 +130,7 @@
111 130 #define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00
112 131 #define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01
113 132 #define NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE 0x02
114   -#define NCI_DEACTIVATE_TYPE_RF_LINK_LOSS 0x03
115   -#define NCI_DEACTIVATE_TYPE_DISCOVERY_ERROR 0x04
  133 +#define NCI_DEACTIVATE_TYPE_DISCOVERY 0x03
116 134  
117 135 /* Message Type (MT) */
118 136 #define NCI_MT_DATA_PKT 0x00
... ... @@ -169,6 +187,9 @@
169 187 /* ----- NCI Commands ---- */
170 188 /* ------------------------ */
171 189 #define NCI_OP_CORE_RESET_CMD nci_opcode_pack(NCI_GID_CORE, 0x00)
  190 +struct nci_core_reset_cmd {
  191 + __u8 reset_type;
  192 +} __packed;
172 193  
173 194 #define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01)
174 195  
... ... @@ -218,6 +239,7 @@
218 239 struct nci_core_reset_rsp {
219 240 __u8 status;
220 241 __u8 nci_ver;
  242 + __u8 config_status;
221 243 } __packed;
222 244  
223 245 #define NCI_OP_CORE_INIT_RSP nci_opcode_pack(NCI_GID_CORE, 0x01)
... ... @@ -232,10 +254,12 @@
232 254 struct nci_core_init_rsp_2 {
233 255 __u8 max_logical_connections;
234 256 __le16 max_routing_table_size;
235   - __u8 max_control_packet_payload_length;
236   - __le16 rf_sending_buffer_size;
237   - __le16 rf_receiving_buffer_size;
238   - __le16 manufacturer_id;
  257 + __u8 max_ctrl_pkt_payload_len;
  258 + __le16 max_size_for_large_params;
  259 + __u8 max_data_pkt_payload_size;
  260 + __u8 initial_num_credits;
  261 + __u8 manufact_id;
  262 + __le32 manufact_specific_info;
239 263 } __packed;
240 264  
241 265 #define NCI_OP_CORE_SET_CONFIG_RSP nci_opcode_pack(NCI_GID_CORE, 0x02)
... ... @@ -275,7 +299,7 @@
275 299 __u8 rf_field_status;
276 300 } __packed;
277 301  
278   -#define NCI_OP_RF_ACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
  302 +#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
279 303 struct rf_tech_specific_params_nfca_poll {
280 304 __u16 sens_res;
281 305 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */
282 306  
283 307  
... ... @@ -289,17 +313,20 @@
289 313 __u8 rats_res[20];
290 314 };
291 315  
292   -struct nci_rf_activate_ntf {
293   - __u8 target_handle;
  316 +struct nci_rf_intf_activated_ntf {
  317 + __u8 rf_discovery_id;
  318 + __u8 rf_interface_type;
294 319 __u8 rf_protocol;
295   - __u8 rf_tech_and_mode;
  320 + __u8 activation_rf_tech_and_mode;
296 321 __u8 rf_tech_specific_params_len;
297 322  
298 323 union {
299 324 struct rf_tech_specific_params_nfca_poll nfca_poll;
300 325 } rf_tech_specific_params;
301 326  
302   - __u8 rf_interface_type;
  327 + __u8 data_exch_rf_tech_and_mode;
  328 + __u8 data_exch_tx_bit_rate;
  329 + __u8 data_exch_rx_bit_rate;
303 330 __u8 activation_params_len;
304 331  
305 332 union {
... ... @@ -309,6 +336,10 @@
309 336 } __packed;
310 337  
311 338 #define NCI_OP_RF_DEACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
  339 +struct nci_rf_deactivate_ntf {
  340 + __u8 type;
  341 + __u8 reason;
  342 +} __packed;
312 343  
313 344 #endif /* __NCI_H */
include/net/nfc/nci_core.h
... ... @@ -109,14 +109,15 @@
109 109 [NCI_MAX_SUPPORTED_RF_INTERFACES];
110 110 __u8 max_logical_connections;
111 111 __u16 max_routing_table_size;
112   - __u8 max_control_packet_payload_length;
113   - __u16 rf_sending_buffer_size;
114   - __u16 rf_receiving_buffer_size;
115   - __u16 manufacturer_id;
  112 + __u8 max_ctrl_pkt_payload_len;
  113 + __u16 max_size_for_large_params;
  114 + __u8 max_data_pkt_payload_size;
  115 + __u8 initial_num_credits;
  116 + __u8 manufact_id;
  117 + __u32 manufact_specific_info;
116 118  
117 119 /* received during NCI_OP_CORE_CONN_CREATE_RSP for static conn 0 */
118 120 __u8 max_pkt_payload_size;
119   - __u8 initial_num_credits;
120 121 __u8 conn_id;
121 122  
122 123 /* stored during nci_data_exchange */
... ... @@ -125,7 +125,10 @@
125 125  
126 126 static void nci_reset_req(struct nci_dev *ndev, unsigned long opt)
127 127 {
128   - nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 0, NULL);
  128 + struct nci_core_reset_cmd cmd;
  129 +
  130 + cmd.reset_type = NCI_RESET_TYPE_RESET_CONFIG;
  131 + nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 1, &cmd);
129 132 }
130 133  
131 134 static void nci_init_req(struct nci_dev *ndev, unsigned long opt)
... ... @@ -469,7 +472,7 @@
469 472 ndev->data_exchange_cb = cb;
470 473 ndev->data_exchange_cb_context = cb_context;
471 474  
472   - rc = nci_send_data(ndev, ndev->conn_id, skb);
  475 + rc = nci_send_data(ndev, NCI_STATIC_RF_CONN_ID, skb);
473 476 if (rc)
474 477 clear_bit(NCI_DATA_EXCHANGE, &ndev->flags);
475 478  
... ... @@ -95,7 +95,8 @@
95 95 __skb_queue_head_init(&frags_q);
96 96  
97 97 while (total_len) {
98   - frag_len = min_t(int, total_len, ndev->max_pkt_payload_size);
  98 + frag_len =
  99 + min_t(int, total_len, ndev->max_data_pkt_payload_size);
99 100  
100 101 skb_frag = nci_skb_alloc(ndev,
101 102 (NCI_DATA_HDR_SIZE + frag_len),
... ... @@ -151,7 +152,7 @@
151 152 nfc_dbg("entry, conn_id 0x%x, plen %d", conn_id, skb->len);
152 153  
153 154 /* check if the packet need to be fragmented */
154   - if (skb->len <= ndev->max_pkt_payload_size) {
  155 + if (skb->len <= ndev->max_data_pkt_payload_size) {
155 156 /* no need to fragment packet */
156 157 nci_push_data_hdr(ndev, conn_id, skb, NCI_PBF_LAST);
157 158  
... ... @@ -42,12 +42,9 @@
42 42 case NCI_STATUS_REJECTED:
43 43 return -EBUSY;
44 44  
45   - case NCI_STATUS_MESSAGE_CORRUPTED:
  45 + case NCI_STATUS_RF_FRAME_CORRUPTED:
46 46 return -EBADMSG;
47 47  
48   - case NCI_STATUS_BUFFER_FULL:
49   - return -ENOBUFS;
50   -
51 48 case NCI_STATUS_NOT_INITIALIZED:
52 49 return -EHOSTDOWN;
53 50  
... ... @@ -79,9 +76,6 @@
79 76 case NCI_STATUS_RF_TIMEOUT_ERROR:
80 77 case NCI_STATUS_NFCEE_TIMEOUT_ERROR:
81 78 return -ETIMEDOUT;
82   -
83   - case NCI_STATUS_RF_LINK_LOSS_ERROR:
84   - return -ENOLINK;
85 79  
86 80 case NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED:
87 81 return -EDQUOT;
... ... @@ -54,7 +54,7 @@
54 54 ntf->conn_entries[i].conn_id,
55 55 ntf->conn_entries[i].credits);
56 56  
57   - if (ntf->conn_entries[i].conn_id == ndev->conn_id) {
  57 + if (ntf->conn_entries[i].conn_id == NCI_STATIC_RF_CONN_ID) {
58 58 /* found static rf connection */
59 59 atomic_add(ntf->conn_entries[i].credits,
60 60 &ndev->credits_cnt);
61 61  
62 62  
... ... @@ -74,14 +74,12 @@
74 74 nfc_dbg("entry, rf_field_status %d", ntf->rf_field_status);
75 75 }
76 76  
77   -static int nci_rf_activate_nfca_passive_poll(struct nci_dev *ndev,
78   - struct nci_rf_activate_ntf *ntf, __u8 *data)
  77 +static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
  78 + struct nci_rf_intf_activated_ntf *ntf, __u8 *data)
79 79 {
80 80 struct rf_tech_specific_params_nfca_poll *nfca_poll;
81   - struct activation_params_nfca_poll_iso_dep *nfca_poll_iso_dep;
82 81  
83 82 nfca_poll = &ntf->rf_tech_specific_params.nfca_poll;
84   - nfca_poll_iso_dep = &ntf->activation_params.nfca_poll_iso_dep;
85 83  
86 84 nfca_poll->sens_res = __le16_to_cpu(*((__u16 *)data));
87 85 data += 2;
88 86  
89 87  
90 88  
91 89  
92 90  
... ... @@ -100,32 +98,32 @@
100 98 if (nfca_poll->sel_res_len != 0)
101 99 nfca_poll->sel_res = *data++;
102 100  
103   - ntf->rf_interface_type = *data++;
104   - ntf->activation_params_len = *data++;
105   -
106   - nfc_dbg("sel_res_len %d, sel_res 0x%x, rf_interface_type %d, activation_params_len %d",
  101 + nfc_dbg("sel_res_len %d, sel_res 0x%x",
107 102 nfca_poll->sel_res_len,
108   - nfca_poll->sel_res,
109   - ntf->rf_interface_type,
110   - ntf->activation_params_len);
  103 + nfca_poll->sel_res);
111 104  
112   - switch (ntf->rf_interface_type) {
113   - case NCI_RF_INTERFACE_ISO_DEP:
114   - nfca_poll_iso_dep->rats_res_len = *data++;
115   - if (nfca_poll_iso_dep->rats_res_len > 0) {
116   - memcpy(nfca_poll_iso_dep->rats_res,
  105 + return data;
  106 +}
  107 +
  108 +static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,
  109 + struct nci_rf_intf_activated_ntf *ntf, __u8 *data)
  110 +{
  111 + struct activation_params_nfca_poll_iso_dep *nfca_poll;
  112 +
  113 + switch (ntf->activation_rf_tech_and_mode) {
  114 + case NCI_NFC_A_PASSIVE_POLL_MODE:
  115 + nfca_poll = &ntf->activation_params.nfca_poll_iso_dep;
  116 + nfca_poll->rats_res_len = *data++;
  117 + if (nfca_poll->rats_res_len > 0) {
  118 + memcpy(nfca_poll->rats_res,
117 119 data,
118   - nfca_poll_iso_dep->rats_res_len);
  120 + nfca_poll->rats_res_len);
119 121 }
120 122 break;
121 123  
122   - case NCI_RF_INTERFACE_FRAME:
123   - /* no activation params */
124   - break;
125   -
126 124 default:
127   - nfc_err("unsupported rf_interface_type 0x%x",
128   - ntf->rf_interface_type);
  125 + nfc_err("unsupported activation_rf_tech_and_mode 0x%x",
  126 + ntf->activation_rf_tech_and_mode);
129 127 return -EPROTO;
130 128 }
131 129  
... ... @@ -133,7 +131,7 @@
133 131 }
134 132  
135 133 static void nci_target_found(struct nci_dev *ndev,
136   - struct nci_rf_activate_ntf *ntf)
  134 + struct nci_rf_intf_activated_ntf *ntf)
137 135 {
138 136 struct nfc_target nfc_tgt;
139 137  
... ... @@ -141,6 +139,8 @@
141 139 nfc_tgt.supported_protocols = NFC_PROTO_MIFARE_MASK;
142 140 else if (ntf->rf_protocol == NCI_RF_PROTOCOL_ISO_DEP) /* 4A */
143 141 nfc_tgt.supported_protocols = NFC_PROTO_ISO14443_MASK;
  142 + else
  143 + nfc_tgt.supported_protocols = 0;
144 144  
145 145 nfc_tgt.sens_res = ntf->rf_tech_specific_params.nfca_poll.sens_res;
146 146 nfc_tgt.sel_res = ntf->rf_tech_specific_params.nfca_poll.sel_res;
147 147  
148 148  
149 149  
150 150  
151 151  
152 152  
153 153  
154 154  
155 155  
156 156  
... ... @@ -158,49 +158,86 @@
158 158 nfc_targets_found(ndev->nfc_dev, &nfc_tgt, 1);
159 159 }
160 160  
161   -static void nci_rf_activate_ntf_packet(struct nci_dev *ndev,
162   - struct sk_buff *skb)
  161 +static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
  162 + struct sk_buff *skb)
163 163 {
164   - struct nci_rf_activate_ntf ntf;
  164 + struct nci_rf_intf_activated_ntf ntf;
165 165 __u8 *data = skb->data;
166   - int rc = -1;
  166 + int err = 0;
167 167  
168 168 clear_bit(NCI_DISCOVERY, &ndev->flags);
169 169 set_bit(NCI_POLL_ACTIVE, &ndev->flags);
170 170  
171   - ntf.target_handle = *data++;
  171 + ntf.rf_discovery_id = *data++;
  172 + ntf.rf_interface_type = *data++;
172 173 ntf.rf_protocol = *data++;
173   - ntf.rf_tech_and_mode = *data++;
  174 + ntf.activation_rf_tech_and_mode = *data++;
174 175 ntf.rf_tech_specific_params_len = *data++;
175 176  
176   - nfc_dbg("target_handle %d, rf_protocol 0x%x, rf_tech_and_mode 0x%x, rf_tech_specific_params_len %d",
177   - ntf.target_handle,
178   - ntf.rf_protocol,
179   - ntf.rf_tech_and_mode,
  177 + nfc_dbg("rf_discovery_id %d", ntf.rf_discovery_id);
  178 + nfc_dbg("rf_interface_type 0x%x", ntf.rf_interface_type);
  179 + nfc_dbg("rf_protocol 0x%x", ntf.rf_protocol);
  180 + nfc_dbg("activation_rf_tech_and_mode 0x%x",
  181 + ntf.activation_rf_tech_and_mode);
  182 + nfc_dbg("rf_tech_specific_params_len %d",
180 183 ntf.rf_tech_specific_params_len);
181 184  
182   - switch (ntf.rf_tech_and_mode) {
183   - case NCI_NFC_A_PASSIVE_POLL_MODE:
184   - rc = nci_rf_activate_nfca_passive_poll(ndev, &ntf,
185   - data);
186   - break;
  185 + if (ntf.rf_tech_specific_params_len > 0) {
  186 + switch (ntf.activation_rf_tech_and_mode) {
  187 + case NCI_NFC_A_PASSIVE_POLL_MODE:
  188 + data = nci_extract_rf_params_nfca_passive_poll(ndev,
  189 + &ntf, data);
  190 + break;
187 191  
188   - default:
189   - nfc_err("unsupported rf_tech_and_mode 0x%x",
190   - ntf.rf_tech_and_mode);
191   - return;
  192 + default:
  193 + nfc_err("unsupported activation_rf_tech_and_mode 0x%x",
  194 + ntf.activation_rf_tech_and_mode);
  195 + return;
  196 + }
192 197 }
193 198  
194   - if (!rc)
  199 + ntf.data_exch_rf_tech_and_mode = *data++;
  200 + ntf.data_exch_tx_bit_rate = *data++;
  201 + ntf.data_exch_rx_bit_rate = *data++;
  202 + ntf.activation_params_len = *data++;
  203 +
  204 + nfc_dbg("data_exch_rf_tech_and_mode 0x%x",
  205 + ntf.data_exch_rf_tech_and_mode);
  206 + nfc_dbg("data_exch_tx_bit_rate 0x%x",
  207 + ntf.data_exch_tx_bit_rate);
  208 + nfc_dbg("data_exch_rx_bit_rate 0x%x",
  209 + ntf.data_exch_rx_bit_rate);
  210 + nfc_dbg("activation_params_len %d",
  211 + ntf.activation_params_len);
  212 +
  213 + if (ntf.activation_params_len > 0) {
  214 + switch (ntf.rf_interface_type) {
  215 + case NCI_RF_INTERFACE_ISO_DEP:
  216 + err = nci_extract_activation_params_iso_dep(ndev,
  217 + &ntf, data);
  218 + break;
  219 +
  220 + case NCI_RF_INTERFACE_FRAME:
  221 + /* no activation params */
  222 + break;
  223 +
  224 + default:
  225 + nfc_err("unsupported rf_interface_type 0x%x",
  226 + ntf.rf_interface_type);
  227 + return;
  228 + }
  229 + }
  230 +
  231 + if (!err)
195 232 nci_target_found(ndev, &ntf);
196 233 }
197 234  
198 235 static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev,
199 236 struct sk_buff *skb)
200 237 {
201   - __u8 type = skb->data[0];
  238 + struct nci_rf_deactivate_ntf *ntf = (void *) skb->data;
202 239  
203   - nfc_dbg("entry, type 0x%x", type);
  240 + nfc_dbg("entry, type 0x%x, reason 0x%x", ntf->type, ntf->reason);
204 241  
205 242 clear_bit(NCI_POLL_ACTIVE, &ndev->flags);
206 243 ndev->target_active_prot = 0;
... ... @@ -241,8 +278,8 @@
241 278 nci_rf_field_info_ntf_packet(ndev, skb);
242 279 break;
243 280  
244   - case NCI_OP_RF_ACTIVATE_NTF:
245   - nci_rf_activate_ntf_packet(ndev, skb);
  281 + case NCI_OP_RF_INTF_ACTIVATED_NTF:
  282 + nci_rf_intf_activated_ntf_packet(ndev, skb);
246 283 break;
247 284  
248 285 case NCI_OP_RF_DEACTIVATE_NTF:
... ... @@ -42,11 +42,12 @@
42 42  
43 43 nfc_dbg("entry, status 0x%x", rsp->status);
44 44  
45   - if (rsp->status == NCI_STATUS_OK)
  45 + if (rsp->status == NCI_STATUS_OK) {
46 46 ndev->nci_ver = rsp->nci_ver;
  47 + nfc_dbg("nci_ver 0x%x, config_status 0x%x",
  48 + rsp->nci_ver, rsp->config_status);
  49 + }
47 50  
48   - nfc_dbg("nci_ver 0x%x", ndev->nci_ver);
49   -
50 51 nci_req_complete(ndev, rsp->status);
51 52 }
52 53  
53 54  
... ... @@ -58,13 +59,13 @@
58 59 nfc_dbg("entry, status 0x%x", rsp_1->status);
59 60  
60 61 if (rsp_1->status != NCI_STATUS_OK)
61   - return;
  62 + goto exit;
62 63  
63 64 ndev->nfcc_features = __le32_to_cpu(rsp_1->nfcc_features);
64 65 ndev->num_supported_rf_interfaces = rsp_1->num_supported_rf_interfaces;
65 66  
66 67 if (ndev->num_supported_rf_interfaces >
67   - NCI_MAX_SUPPORTED_RF_INTERFACES) {
  68 + NCI_MAX_SUPPORTED_RF_INTERFACES) {
68 69 ndev->num_supported_rf_interfaces =
69 70 NCI_MAX_SUPPORTED_RF_INTERFACES;
70 71 }
71 72  
72 73  
... ... @@ -73,21 +74,27 @@
73 74 rsp_1->supported_rf_interfaces,
74 75 ndev->num_supported_rf_interfaces);
75 76  
76   - rsp_2 = (void *) (skb->data + 6 + ndev->num_supported_rf_interfaces);
  77 + rsp_2 = (void *) (skb->data + 6 + rsp_1->num_supported_rf_interfaces);
77 78  
78 79 ndev->max_logical_connections =
79 80 rsp_2->max_logical_connections;
80 81 ndev->max_routing_table_size =
81 82 __le16_to_cpu(rsp_2->max_routing_table_size);
82   - ndev->max_control_packet_payload_length =
83   - rsp_2->max_control_packet_payload_length;
84   - ndev->rf_sending_buffer_size =
85   - __le16_to_cpu(rsp_2->rf_sending_buffer_size);
86   - ndev->rf_receiving_buffer_size =
87   - __le16_to_cpu(rsp_2->rf_receiving_buffer_size);
88   - ndev->manufacturer_id =
89   - __le16_to_cpu(rsp_2->manufacturer_id);
  83 + ndev->max_ctrl_pkt_payload_len =
  84 + rsp_2->max_ctrl_pkt_payload_len;
  85 + ndev->max_size_for_large_params =
  86 + __le16_to_cpu(rsp_2->max_size_for_large_params);
  87 + ndev->max_data_pkt_payload_size =
  88 + rsp_2->max_data_pkt_payload_size;
  89 + ndev->initial_num_credits =
  90 + rsp_2->initial_num_credits;
  91 + ndev->manufact_id =
  92 + rsp_2->manufact_id;
  93 + ndev->manufact_specific_info =
  94 + __le32_to_cpu(rsp_2->manufact_specific_info);
90 95  
  96 + atomic_set(&ndev->credits_cnt, ndev->initial_num_credits);
  97 +
91 98 nfc_dbg("nfcc_features 0x%x",
92 99 ndev->nfcc_features);
93 100 nfc_dbg("num_supported_rf_interfaces %d",
94 101  
... ... @@ -104,15 +111,20 @@
104 111 ndev->max_logical_connections);
105 112 nfc_dbg("max_routing_table_size %d",
106 113 ndev->max_routing_table_size);
107   - nfc_dbg("max_control_packet_payload_length %d",
108   - ndev->max_control_packet_payload_length);
109   - nfc_dbg("rf_sending_buffer_size %d",
110   - ndev->rf_sending_buffer_size);
111   - nfc_dbg("rf_receiving_buffer_size %d",
112   - ndev->rf_receiving_buffer_size);
113   - nfc_dbg("manufacturer_id 0x%x",
114   - ndev->manufacturer_id);
  114 + nfc_dbg("max_ctrl_pkt_payload_len %d",
  115 + ndev->max_ctrl_pkt_payload_len);
  116 + nfc_dbg("max_size_for_large_params %d",
  117 + ndev->max_size_for_large_params);
  118 + nfc_dbg("max_data_pkt_payload_size %d",
  119 + ndev->max_data_pkt_payload_size);
  120 + nfc_dbg("initial_num_credits %d",
  121 + ndev->initial_num_credits);
  122 + nfc_dbg("manufact_id 0x%x",
  123 + ndev->manufact_id);
  124 + nfc_dbg("manufact_specific_info 0x%x",
  125 + ndev->manufact_specific_info);
115 126  
  127 +exit:
116 128 nci_req_complete(ndev, rsp_1->status);
117 129 }
118 130