diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2015-02-01 22:26:14 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2015-02-02 21:50:40 +0100 |
commit | 11f54f228643d0248ec00ce8c9fb8d872f87e7b8 (patch) | |
tree | 5cf467e89367c99bff3565669ee777dc8d5cad8f /net/nfc/nci/ntf.c | |
parent | 736bb9577407d3556d81c3c3cd57581cd3ae10ea (diff) |
NFC: nci: Add HCI over NCI protocol support
According to the NCI specification, one can use HCI over NCI
to talk with specific NFCEE. The HCI network is viewed as one
logical NFCEE.
This is needed to support secure element running HCI only
firmwares embedded on an NCI capable chipset, like e.g. the
st21nfcb.
There is some duplication between this piece of code and the
HCI core code, but the latter would need to be abstracted even
more to be able to use NCI as a logical transport for HCP packets.
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/nci/ntf.c')
-rw-r--r-- | net/nfc/nci/ntf.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c index 4c0be7e82d29..6e041ac49e17 100644 --- a/net/nfc/nci/ntf.c +++ b/net/nfc/nci/ntf.c @@ -723,18 +723,30 @@ static void nci_nfcee_discover_ntf_packet(struct nci_dev *ndev, pr_debug("\n"); - conn_info = devm_kzalloc(&ndev->nfc_dev->dev, - sizeof(struct nci_conn_info), GFP_KERNEL); - if (!conn_info) { - status = NCI_STATUS_REJECTED; - goto exit; - } + /* NFCForum NCI 9.2.1 HCI Network Specific Handling + * If the NFCC supports the HCI Network, it SHALL return one, + * and only one, NFCEE_DISCOVER_NTF with a Protocol type of + * “HCI Access”, even if the HCI Network contains multiple NFCEEs. + */ + if (!ndev->hci_dev->conn_info) { + conn_info = devm_kzalloc(&ndev->nfc_dev->dev, + sizeof(*conn_info), GFP_KERNEL); + if (!conn_info) { + status = NCI_STATUS_REJECTED; + goto exit; + } - conn_info->id = nfcee_ntf->nfcee_id; - conn_info->conn_id = NCI_INVALID_CONN_ID; + conn_info->id = nfcee_ntf->nfcee_id; + conn_info->conn_id = NCI_INVALID_CONN_ID; - INIT_LIST_HEAD(&conn_info->list); - list_add(&conn_info->list, &ndev->conn_info_list); + conn_info->data_exchange_cb = nci_hci_data_received_cb; + conn_info->data_exchange_cb_context = ndev; + + INIT_LIST_HEAD(&conn_info->list); + list_add(&conn_info->list, &ndev->conn_info_list); + + ndev->hci_dev->conn_info = conn_info; + } exit: nci_req_complete(ndev, status); |