aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Lapuyade2013-09-05 11:02:21 +0200
committerSamuel Ortiz2013-09-25 01:35:41 +0200
commitfa544fff62aeeb0cf8008c61077aae10fb1407a9 (patch)
tree42e24efbcaca24ad48bde91259696649388483d3 /include
parent08f13acff960d6c95a371f67ab98785aa9969179 (diff)
NFC: NCI: Simplify NCI SPI to become a simple framing/checking layer
NCI SPI layer should not manage the nci dev, this is the job of the nci chipset driver. This layer should be limited to frame/deframe nci packets, and optionnaly check integrity (crc) and manage the ack/nak protocol. The NCI SPI must not be mixed up with an NCI dev. spi_[dev|device] are therefore renamed to a simple spi for more clarity. The header and crc sizes are moved to nci.h so that drivers can use them to reserve space in outgoing skbs. nci_spi_send() is exported to be accessible by drivers. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/net/nfc/nci.h4
-rw-r--r--include/net/nfc/nci_core.h41
2 files changed, 15 insertions, 30 deletions
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 88785e5c6b2c..e5aa5acafea0 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -166,6 +166,10 @@
#define NCI_GID_NFCEE_MGMT 0x2
#define NCI_GID_PROPRIETARY 0xf
+/* ----- NCI over SPI head/crc(tail) room needed for outgoing frames ----- */
+#define NCI_SPI_HDR_LEN 4
+#define NCI_SPI_CRC_LEN 2
+
/* ---- NCI Packet structures ---- */
#define NCI_CTRL_HDR_SIZE 3
#define NCI_DATA_HDR_SIZE 3
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index c08399621c8b..37ba06f2dfa9 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -207,16 +207,14 @@ int nci_to_errno(__u8 code);
#define NCI_SPI_CRC_ENABLED 0x01
/* ----- NCI SPI structures ----- */
-struct nci_spi_dev;
+struct nci_spi;
struct nci_spi_ops {
- int (*open)(struct nci_spi_dev *nsdev);
- int (*close)(struct nci_spi_dev *nsdev);
- void (*assert_int)(struct nci_spi_dev *nsdev);
- void (*deassert_int)(struct nci_spi_dev *nsdev);
+ void (*assert_int)(struct nci_spi *nspi);
+ void (*deassert_int)(struct nci_spi *nspi);
};
-struct nci_spi_dev {
+struct nci_spi {
struct nci_dev *ndev;
struct spi_device *spi;
struct nci_spi_ops *ops;
@@ -227,31 +225,14 @@ struct nci_spi_dev {
struct completion req_completion;
u8 req_result;
-
- void *driver_data;
};
-/* ----- NCI SPI Devices ----- */
-struct nci_spi_dev *nci_spi_allocate_device(struct spi_device *spi,
- struct nci_spi_ops *ops,
- u32 supported_protocols,
- u32 supported_se,
- u8 acknowledge_mode,
- unsigned int delay);
-void nci_spi_free_device(struct nci_spi_dev *nsdev);
-int nci_spi_register_device(struct nci_spi_dev *nsdev);
-void nci_spi_unregister_device(struct nci_spi_dev *nsdev);
-int nci_spi_recv_frame(struct nci_spi_dev *nsdev);
-
-static inline void nci_spi_set_drvdata(struct nci_spi_dev *nsdev,
- void *data)
-{
- nsdev->driver_data = data;
-}
-
-static inline void *nci_spi_get_drvdata(struct nci_spi_dev *nsdev)
-{
- return nsdev->driver_data;
-}
+/* ----- NCI SPI ----- */
+struct nci_spi *nci_spi_allocate_spi(struct spi_device *spi,
+ struct nci_spi_ops *ops,
+ u8 acknowledge_mode, unsigned int delay,
+ struct nci_dev *ndev);
+int nci_spi_send(struct nci_spi *nspi, struct sk_buff *skb);
+int nci_spi_recv_frame(struct nci_spi *nspi);
#endif /* __NCI_CORE_H */