Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9f8e594 authored by Gaurav Singhal's avatar Gaurav Singhal Committed by Jeevan Shriram
Browse files

NFC: Add snapshot of NQxxx NFC driver



Add the latest version of NQxxx NFC driver
from msm-3.18.

This change is a combination of following changes:

1) NFC: add NQxxxx driver

commit <356203701b7fd61b2d9776fac4fac6427735248b>

2) NFC: change reset and read flow

commit <7620346454865b81d7086167d531aea7bb716926>

3) NFC: Enable DMA and CLK_REQ gpio config issue fix

commit <150dbf117709b5677f86e5ced86b468731019b8b>

4) NFC: Fix function descriptions

commit <c0248d70200c8e09a983758750632b7a75e422d3>

5) nq-nci: enable NFCC hardware check and clock to NQxx

commit <2a92c1d6135f2d1e8fe3f2afcd290a2b1311a5a2>

6) nq-nci: XO shut down issue fix

commit <8938151d4650fca6d42efdbce138aea9bad7eca0>

7) NFC: Remove sleep from irq handler

commit <8ea2c805108cbf59b8e2abf87ee207fbf08fad97>

8) NFC: Remove DMA allocation and stack use in write

commit <c1552090e4c46e1eeca756d0a7b4427f94eab0c3>

CRs-Fixed: 890678, 892310, 955860, 968399, 993292
Change-Id: Ibb861ebdc63d45699369e23c077589d37e024b5e
Signed-off-by: default avatarGaurav Singhal <gsinghal@codeaurora.org>
parent ef13a525
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
Qualcomm Technologies, Inc NQxxxx NFC NCI device

Near Field Communication (NFC) device is based on NFC Controller Interface (NCI)

Required properties:

- compatible: "qcom,nq-nci"
- reg: NCI i2c slave address.
- qcom,nq-ven: specific gpio for hardware reset.
- qcom,nq-irq: specific gpio for read interrupt.
- interrupt-parent: Should be phandle for the interrupt controller
                    that services interrupts for this device.
- interrupts: Nfc read interrupt,gpio-clk-req interrupt


Recommended properties:

- interrupt-names: names of interrupts, should include "nfc_irq", used for reference


Optional properties:

- pinctrl-names, pinctrl-0, pincntrl-1: references to our pincntrl settings
- clocks, clock-names: must contain the NQxxxx's core clock.

Example:

	nq-nci@2b {
		compatible = "qcom,nq-nci";
		reg = <0x2b>;
		qcom,irq-gpio = <&tlmm 29 0x00>;
		qcom,en-gpio = <&tlmm 30 0x00>;
		qcom,clk-src = "BBCLK2";
		interrupt-parent = <&tlmm>;
		interrupts = <29 0>;
		interrupt-names = "nfc_irq";
		pinctrl-names = "nfc_active","nfc_suspend";
		pinctrl-0 = <&nfc_int_active &nfc_disable_active>;
		pinctrl-1 = <&nfc_int_suspend &nfc_disable_suspend>;
		qcom,clk-gpio = <&pm8916_gpios 2 0>;
		clocks = <&clock_rpm clk_bb_clk2_pin>;
		clock-names = "ref_clk";
	};
+8 −0
Original line number Diff line number Diff line
@@ -77,3 +77,11 @@ source "drivers/nfc/st-nci/Kconfig"
source "drivers/nfc/nxp-nci/Kconfig"
source "drivers/nfc/s3fwrn5/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.
+1 −0
Original line number Diff line number Diff line
@@ -16,3 +16,4 @@ obj-$(CONFIG_NFC_ST21NFCA) += st21nfca/
obj-$(CONFIG_NFC_ST_NCI)	+= st-nci/
obj-$(CONFIG_NFC_NXP_NCI)	+= nxp-nci/
obj-$(CONFIG_NFC_S3FWRN5)	+= s3fwrn5/
obj-$(CONFIG_NFC_NQ)		+= nq-nci.o

drivers/nfc/nq-nci.c

0 → 100644
+861 −0

File added.

Preview size limit exceeded, changes collapsed.

drivers/nfc/nq-nci.h

0 → 100644
+44 −0
Original line number Diff line number Diff line
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only 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.
 */

#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/miscdevice.h>

#define NFC_SET_PWR			_IOW(0xE9, 0x01, unsigned int)
#define NFC_CLK_REQ			_IOW(0xE9, 0x02, 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*/
};

#endif