diff options
author | Arron Wang <arron.wang@intel.com> | 2012-09-27 05:32:56 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-10-26 12:26:45 -0400 |
commit | 928326f2237d2dd62b2fb9374c655cd906549868 (patch) | |
tree | 7ea03fcbcf40317ccb3cf0258be1323c197238c5 /drivers/nfc | |
parent | f7a5f6c532f33ba66a7ca19e81ed447a83dab2db (diff) |
NFC: Handle pn544 continue activation
We need to send continue activation command to allow NFCIP-1
activation when a NFC target has been discovered in type A or
type F reader gate.
Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/pn544_hci.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/nfc/pn544_hci.c b/drivers/nfc/pn544_hci.c index d81242f4a92b..6d564bd8b3b4 100644 --- a/drivers/nfc/pn544_hci.c +++ b/drivers/nfc/pn544_hci.c | |||
@@ -118,6 +118,8 @@ enum pn544_state { | |||
118 | #define PN544_HCI_EVT_RCV_DATA 0x04 | 118 | #define PN544_HCI_EVT_RCV_DATA 0x04 |
119 | #define PN544_HCI_EVT_CONTINUE_MI 0x05 | 119 | #define PN544_HCI_EVT_CONTINUE_MI 0x05 |
120 | 120 | ||
121 | #define PN544_HCI_CMD_CONTINUE_ACTIVATION 0x13 | ||
122 | |||
121 | static struct nfc_hci_gate pn544_gates[] = { | 123 | static struct nfc_hci_gate pn544_gates[] = { |
122 | {NFC_HCI_ADMIN_GATE, NFC_HCI_INVALID_PIPE}, | 124 | {NFC_HCI_ADMIN_GATE, NFC_HCI_INVALID_PIPE}, |
123 | {NFC_HCI_LOOPBACK_GATE, NFC_HCI_INVALID_PIPE}, | 125 | {NFC_HCI_LOOPBACK_GATE, NFC_HCI_INVALID_PIPE}, |
@@ -755,6 +757,9 @@ static int pn544_hci_target_from_gate(struct nfc_hci_dev *hdev, u8 gate, | |||
755 | target->supported_protocols = NFC_PROTO_JEWEL_MASK; | 757 | target->supported_protocols = NFC_PROTO_JEWEL_MASK; |
756 | target->sens_res = 0x0c00; | 758 | target->sens_res = 0x0c00; |
757 | break; | 759 | break; |
760 | case PN544_RF_READER_NFCIP1_INITIATOR_GATE: | ||
761 | target->supported_protocols = NFC_PROTO_NFC_DEP_MASK; | ||
762 | break; | ||
758 | default: | 763 | default: |
759 | return -EPROTO; | 764 | return -EPROTO; |
760 | } | 765 | } |
@@ -769,7 +774,18 @@ static int pn544_hci_complete_target_discovered(struct nfc_hci_dev *hdev, | |||
769 | struct sk_buff *uid_skb; | 774 | struct sk_buff *uid_skb; |
770 | int r = 0; | 775 | int r = 0; |
771 | 776 | ||
772 | if (target->supported_protocols & NFC_PROTO_MIFARE_MASK) { | 777 | if (gate == PN544_RF_READER_NFCIP1_INITIATOR_GATE) |
778 | return r; | ||
779 | |||
780 | if (target->supported_protocols & NFC_PROTO_NFC_DEP_MASK) { | ||
781 | r = nfc_hci_send_cmd(hdev, | ||
782 | PN544_RF_READER_NFCIP1_INITIATOR_GATE, | ||
783 | PN544_HCI_CMD_CONTINUE_ACTIVATION, NULL, 0, NULL); | ||
784 | if (r < 0) | ||
785 | return r; | ||
786 | |||
787 | target->hci_reader_gate = PN544_RF_READER_NFCIP1_INITIATOR_GATE; | ||
788 | } else if (target->supported_protocols & NFC_PROTO_MIFARE_MASK) { | ||
773 | if (target->nfcid1_len != 4 && target->nfcid1_len != 7 && | 789 | if (target->nfcid1_len != 4 && target->nfcid1_len != 7 && |
774 | target->nfcid1_len != 10) | 790 | target->nfcid1_len != 10) |
775 | return -EPROTO; | 791 | return -EPROTO; |
@@ -792,6 +808,16 @@ static int pn544_hci_complete_target_discovered(struct nfc_hci_dev *hdev, | |||
792 | PN544_RF_READER_CMD_ACTIVATE_NEXT, | 808 | PN544_RF_READER_CMD_ACTIVATE_NEXT, |
793 | uid_skb->data, uid_skb->len, NULL); | 809 | uid_skb->data, uid_skb->len, NULL); |
794 | kfree_skb(uid_skb); | 810 | kfree_skb(uid_skb); |
811 | |||
812 | r = nfc_hci_send_cmd(hdev, | ||
813 | PN544_RF_READER_NFCIP1_INITIATOR_GATE, | ||
814 | PN544_HCI_CMD_CONTINUE_ACTIVATION, | ||
815 | NULL, 0, NULL); | ||
816 | if (r < 0) | ||
817 | return r; | ||
818 | |||
819 | target->hci_reader_gate = PN544_RF_READER_NFCIP1_INITIATOR_GATE; | ||
820 | target->supported_protocols = NFC_PROTO_NFC_DEP_MASK; | ||
795 | } else if (target->supported_protocols & NFC_PROTO_ISO14443_MASK) { | 821 | } else if (target->supported_protocols & NFC_PROTO_ISO14443_MASK) { |
796 | /* | 822 | /* |
797 | * TODO: maybe other ISO 14443 require some kind of continue | 823 | * TODO: maybe other ISO 14443 require some kind of continue |