46fe777164
Based on 1 normalized pattern(s): 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 33 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190531081038.745679586@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
54 lines
1.5 KiB
C
54 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
||
/*
|
||
* ---------------------------------------------------------------------------
|
||
* drivers/nfc/st95hf/spi.h functions declarations for SPI communication
|
||
* ---------------------------------------------------------------------------
|
||
* Copyright (C) 2015 STMicroelectronics – All Rights Reserved
|
||
*/
|
||
|
||
#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
|