diff options
author | Thierry Escande <thierry.escande@linux.intel.com> | 2014-01-06 17:34:48 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-01-07 12:48:12 -0500 |
commit | b711ad524bf5a6a078c4d0a1a44ca1db204802f6 (patch) | |
tree | 52d9b5e8fb7db62c9459fa8ed9efbaa2e0622253 /net/nfc/digital_dep.c | |
parent | 48e1044515967a0d88ee076045b2141535557d8e (diff) |
NFC: digital: Set rf tech and crc functions when receiving a PSL_REQ
This patch sets the correct rf tech value and crc functions in target
mode when receiving a PSL_REQ, as done when receiving an ATR_REQ.
Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/digital_dep.c')
-rw-r--r-- | net/nfc/digital_dep.c | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c index 562bec9ad8d9..43e450f78d0a 100644 --- a/net/nfc/digital_dep.c +++ b/net/nfc/digital_dep.c | |||
@@ -380,6 +380,33 @@ int digital_in_send_dep_req(struct nfc_digital_dev *ddev, | |||
380 | data_exch); | 380 | data_exch); |
381 | } | 381 | } |
382 | 382 | ||
383 | static void digital_tg_set_rf_tech(struct nfc_digital_dev *ddev, u8 rf_tech) | ||
384 | { | ||
385 | ddev->curr_rf_tech = rf_tech; | ||
386 | |||
387 | ddev->skb_add_crc = digital_skb_add_crc_none; | ||
388 | ddev->skb_check_crc = digital_skb_check_crc_none; | ||
389 | |||
390 | if (DIGITAL_DRV_CAPS_TG_CRC(ddev)) | ||
391 | return; | ||
392 | |||
393 | switch (ddev->curr_rf_tech) { | ||
394 | case NFC_DIGITAL_RF_TECH_106A: | ||
395 | ddev->skb_add_crc = digital_skb_add_crc_a; | ||
396 | ddev->skb_check_crc = digital_skb_check_crc_a; | ||
397 | break; | ||
398 | |||
399 | case NFC_DIGITAL_RF_TECH_212F: | ||
400 | case NFC_DIGITAL_RF_TECH_424F: | ||
401 | ddev->skb_add_crc = digital_skb_add_crc_f; | ||
402 | ddev->skb_check_crc = digital_skb_check_crc_f; | ||
403 | break; | ||
404 | |||
405 | default: | ||
406 | break; | ||
407 | } | ||
408 | } | ||
409 | |||
383 | static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg, | 410 | static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg, |
384 | struct sk_buff *resp) | 411 | struct sk_buff *resp) |
385 | { | 412 | { |
@@ -475,6 +502,8 @@ static void digital_tg_send_psl_res_complete(struct nfc_digital_dev *ddev, | |||
475 | if (IS_ERR(resp)) | 502 | if (IS_ERR(resp)) |
476 | return; | 503 | return; |
477 | 504 | ||
505 | digital_tg_set_rf_tech(ddev, rf_tech); | ||
506 | |||
478 | digital_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH, rf_tech); | 507 | digital_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH, rf_tech); |
479 | 508 | ||
480 | digital_tg_listen(ddev, 1500, digital_tg_recv_dep_req, NULL); | 509 | digital_tg_listen(ddev, 1500, digital_tg_recv_dep_req, NULL); |
@@ -659,16 +688,10 @@ void digital_tg_recv_atr_req(struct nfc_digital_dev *ddev, void *arg, | |||
659 | 688 | ||
660 | if (resp->data[0] == DIGITAL_NFC_DEP_NFCA_SOD_SB) { | 689 | if (resp->data[0] == DIGITAL_NFC_DEP_NFCA_SOD_SB) { |
661 | min_size = DIGITAL_ATR_REQ_MIN_SIZE + 2; | 690 | min_size = DIGITAL_ATR_REQ_MIN_SIZE + 2; |
662 | 691 | digital_tg_set_rf_tech(ddev, NFC_DIGITAL_RF_TECH_106A); | |
663 | ddev->curr_rf_tech = NFC_DIGITAL_RF_TECH_106A; | ||
664 | ddev->skb_add_crc = digital_skb_add_crc_a; | ||
665 | ddev->skb_check_crc = digital_skb_check_crc_a; | ||
666 | } else { | 692 | } else { |
667 | min_size = DIGITAL_ATR_REQ_MIN_SIZE + 1; | 693 | min_size = DIGITAL_ATR_REQ_MIN_SIZE + 1; |
668 | 694 | digital_tg_set_rf_tech(ddev, NFC_DIGITAL_RF_TECH_212F); | |
669 | ddev->curr_rf_tech = NFC_DIGITAL_RF_TECH_212F; | ||
670 | ddev->skb_add_crc = digital_skb_add_crc_f; | ||
671 | ddev->skb_check_crc = digital_skb_check_crc_f; | ||
672 | } | 695 | } |
673 | 696 | ||
674 | if (resp->len < min_size) { | 697 | if (resp->len < min_size) { |
@@ -676,11 +699,6 @@ void digital_tg_recv_atr_req(struct nfc_digital_dev *ddev, void *arg, | |||
676 | goto exit; | 699 | goto exit; |
677 | } | 700 | } |
678 | 701 | ||
679 | if (DIGITAL_DRV_CAPS_TG_CRC(ddev)) { | ||
680 | ddev->skb_add_crc = digital_skb_add_crc_none; | ||
681 | ddev->skb_check_crc = digital_skb_check_crc_none; | ||
682 | } | ||
683 | |||
684 | ddev->curr_protocol = NFC_PROTO_NFC_DEP_MASK; | 702 | ddev->curr_protocol = NFC_PROTO_NFC_DEP_MASK; |
685 | 703 | ||
686 | rc = ddev->skb_check_crc(resp); | 704 | rc = ddev->skb_check_crc(resp); |