summaryrefslogtreecommitdiffstats
path: root/drivers/nfc/st95hf/spi.h
diff options
context:
space:
mode:
authorShikha Singh <shikha.singh@st.com>2015-12-22 00:03:30 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2015-12-29 19:06:11 +0100
commitcab47333f0f75b685bce1facecb73bf3632e1360 (patch)
treeaaffcee69aa4d286a3a9c125a716ab59ffe072a5 /drivers/nfc/st95hf/spi.h
parentce2e56cdfbb010e22073d303161e74c144ebe731 (diff)
downloadop-kernel-dev-cab47333f0f75b685bce1facecb73bf3632e1360.zip
op-kernel-dev-cab47333f0f75b685bce1facecb73bf3632e1360.tar.gz
NFC: Add STMicroelectronics ST95HF driver
This driver supports STMicroelectronics NFC Transceiver "ST95HF", in in initiator role to read/write ISO14443 Type 4A, ISO14443 Type 4B and ISO15693 Type5 tags. The ST95HF datasheet is available here: http://www.st.com/web/en/resource/technical/document/datasheet/DM00102056.pdf Signed-off-by: Shikha Singh <shikha.singh@st.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/st95hf/spi.h')
-rw-r--r--drivers/nfc/st95hf/spi.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/drivers/nfc/st95hf/spi.h b/drivers/nfc/st95hf/spi.h
new file mode 100644
index 0000000..552d220
--- /dev/null
+++ b/drivers/nfc/st95hf/spi.h
@@ -0,0 +1,64 @@
+/*
+ * ---------------------------------------------------------------------------
+ * drivers/nfc/st95hf/spi.h functions declarations for SPI communication
+ * ---------------------------------------------------------------------------
+ * Copyright (C) 2015 STMicroelectronics – All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __LINUX_ST95HF_SPI_H
+#define __LINUX_ST95HF_SPI_H
+
+#include <linux/spi/spi.h>
+
+/* Basic ST95HF SPI CMDs */
+#define ST95HF_COMMAND_SEND 0x0
+#define ST95HF_COMMAND_RESET 0x1
+#define ST95HF_COMMAND_RECEIVE 0x2
+
+#define ST95HF_RESET_CMD_LEN 0x1
+
+/*
+ * structure to contain st95hf spi communication specific information.
+ * @req_issync: true for synchronous calls.
+ * @spidev: st95hf spi device object.
+ * @done: completion structure to wait for st95hf response
+ * for synchronous calls.
+ * @spi_lock: mutex to allow only one spi transfer at a time.
+ */
+struct st95hf_spi_context {
+ bool req_issync;
+ struct spi_device *spidev;
+ struct completion done;
+ struct mutex spi_lock;
+};
+
+/* flag to differentiate synchronous & asynchronous spi request */
+enum req_type {
+ SYNC,
+ ASYNC,
+};
+
+int st95hf_spi_send(struct st95hf_spi_context *spicontext,
+ unsigned char *buffertx,
+ int datalen,
+ enum req_type reqtype);
+
+int st95hf_spi_recv_response(struct st95hf_spi_context *spicontext,
+ unsigned char *receivebuff);
+
+int st95hf_spi_recv_echo_res(struct st95hf_spi_context *spicontext,
+ unsigned char *receivebuff);
+
+#endif
OpenPOWER on IntegriCloud