Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c09e92f authored by David S. Miller's avatar David S. Miller
Browse files


NFC: 3.20 second pull request

This is the second NFC pull request for 3.20.

It brings:

- NCI NFCEE (NFC Execution Environment, typically an embedded or
  external secure element) discovery and enabling/disabling support.
  In order to communicate with an NFCEE, we also added NCI's logical
  connections support to the NCI stack.

- HCI over NCI protocol support. Some secure elements only understand
  HCI and thus we need to send them HCI frames when they're part of
  an NCI chipset.

- NFC_EVT_TRANSACTION userspace API addition. Whenever an application
  running on a secure element needs to notify its host counterpart,
  we send an NFC_EVENT_SE_TRANSACTION event to userspace through the
  NFC netlink socket.

- Secure element and HCI transaction event support for the st21nfcb
  chipset.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 020219a6 fa00e8fe
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -301,6 +301,8 @@ int st21nfca_connectivity_event_received(struct nfc_hci_dev *hdev, u8 host,
				u8 event, struct sk_buff *skb)
{
	int r = 0;
	struct device *dev = &hdev->ndev->dev;
	struct nfc_evt_transaction *transaction;

	pr_debug("connectivity gate event: %x\n", event);

@@ -308,6 +310,25 @@ int st21nfca_connectivity_event_received(struct nfc_hci_dev *hdev, u8 host,
	case ST21NFCA_EVT_CONNECTIVITY:
		break;
	case ST21NFCA_EVT_TRANSACTION:
		if (skb->len < NFC_MIN_AID_LENGTH + 2 &&
		    skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG)
			return -EPROTO;

		transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev,
						   skb->len - 2, GFP_KERNEL);

		transaction->aid_len = skb->data[1];
		memcpy(transaction->aid, &skb->data[2], skb->data[1]);

		if (skb->data[transaction->aid_len + 2] !=
		    NFC_EVT_TRANSACTION_PARAMS_TAG)
			return -EPROTO;

		transaction->params_len = skb->data[transaction->aid_len + 3];
		memcpy(transaction->params, skb->data +
		       transaction->aid_len + 4, transaction->params_len);

		r = nfc_se_transaction(hdev->ndev, host, transaction);
		break;
	default:
		return 1;
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
# Makefile for ST21NFCB NCI based NFC driver
#

st21nfcb_nci-objs = ndlc.o st21nfcb.o
st21nfcb_nci-objs = ndlc.o st21nfcb.o st21nfcb_se.o
obj-$(CONFIG_NFC_ST21NFCB)     += st21nfcb_nci.o

st21nfcb_i2c-objs = i2c.o
+10 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <net/nfc/nci_core.h>

#include "st21nfcb.h"
#include "st21nfcb_se.h"

#define DRIVER_DESC "NCI NFC driver for ST21NFCB"

@@ -78,6 +79,13 @@ static struct nci_ops st21nfcb_nci_ops = {
	.close = st21nfcb_nci_close,
	.send = st21nfcb_nci_send,
	.get_rfprotocol = st21nfcb_nci_get_rfprotocol,
	.discover_se = st21nfcb_nci_discover_se,
	.enable_se = st21nfcb_nci_enable_se,
	.disable_se = st21nfcb_nci_disable_se,
	.se_io = st21nfcb_nci_se_io,
	.hci_load_session = st21nfcb_hci_load_session,
	.hci_event_received = st21nfcb_hci_event_received,
	.hci_cmd_received = st21nfcb_hci_cmd_received,
};

int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int phy_headroom,
@@ -114,9 +122,10 @@ int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int phy_headroom,
	if (r) {
		pr_err("Cannot register nfc device to nci core\n");
		nci_free_device(ndlc->ndev);
		return r;
	}

	return r;
	return st21nfcb_se_init(ndlc->ndev);
}
EXPORT_SYMBOL_GPL(st21nfcb_nci_probe);

+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#ifndef __LOCAL_ST21NFCB_H_
#define __LOCAL_ST21NFCB_H_

#include "st21nfcb_se.h"
#include "ndlc.h"

/* Define private flags: */
@@ -27,6 +28,7 @@
struct st21nfcb_nci_info {
	struct llt_ndlc *ndlc;
	unsigned long flags;
	struct st21nfcb_se_info se_info;
};

void st21nfcb_nci_remove(struct nci_dev *ndev);
+707 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading