aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorFrederic Danis <frederic.danis@linux.intel.com>2013-05-29 09:35:02 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-14 07:44:03 -0400
commit8a00a61b0ef2bfd1b468dd20c0d0b1a94a8f7475 (patch)
tree04438ab0d31ae79e0970cc7f901dd5605a5f4ec1 /include/net
parenta395298c9c96748cbd6acee4cb9a5ba13fbb3ab8 (diff)
NFC: Add basic NCI over SPI
The NFC Forum defines a transport interface based on Serial Peripheral Interface (SPI) for the NFC Controller Interface (NCI). This module implements the SPI transport of NCI, calling SPI module directly to read/write data to NFC controller (NFCC). NFCC driver should provide functions performing device open and close. It should also provide functions asserting/de-asserting interruption to prevent TX/RX race conditions. NFCC driver can also fix a delay between transactions if needed by the hardware. Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/nfc/nci_core.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 1009d3dcb316..3b05bebd8235 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -3,6 +3,7 @@
3 * NFC Controller (NFCC) and a Device Host (DH). 3 * NFC Controller (NFCC) and a Device Host (DH).
4 * 4 *
5 * Copyright (C) 2011 Texas Instruments, Inc. 5 * Copyright (C) 2011 Texas Instruments, Inc.
6 * Copyright (C) 2013 Intel Corporation. All rights reserved.
6 * 7 *
7 * Written by Ilan Elias <ilane@ti.com> 8 * Written by Ilan Elias <ilane@ti.com>
8 * 9 *
@@ -202,4 +203,52 @@ void nci_req_complete(struct nci_dev *ndev, int result);
202/* ----- NCI status code ----- */ 203/* ----- NCI status code ----- */
203int nci_to_errno(__u8 code); 204int nci_to_errno(__u8 code);
204 205
206/* ----- NCI over SPI acknowledge modes ----- */
207#define NCI_SPI_CRC_DISABLED 0x00
208#define NCI_SPI_CRC_ENABLED 0x01
209
210/* ----- NCI SPI structures ----- */
211struct nci_spi_dev;
212
213struct nci_spi_ops {
214 int (*open)(struct nci_spi_dev *ndev);
215 int (*close)(struct nci_spi_dev *ndev);
216 void (*assert_int)(struct nci_spi_dev *ndev);
217 void (*deassert_int)(struct nci_spi_dev *ndev);
218};
219
220struct nci_spi_dev {
221 struct nci_dev *nci_dev;
222 struct spi_device *spi;
223 struct nci_spi_ops *ops;
224
225 unsigned int xfer_udelay; /* microseconds delay between
226 transactions */
227 u8 acknowledge_mode;
228
229 void *driver_data;
230};
231
232/* ----- NCI SPI Devices ----- */
233struct nci_spi_dev *nci_spi_allocate_device(struct spi_device *spi,
234 struct nci_spi_ops *ops,
235 u32 supported_protocols,
236 u32 supported_se,
237 u8 acknowledge_mode,
238 unsigned int delay);
239void nci_spi_free_device(struct nci_spi_dev *ndev);
240int nci_spi_register_device(struct nci_spi_dev *ndev);
241void nci_spi_unregister_device(struct nci_spi_dev *ndev);
242
243static inline void nci_spi_set_drvdata(struct nci_spi_dev *ndev,
244 void *data)
245{
246 ndev->driver_data = data;
247}
248
249static inline void *nci_spi_get_drvdata(struct nci_spi_dev *ndev)
250{
251 return ndev->driver_data;
252}
253
205#endif /* __NCI_CORE_H */ 254#endif /* __NCI_CORE_H */