1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * ---------------------------------------------------------------------------
4 * drivers/nfc/st95hf/spi.h functions declarations for SPI communication
5 * ---------------------------------------------------------------------------
6 * Copyright (C) 2015 STMicroelectronics – All Rights Reserved
9 #ifndef __LINUX_ST95HF_SPI_H
10 #define __LINUX_ST95HF_SPI_H
12 #include <linux/spi/spi.h>
14 /* Basic ST95HF SPI CMDs */
15 #define ST95HF_COMMAND_SEND 0x0
16 #define ST95HF_COMMAND_RESET 0x1
17 #define ST95HF_COMMAND_RECEIVE 0x2
19 #define ST95HF_RESET_CMD_LEN 0x1
22 * structure to contain st95hf spi communication specific information.
23 * @req_issync: true for synchronous calls.
24 * @spidev: st95hf spi device object.
25 * @done: completion structure to wait for st95hf response
26 * for synchronous calls.
27 * @spi_lock: mutex to allow only one spi transfer at a time.
29 struct st95hf_spi_context
{
31 struct spi_device
*spidev
;
32 struct completion done
;
33 struct mutex spi_lock
;
36 /* flag to differentiate synchronous & asynchronous spi request */
42 int st95hf_spi_send(struct st95hf_spi_context
*spicontext
,
43 unsigned char *buffertx
,
45 enum req_type reqtype
);
47 int st95hf_spi_recv_response(struct st95hf_spi_context
*spicontext
,
48 unsigned char *receivebuff
);
50 int st95hf_spi_recv_echo_res(struct st95hf_spi_context
*spicontext
,
51 unsigned char *receivebuff
);