Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1216908 > unrolled thread

[PATCH v2 0/9] Adds Intel FieldsPeak NFC solution driver

Started byRobert Dolca <robert.dolca@intel.com>
First post2015-09-01 17:00 +0200
Last post2015-09-01 17:00 +0200
Articles 4 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/9] Adds Intel FieldsPeak NFC solution driver Robert Dolca <robert.dolca@intel.com> - 2015-09-01 17:00 +0200
    [PATCH v2 4/9] nfc: nci: Allow the driver to set handler for core nci ops Robert Dolca <robert.dolca@intel.com> - 2015-09-01 17:00 +0200
    [PATCH v2 2/9] nfc: nci: Add function to get max packet size for conn Robert Dolca <robert.dolca@intel.com> - 2015-09-01 17:00 +0200
    [PATCH v2 3/9] nfc: nci: Introduce new core opcodes Robert Dolca <robert.dolca@intel.com> - 2015-09-01 17:00 +0200

#1216908 — [PATCH v2 0/9] Adds Intel FieldsPeak NFC solution driver

FromRobert Dolca <robert.dolca@intel.com>
Date2015-09-01 17:00 +0200
Subject[PATCH v2 0/9] Adds Intel FieldsPeak NFC solution driver
Message-ID<q3Vct-1fz-5@gated-at.bofh.it>
These patches add support for Intel's FieldsPeak NFC solution.

Fields Peak complies with the ISO/IEC 14443A/B, 15693, 18092,
and JIS X 6319-4. It is an NCI based controller.

RF Protocols supported:
 - NFC Forum Type 1 Tags (Jewel, Topaz)
 - NFC Forum Type 2 Tags (Mifare UL)
 - NFC Forum Type 3 Tags (FeliCa)
 - NFC Forum Type 4A (ISO/IEC 14443 A-4 106kbps to 848kbps)
 - NFC Forum Type 4B (ISO/IEC 14443 B-4 106kbps to 848kbps)
 - NFCIP in passive and active modes (ISO/IEC 18092 106kbps to 424kbps)
 - B’ (based on ISO/IEC 14443 B-2)
 - iCLASS (based on ISO/IEC 15693-2)
 - Vicinity cards (ISO/IEC 15693-3)
 - Kovio tags (NFC Forum Type 2)

The device can be enumerated using ACPI using the id INT339A.
The 1st GPIO is the IRQ and the 2nd is the RESET pin.

Changes since v1:
 - removed .owner
 - made local functions static
 - replaced nfc_info with dev_dbg
 - make controller setup possible without OTP patch
 - removed the commint that was adding nci_init/reset and start using
   the newly added functions nci_core_init/reset
 - fixed typo and use full controller name instead of abreviation in Kconfig
 - added more info about the controller in the commit message
 - moved NCI_OP_CORE_RESET_NTF, NCI_OP_CORE_GET_CONFIG_RSP and
   NCI_OP_CORE_GET_CONFIG_CMD into the core header files
 - added MODULE_DEVICE_TABLE for ACPI
 - defined FDP_FW_UPDATE_DEST 0xC2
 - release the firmware buffers
 - settings the vendor configuration and clock on post setup
 - platform data enumerations removed (ACPI enumeration left)
 - packet reception intercept logic remove
 - nci: removed "NFC: NCI: Adds NCI init and reset API for drivers"
 - nci: removed nci_send_cmd symbol export
 - nci: removed nci_request_driver and nci_req_complete_driver
 - removed mutex from driver (no need for it)
 - nci: check the setup return code before callig post_setup
 - nci: add function to allow sending core commands from driver
 - nci: Use a separate mutex for nci open and close
 - nci: mutex for: Adds a way to get the new connection ID
 - nci: Allow the driver to set handler for core nci ops

Robert Dolca (9):
  nfc: nci: Exporting nci data send API
  nfc: nci: Add function to get max packet size for conn
  nfc: nci: Define new core opcodes
  nfc: nci: Allow the driver to set handler for core nci ops
  nfc: nci: Do not call post_setup when setup fails
  nfc: nci: Add function to allow sending core commands from driver
  nfc: nci: Use a separate mutex for nci open and close
  nfc: nci: Adds a way to get the new connection ID
  nfc: Add Intel Fields Peak NFC solution driver

 drivers/nfc/Kconfig            |   1 +
 drivers/nfc/Makefile           |   1 +
 drivers/nfc/fdp/Kconfig        |  23 ++
 drivers/nfc/fdp/Makefile       |   9 +
 drivers/nfc/fdp/fdp.c          | 777 +++++++++++++++++++++++++++++++++++++++++
 drivers/nfc/fdp/fdp.h          |  52 +++
 drivers/nfc/fdp/i2c.c          | 416 ++++++++++++++++++++++
 drivers/nfc/st-nci/st-nci_se.c |   2 +-
 include/net/nfc/nci.h          |   7 +
 include/net/nfc/nci_core.h     |  29 +-
 net/nfc/nci/core.c             | 108 +++---
 net/nfc/nci/data.c             |  13 +
 net/nfc/nci/ntf.c              |   6 +-
 net/nfc/nci/rsp.c              |  12 +-
 14 files changed, 1403 insertions(+), 53 deletions(-)
 create mode 100644 drivers/nfc/fdp/Kconfig
 create mode 100644 drivers/nfc/fdp/Makefile
 create mode 100644 drivers/nfc/fdp/fdp.c
 create mode 100644 drivers/nfc/fdp/fdp.h
 create mode 100644 drivers/nfc/fdp/i2c.c

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1216909 — [PATCH v2 4/9] nfc: nci: Allow the driver to set handler for core nci ops

FromRobert Dolca <robert.dolca@intel.com>
Date2015-09-01 17:00 +0200
Subject[PATCH v2 4/9] nfc: nci: Allow the driver to set handler for core nci ops
Message-ID<q3Vcv-1fz-51@gated-at.bofh.it>
In reply to#1216908
The driver may be required to act when some responses or notifications
arrive. For example the NCI core does not have a handler for
NCI_OP_CORE_GET_CONFIG_RSP. The NFCC can send a config response that has
to be read by the driver and the packet may contain vendor specific data.

The Fields Peak driver needs to take certain actions when a reset
notification arrives (packet also not handled by the nfc core).

The driver handlers do not interfere with the core and they are called
after the core processes the packet.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
---
 include/net/nfc/nci_core.h | 13 +++++++++----
 net/nfc/nci/core.c         | 43 +++++++++++++++++++++++--------------------
 net/nfc/nci/ntf.c          |  6 +++++-
 net/nfc/nci/rsp.c          |  6 +++++-
 4 files changed, 42 insertions(+), 26 deletions(-)

diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 8a4ab1e..30c1b21 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -96,6 +96,9 @@ struct nci_ops {
 
 	struct nci_prop_ops *prop_ops;
 	size_t n_prop_ops;
+
+	struct nci_prop_ops *core_ops;
+	size_t n_core_ops;
 };
 
 #define NCI_MAX_SUPPORTED_RF_INTERFACES		4
@@ -344,10 +347,12 @@ static inline int nci_set_vendor_cmds(struct nci_dev *ndev,
 
 void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb);
 void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb);
-int nci_prop_rsp_packet(struct nci_dev *ndev, __u16 opcode,
-			struct sk_buff *skb);
-int nci_prop_ntf_packet(struct nci_dev *ndev, __u16 opcode,
-			struct sk_buff *skb);
+int nci_op_rsp_packet(struct nci_dev *ndev, __u16 rsp_opcode,
+		      struct sk_buff *skb, struct nci_prop_ops *ops,
+		      size_t n_ops);
+int nci_op_ntf_packet(struct nci_dev *ndev, __u16 ntf_opcode,
+		      struct sk_buff *skb, struct nci_prop_ops *ops,
+		      size_t n_ops);
 void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb);
 int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload);
 int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb);
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 943889b..e2bd5f4 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -1228,46 +1228,49 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload)
 }
 
 /* Proprietary commands API */
-static struct nci_prop_ops *prop_cmd_lookup(struct nci_dev *ndev,
-					    __u16 opcode)
+static struct nci_prop_ops *ops_cmd_lookup(struct nci_prop_ops *ops,
+					   size_t n_ops,
+					   __u16 opcode)
 {
 	size_t i;
-	struct nci_prop_ops *prop_op;
+	struct nci_prop_ops *op;
 
-	if (!ndev->ops->prop_ops || !ndev->ops->n_prop_ops)
+	if (!ops || !n_ops)
 		return NULL;
 
-	for (i = 0; i < ndev->ops->n_prop_ops; i++) {
-		prop_op = &ndev->ops->prop_ops[i];
-		if (prop_op->opcode == opcode)
-			return prop_op;
+	for (i = 0; i < n_ops; i++) {
+		op = &ops[i];
+		if (op->opcode == opcode)
+			return op;
 	}
 
 	return NULL;
 }
 
-int nci_prop_rsp_packet(struct nci_dev *ndev, __u16 rsp_opcode,
-			struct sk_buff *skb)
+int nci_op_rsp_packet(struct nci_dev *ndev, __u16 rsp_opcode,
+		      struct sk_buff *skb, struct nci_prop_ops *ops,
+		      size_t n_ops)
 {
-	struct nci_prop_ops *prop_op;
+	struct nci_prop_ops *op;
 
-	prop_op = prop_cmd_lookup(ndev, rsp_opcode);
-	if (!prop_op || !prop_op->rsp)
+	op = ops_cmd_lookup(ops, n_ops, rsp_opcode);
+	if (!op || !op->rsp)
 		return -ENOTSUPP;
 
-	return prop_op->rsp(ndev, skb);
+	return op->rsp(ndev, skb);
 }
 
-int nci_prop_ntf_packet(struct nci_dev *ndev, __u16 ntf_opcode,
-			struct sk_buff *skb)
+int nci_op_ntf_packet(struct nci_dev *ndev, __u16 ntf_opcode,
+		      struct sk_buff *skb, struct nci_prop_ops *ops,
+		      size_t n_ops)
 {
-	struct nci_prop_ops *prop_op;
+	struct nci_prop_ops *op;
 
-	prop_op = prop_cmd_lookup(ndev, ntf_opcode);
-	if (!prop_op || !prop_op->ntf)
+	op = ops_cmd_lookup(ops, n_ops, ntf_opcode);
+	if (!op || !op->ntf)
 		return -ENOTSUPP;
 
-	return prop_op->ntf(ndev, skb);
+	return op->ntf(ndev, skb);
 }
 
 /* ---- NCI TX Data worker thread ---- */
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index 5d1c2e3..8f6ed35 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -759,7 +759,9 @@ void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
 	skb_pull(skb, NCI_CTRL_HDR_SIZE);
 
 	if (nci_opcode_gid(ntf_opcode) == NCI_GID_PROPRIETARY) {
-		if (nci_prop_ntf_packet(ndev, ntf_opcode, skb)) {
+		if (nci_op_ntf_packet(ndev, ntf_opcode, skb,
+				      ndev->ops->prop_ops,
+				      ndev->ops->n_prop_ops) == -ENOTSUPP) {
 			pr_err("unsupported ntf opcode 0x%x\n",
 			       ntf_opcode);
 		}
@@ -805,6 +807,8 @@ void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
 		break;
 	}
 
+	nci_op_ntf_packet(ndev, ntf_opcode, skb, ndev->ops->core_ops,
+			  ndev->ops->n_core_ops);
 end:
 	kfree_skb(skb);
 }
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index 408bd8f..0efab0b 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -297,7 +297,9 @@ void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
 	skb_pull(skb, NCI_CTRL_HDR_SIZE);
 
 	if (nci_opcode_gid(rsp_opcode) == NCI_GID_PROPRIETARY) {
-		if (nci_prop_rsp_packet(ndev, rsp_opcode, skb) == -ENOTSUPP) {
+		if (nci_op_rsp_packet(ndev, rsp_opcode, skb,
+				      ndev->ops->prop_ops,
+				      ndev->ops->n_prop_ops) == -ENOTSUPP) {
 			pr_err("unsupported rsp opcode 0x%x\n",
 			       rsp_opcode);
 		}
@@ -355,6 +357,8 @@ void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
 		break;
 	}
 
+	nci_op_rsp_packet(ndev, rsp_opcode, skb, ndev->ops->core_ops,
+			  ndev->ops->n_core_ops);
 end:
 	kfree_skb(skb);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1216910 — [PATCH v2 2/9] nfc: nci: Add function to get max packet size for conn

FromRobert Dolca <robert.dolca@intel.com>
Date2015-09-01 17:00 +0200
Subject[PATCH v2 2/9] nfc: nci: Add function to get max packet size for conn
Message-ID<q3Vcv-1fz-53@gated-at.bofh.it>
In reply to#1216908
FDP driver needs to send the firmware as regular packets
(not fragmented). The driver should have a way to
get the max packet size for a given connection.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
---
 include/net/nfc/nci_core.h |  1 +
 net/nfc/nci/data.c         | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index d0d0f1e..8a4ab1e 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -351,6 +351,7 @@ int nci_prop_ntf_packet(struct nci_dev *ndev, __u16 opcode,
 void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb);
 int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload);
 int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb);
+__u8 nci_conn_max_data_pkt_payload_size(struct nci_dev *ndev, __u8 conn_id);
 void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb,
 				__u8 conn_id, int err);
 void nci_hci_data_received_cb(void *context, struct sk_buff *skb, int err);
diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c
index 83acd18..30cbed7 100644
--- a/net/nfc/nci/data.c
+++ b/net/nfc/nci/data.c
@@ -90,6 +90,18 @@ static inline void nci_push_data_hdr(struct nci_dev *ndev,
 	nci_pbf_set((__u8 *)hdr, pbf);
 }
 
+__u8 nci_conn_max_data_pkt_payload_size(struct nci_dev *ndev, __u8 conn_id)
+{
+	struct nci_conn_info *conn_info;
+
+	conn_info = nci_get_conn_info_by_conn_id(ndev, conn_id);
+	if (!conn_info)
+		return -EPROTO;
+
+	return conn_info->max_pkt_payload_len;
+}
+EXPORT_SYMBOL(nci_conn_max_data_pkt_payload_size);
+
 static int nci_queue_tx_data_frags(struct nci_dev *ndev,
 				   __u8 conn_id,
 				   struct sk_buff *skb) {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1216913 — [PATCH v2 3/9] nfc: nci: Introduce new core opcodes

FromRobert Dolca <robert.dolca@intel.com>
Date2015-09-01 17:00 +0200
Subject[PATCH v2 3/9] nfc: nci: Introduce new core opcodes
Message-ID<q3Vcv-1fz-59@gated-at.bofh.it>
In reply to#1216908
Add NCI_OP_CORE_GET_CONFIG_CMD, NCI_OP_CORE_GET_CONFIG_RSP
and NCI_OP_CORE_RESET_NTF.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
---
 include/net/nfc/nci.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 75d2e18..b495825 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -315,6 +315,8 @@ struct nci_nfcee_mode_set_cmd {
 	__u8	nfcee_mode;
 } __packed;
 
+#define NCI_OP_CORE_GET_CONFIG_CMD	nci_opcode_pack(NCI_GID_CORE, 0x03)
+
 /* ----------------------- */
 /* ---- NCI Responses ---- */
 /* ----------------------- */
@@ -375,6 +377,9 @@ struct nci_nfcee_discover_rsp {
 } __packed;
 
 #define NCI_OP_NFCEE_MODE_SET_RSP nci_opcode_pack(NCI_GID_NFCEE_MGMT, 0x01)
+
+#define NCI_OP_CORE_GET_CONFIG_RSP	nci_opcode_pack(NCI_GID_CORE, 0x03)
+
 /* --------------------------- */
 /* ---- NCI Notifications ---- */
 /* --------------------------- */
@@ -528,4 +533,6 @@ struct nci_nfcee_discover_ntf {
 	struct nci_nfcee_information_tlv	information_tlv;
 } __packed;
 
+#define NCI_OP_CORE_RESET_NTF		nci_opcode_pack(NCI_GID_CORE, 0x00)
+
 #endif /* __NCI_H */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web