NFC: Add snapshot of NQxxx NFC driver

Add the latest version of NQxxx NFC driver from 'msm-4.14
commit b66d738d0f19 ("NFC: Fix for nq-nci dev node recovery")'.

Change-Id: I32a86cb682a8f1a17de6be6ed9fbbf2ff7bcef47
Signed-off-by: Tapas Dey <tdey@codeaurora.org>
This commit is contained in:
Tapas Dey 2019-01-17 16:54:23 +05:30
parent ea7266aa54
commit 367bf9992c
8 changed files with 1523 additions and 0 deletions

View file

@ -59,3 +59,11 @@ source "drivers/nfc/nxp-nci/Kconfig"
source "drivers/nfc/s3fwrn5/Kconfig"
source "drivers/nfc/st95hf/Kconfig"
endmenu
config NFC_NQ
tristate "QTI NCI based NFC Controller Driver for NQx"
depends on I2C
help
This enables the NFC driver for NQx based devices.
This is for i2c connected version. NCI protocol logic
resides in the usermode and it has no other NFC dependencies.

View file

@ -17,3 +17,4 @@ obj-$(CONFIG_NFC_ST_NCI) += st-nci/
obj-$(CONFIG_NFC_NXP_NCI) += nxp-nci/
obj-$(CONFIG_NFC_S3FWRN5) += s3fwrn5/
obj-$(CONFIG_NFC_ST95HF) += st95hf/
obj-$(CONFIG_NFC_NQ) += nq-nci.o

1425
drivers/nfc/nq-nci.c Normal file

File diff suppressed because it is too large Load diff

47
drivers/nfc/nq-nci.h Normal file
View file

@ -0,0 +1,47 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
*/
#ifndef __NQ_NCI_H
#define __NQ_NCI_H
#include <linux/i2c.h>
#include <linux/types.h>
#include <linux/version.h>
#include <linux/semaphore.h>
#include <linux/completion.h>
#include <linux/ioctl.h>
#include <linux/cdev.h>
#include <linux/nfcinfo.h>
#define NFC_SET_PWR _IOW(0xE9, 0x01, unsigned int)
#define ESE_SET_PWR _IOW(0xE9, 0x02, unsigned int)
#define ESE_GET_PWR _IOR(0xE9, 0x03, unsigned int)
#define SET_RX_BLOCK _IOW(0xE9, 0x04, unsigned int)
#define SET_EMULATOR_TEST_POINT _IOW(0xE9, 0x05, unsigned int)
#define NFCC_INITIAL_CORE_RESET_NTF _IOW(0xE9, 0x10, unsigned int)
#define NFC_RX_BUFFER_CNT_START (0x0)
#define PAYLOAD_HEADER_LENGTH (0x3)
#define PAYLOAD_LENGTH_MAX (256)
#define BYTE (0x8)
#define NCI_IDENTIFIER (0x10)
enum nfcc_initial_core_reset_ntf {
TIMEDOUT_INITIAL_CORE_RESET_NTF = 0, /* 0*/
ARRIVED_INITIAL_CORE_RESET_NTF, /* 1 */
DEFAULT_INITIAL_CORE_RESET_NTF, /*2*/
};
enum nfcc_chip_variant {
NFCC_NQ_210 = 0x48, /**< NFCC NQ210 */
NFCC_NQ_220 = 0x58, /**< NFCC NQ220 */
NFCC_NQ_310 = 0x40, /**< NFCC NQ310 */
NFCC_NQ_330 = 0x51, /**< NFCC NQ330 */
NFCC_PN66T = 0x18, /**< NFCC PN66T */
NFCC_NOT_SUPPORTED = 0xFF /**< NFCC is not supported */
};
#endif

11
include/linux/nfcinfo.h Normal file
View file

@ -0,0 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
*/
#ifndef _NFCINFO_H
#define _NFCINFO_H
#include <uapi/linux/nfc/nfcinfo.h>
#endif

View file

@ -12,6 +12,8 @@ ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h),)
no-export-headers += kvm_para.h
endif
header-y += nfc/
ifneq ($(VSERVICES_SUPPORT), "")
include include/linux/Kbuild.vservices
endif

View file

@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note
#UAPI export list
header-y += nfcinfo.h

View file

@ -0,0 +1,26 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2018,2019, The Linux Foundation. All rights reserved.
*/
#ifndef _UAPI_NFCINFO_H_
#define _UAPI_NFCINFO_H_
#include <linux/ioctl.h>
#define NFCC_MAGIC 0xE9
#define NFCC_GET_INFO _IOW(NFCC_MAGIC, 0x09, unsigned int)
struct nqx_devinfo {
unsigned char chip_type;
unsigned char rom_version;
unsigned char fw_major;
unsigned char fw_minor;
};
union nqx_uinfo {
unsigned int i;
struct nqx_devinfo info;
};
#endif