aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-12-19 13:11:32 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-01-09 18:51:54 -0500
commit390a1bd8538132186ddb679cafe9e75b7ef7e2d2 (patch)
tree1c548396163a30e0e29f6572cf7b6f0c645085ba /net/nfc
parent2ad554a502facd705ce6eb362d0f1ac3ca426508 (diff)
NFC: Initial Secure Element API
Each NFC adapter can have several links to different secure elements and that property needs to be exported by the drivers. A secure element link can be enabled and disabled, and card emulation will be handled by the currently active one. Otherwise card emulation will be host implemented. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/core.c3
-rw-r--r--net/nfc/hci/core.c3
-rw-r--r--net/nfc/nci/core.c2
-rw-r--r--net/nfc/netlink.c1
4 files changed, 8 insertions, 1 deletions
diff --git a/net/nfc/core.c b/net/nfc/core.c
index 7d7b4ee34015..25522e56d350 100644
--- a/net/nfc/core.c
+++ b/net/nfc/core.c
@@ -757,6 +757,7 @@ struct nfc_dev *nfc_get_device(unsigned int idx)
757 */ 757 */
758struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops, 758struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
759 u32 supported_protocols, 759 u32 supported_protocols,
760 u32 supported_se,
760 int tx_headroom, int tx_tailroom) 761 int tx_headroom, int tx_tailroom)
761{ 762{
762 struct nfc_dev *dev; 763 struct nfc_dev *dev;
@@ -774,6 +775,8 @@ struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
774 775
775 dev->ops = ops; 776 dev->ops = ops;
776 dev->supported_protocols = supported_protocols; 777 dev->supported_protocols = supported_protocols;
778 dev->supported_se = supported_se;
779 dev->active_se = NFC_SE_NONE;
777 dev->tx_headroom = tx_headroom; 780 dev->tx_headroom = tx_headroom;
778 dev->tx_tailroom = tx_tailroom; 781 dev->tx_tailroom = tx_tailroom;
779 782
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c
index 755a6b9774ab..91020b210d87 100644
--- a/net/nfc/hci/core.c
+++ b/net/nfc/hci/core.c
@@ -797,6 +797,7 @@ struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
797 struct nfc_hci_init_data *init_data, 797 struct nfc_hci_init_data *init_data,
798 unsigned long quirks, 798 unsigned long quirks,
799 u32 protocols, 799 u32 protocols,
800 u32 supported_se,
800 const char *llc_name, 801 const char *llc_name,
801 int tx_headroom, 802 int tx_headroom,
802 int tx_tailroom, 803 int tx_tailroom,
@@ -822,7 +823,7 @@ struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
822 return NULL; 823 return NULL;
823 } 824 }
824 825
825 hdev->ndev = nfc_allocate_device(&hci_nfc_ops, protocols, 826 hdev->ndev = nfc_allocate_device(&hci_nfc_ops, protocols, supported_se,
826 tx_headroom + HCI_CMDS_HEADROOM, 827 tx_headroom + HCI_CMDS_HEADROOM,
827 tx_tailroom); 828 tx_tailroom);
828 if (!hdev->ndev) { 829 if (!hdev->ndev) {
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 5f98dc1bf039..48ada0ec749e 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -658,6 +658,7 @@ static struct nfc_ops nci_nfc_ops = {
658 */ 658 */
659struct nci_dev *nci_allocate_device(struct nci_ops *ops, 659struct nci_dev *nci_allocate_device(struct nci_ops *ops,
660 __u32 supported_protocols, 660 __u32 supported_protocols,
661 __u32 supported_se,
661 int tx_headroom, int tx_tailroom) 662 int tx_headroom, int tx_tailroom)
662{ 663{
663 struct nci_dev *ndev; 664 struct nci_dev *ndev;
@@ -680,6 +681,7 @@ struct nci_dev *nci_allocate_device(struct nci_ops *ops,
680 681
681 ndev->nfc_dev = nfc_allocate_device(&nci_nfc_ops, 682 ndev->nfc_dev = nfc_allocate_device(&nci_nfc_ops,
682 supported_protocols, 683 supported_protocols,
684 supported_se,
683 tx_headroom + NCI_DATA_HDR_SIZE, 685 tx_headroom + NCI_DATA_HDR_SIZE,
684 tx_tailroom); 686 tx_tailroom);
685 if (!ndev->nfc_dev) 687 if (!ndev->nfc_dev)
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 3568ae16786d..504b883439f1 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -366,6 +366,7 @@ static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev,
366 if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) || 366 if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) ||
367 nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || 367 nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) ||
368 nla_put_u32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols) || 368 nla_put_u32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols) ||
369 nla_put_u32(msg, NFC_ATTR_SE, dev->supported_se) ||
369 nla_put_u8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up) || 370 nla_put_u8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up) ||
370 nla_put_u8(msg, NFC_ATTR_RF_MODE, dev->rf_mode)) 371 nla_put_u8(msg, NFC_ATTR_RF_MODE, dev->rf_mode))
371 goto nla_put_failure; 372 goto nla_put_failure;