aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/digital_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/nfc/digital_core.c')
-rw-r--r--net/nfc/digital_core.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c
index a6ce3c627e4e..009bcf317101 100644
--- a/net/nfc/digital_core.c
+++ b/net/nfc/digital_core.c
@@ -201,6 +201,11 @@ static void digital_wq_cmd(struct work_struct *work)
201 digital_send_cmd_complete, cmd); 201 digital_send_cmd_complete, cmd);
202 break; 202 break;
203 203
204 case DIGITAL_CMD_TG_LISTEN_MD:
205 rc = ddev->ops->tg_listen_md(ddev, cmd->timeout,
206 digital_send_cmd_complete, cmd);
207 break;
208
204 default: 209 default:
205 pr_err("Unknown cmd type %d\n", cmd->type); 210 pr_err("Unknown cmd type %d\n", cmd->type);
206 return; 211 return;
@@ -293,12 +298,19 @@ static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech)
293 500, digital_tg_recv_atr_req, NULL); 298 500, digital_tg_recv_atr_req, NULL);
294} 299}
295 300
301static int digital_tg_listen_md(struct nfc_digital_dev *ddev, u8 rf_tech)
302{
303 return digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MD, NULL, NULL, 500,
304 digital_tg_recv_md_req, NULL);
305}
306
296int digital_target_found(struct nfc_digital_dev *ddev, 307int digital_target_found(struct nfc_digital_dev *ddev,
297 struct nfc_target *target, u8 protocol) 308 struct nfc_target *target, u8 protocol)
298{ 309{
299 int rc; 310 int rc;
300 u8 framing; 311 u8 framing;
301 u8 rf_tech; 312 u8 rf_tech;
313 u8 poll_tech_count;
302 int (*check_crc)(struct sk_buff *skb); 314 int (*check_crc)(struct sk_buff *skb);
303 void (*add_crc)(struct sk_buff *skb); 315 void (*add_crc)(struct sk_buff *skb);
304 316
@@ -375,12 +387,16 @@ int digital_target_found(struct nfc_digital_dev *ddev,
375 return rc; 387 return rc;
376 388
377 target->supported_protocols = (1 << protocol); 389 target->supported_protocols = (1 << protocol);
378 rc = nfc_targets_found(ddev->nfc_dev, target, 1);
379 if (rc)
380 return rc;
381 390
391 poll_tech_count = ddev->poll_tech_count;
382 ddev->poll_tech_count = 0; 392 ddev->poll_tech_count = 0;
383 393
394 rc = nfc_targets_found(ddev->nfc_dev, target, 1);
395 if (rc) {
396 ddev->poll_tech_count = poll_tech_count;
397 return rc;
398 }
399
384 return 0; 400 return 0;
385} 401}
386 402
@@ -505,6 +521,9 @@ static int digital_start_poll(struct nfc_dev *nfc_dev, __u32 im_protocols,
505 if (ddev->ops->tg_listen_mdaa) { 521 if (ddev->ops->tg_listen_mdaa) {
506 digital_add_poll_tech(ddev, 0, 522 digital_add_poll_tech(ddev, 0,
507 digital_tg_listen_mdaa); 523 digital_tg_listen_mdaa);
524 } else if (ddev->ops->tg_listen_md) {
525 digital_add_poll_tech(ddev, 0,
526 digital_tg_listen_md);
508 } else { 527 } else {
509 digital_add_poll_tech(ddev, NFC_DIGITAL_RF_TECH_106A, 528 digital_add_poll_tech(ddev, NFC_DIGITAL_RF_TECH_106A,
510 digital_tg_listen_nfca); 529 digital_tg_listen_nfca);
@@ -732,7 +751,7 @@ struct nfc_digital_dev *nfc_digital_allocate_device(struct nfc_digital_ops *ops,
732 751
733 if (!ops->in_configure_hw || !ops->in_send_cmd || !ops->tg_listen || 752 if (!ops->in_configure_hw || !ops->in_send_cmd || !ops->tg_listen ||
734 !ops->tg_configure_hw || !ops->tg_send_cmd || !ops->abort_cmd || 753 !ops->tg_configure_hw || !ops->tg_send_cmd || !ops->abort_cmd ||
735 !ops->switch_rf) 754 !ops->switch_rf || (ops->tg_listen_md && !ops->tg_get_rf_tech))
736 return NULL; 755 return NULL;
737 756
738 ddev = kzalloc(sizeof(struct nfc_digital_dev), GFP_KERNEL); 757 ddev = kzalloc(sizeof(struct nfc_digital_dev), GFP_KERNEL);