Wait longer for reset notifications. The timeout failures
are treated as unrecoverable and cause the nfc service to
abort.
Change-Id: I5bdd1b5f48b433005897ce256329d32a542b1a50
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
There are 5 pins not connected on the hardware. Pull down these
pins to avoid leakage current from the nfc chip.
CRs-Fixed: 793068
Change-Id: Ie300f101315c403d2c16c54bdc3e3737aad6be12
Acked-by: Afroditi Ilioudi <ailioudi@qti.qualcomm.com>
Signed-off-by: Srinivas Ankem <ankems@codeaurora.org>
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
This patch adds error handling to each i2c access.
Furthermore, the timeout for the wake status
register of the nfcc is increased to cover corner cases.
CRs-Fixed: 765256
Change-Id: Ia8f99a89ec2e107dde4256f4afb24b461b50540a
Signed-off-by: Nakul Kadannavar <nakulk@codeaurora.org>
User space nfc service should know whether nci wake has been performed
successful or not
CRs-Fixed: 759587
Change-Id: Id8a3cd616ff9e635aa46a33199a7f9dfe8c646cb
Signed-off-by: Nakul Kadannavar <nakulk@codeaurora.org>
Wake up HOST only when NFCC wants to inform HOST for
transaction completion notification when HOST is suspended.
CRs-Fixed: 744954
Change-Id: Ib512a72eb0771ba062b57c45411972108e4a4664
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Nakul Kadannavar <nakulk@codeaurora.org>
After chip has cold booted wait maximum of 50ms to
receive core reset notification.
Implement kernel ioctl to read whether core reset
notification has recieved before timeout.
Cold boot implementation of NFCC had a bug,
GPIO disable needs to be held high for atleast
100ms before switching it to low for a clean cold
boot.
CRs-Fixed: 729456
Change-Id: I11a213d68ff1b44f433706e104bbaeac406bd5d6
Signed-off-by: Nakul Kadannavar <nakulk@codeaurora.org>
Implement kernel ioctl to read if NFCC is fused or not
for 64 bit architecture.
CRs-Fixed: 719576
Change-Id: I922f5a00821c87e31719856dfe6906fb59cc5b39
Signed-off-by: Nakul Kadannavar <nakulk@codeaurora.org>
Implement kernel ioctl to read if NFCC is fused or not.
CRs-Fixed: 692604
Change-Id: I588c3bcf0fc52e8b857fdeaa1f9f2a343efec744
Signed-off-by: Nakul Kadannavar <nakulk@codeaurora.org>
Need proper null checks to ensure good behavior.
Change-Id: I5df3b70f47bf9009be624f338774d3773e217106
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
When waking up the nfcc, block for completion. NFC user space driver
needs to properly track the sleep/wake state of the NFCC for stability.
Poll on the i2c bus untill the wakeup bit or a timeout occurs.
CRs-Fixed: 665191
Change-Id: I65d07eef5a966e7c13c23f2e68d9babb08e1ae8e
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
If configured, the pwrreq gpio will act as an input and vote for
power to be supplied to the uicc.
Change-Id: I084d14381da5816188a4313d9ff4df965f0c5a0e
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
It takes almost 15 msec for reset notification to be received from
NFCC and due to this NFC kernel device was waiting for 10uSec loop
which was causing bark due to excessive logging.
GPIO was also not needed to be controlled twice. Add some logging
for the NFC device for debugging.
Change-Id: I4335cbff61f16a2d93fccea8c7e39f0b430e0009
CRs-Fixed: 653737
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
probe function parses device tree at the begginning. device tree should not
be reparsed in the middle of the probe. use the first parse value.
Change-Id: I6695d76c9b05ec9ba2d8f73ee0815ab86078da31
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
I2C dma reads returned garbage on large reads for 64 bit systems. We
allocate coherent memory that persists for the life of the driver and
use it to buffer the dma access before coppying the data back out to
userspace.
Change-Id: I9369007f3ccc2904ef939b5e3d5934538bbd0b4d
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
We are removing the clk controll feature for msm based NFC-clock sources.
This feature used the gpio mux to controll the NFC clock. The gpiomux
api is not supported in the 3.10 kernel. Therefore we need to remove this
feature pending the need for a pincntrl solution.
Change-Id: I95dfa1ca4ad903830c632e105c1c93bd094b50a7
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
After setting NFCC into wake mode, we then read back
the status of the wake flag from the corresponding
register of nfcc.Only when the flag is read back as
0 then it confirms that nfcc is woken up.Then the
further read of the version register can be done.
Change-Id: I43eadf5940fd5bba99f11cc68743d6485f77aced
CRs-Fixed: 628122
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
Nfc driver should not toggle disable pin if nfc hardware isn't present.
Therefore the reboot notifier is only needed if probe is successful and
NFC chip could be enabled while the phone is shutting down.
Change-Id: I4a2e49f1ecb97b20b30845a3e0d9e8929dafbd99
Signed-off-by: Keith Fallows <keithf@codeaurora.org>
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
Need to reset the NFCC to guarantee that its i2c interface is up.
Change-Id: I4d07ecb0756a0d0afe0a65551f51a253a3c7b6b5
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
after nfcc wakeup introduce metal version read delay so that chip
returns right metal version.
Change-Id: Idfb00e7dcc75ffa56964438113f2498c6d48f690
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Satish Singh <ssing@codeaurora.org>
If NFC is not disabled from the UI, the user should be able to continue
making transactions. The NFC controller cannot process transactions with
the disable pin set high. The region 2 command configures the NFC
controller to opperate when the phone is off. Thus we don't disable the
NFC controller after issuing the region 2 command.
Change-Id: I610e1a6ee3b326d95c4794b01b38f2e21de85ba5
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
No current hardware uses this LDO pin. We were voting this LDO allways on.
Pin configurations should use an allways on LDO. New hardware requiring
LDO voting needs an LDO voting rework. Thus we remove the current unused
LDO code.
Change-Id: Icf2c911065b6900a3e6635678903d11e73792fb3
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
Introduce a check for the QCA1990 NFC controller hardware.
If I2C communication is unsuccessful we exit start-up sequence early
and ensure HPD is set(incase faulty hardware is present) and clock
is disabled.
Change-Id: Ic20f8cfa0219927eb4b30343b916d414757a3b37
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
The msm would crash because the clock was not setup right.
Change-Id: I234fff3743e36ce8b33731e0aeafb3c4e7377b43
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
Major rework for platforms where clock reference to qca199x is
sourced via MSM rather than PMIC. When the clock is sourced via the MSM
the CLK_REQ to the MSM does not control a clock enable pin (as in the
case of the PMIC), rather it is a standard MSM GPIO. In this instance, we
have implemented another interrupt handler which fires on both edges of
the CLK_REQ(from the qca199x). The control/mux of the CLK_REF is then
switched in the linked BH process. This has been tested on the 8x10 Hisense
qrd (MSM CLK_REF) and 8x26 MTP (PMIC CLK_REF) platforms. For other
platforms the configuration will be sourced from their respective device
tree files, however, there may still be some further aditional conditions
which need to be added to this driver.
Change-Id: I9aa62b9c2b07e7c6bbad7fdbc8e49e8c1b3babf8
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
Whenever an ioctl call is made to check the nfcc_version we now
wake-up the nfcc. Apparently the revision ID register (metal
revision no.) is updated only when the controller comes out of
sleep. Some recent changes in the DT meant that sometimes
the incorrect chip ID was being returned and so the patch was not
being applied.This is intended to fix this problem and removes
this detail from the caller method in the DT.
Change-Id: If2ed0e38a9d0803fa03e1b2110b9c0d090b74c0d
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
Hardware should start in a known good state.
Change-Id: I67da99c4f95d175b2af2efde74bdf526237e413b
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Enable GPCLK2 device tree entry in the nfc driver.
Change-Id: Ia4f88b670d691d0202f452b3228eacf333b4e812
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
nfcc will be off by default when power on by asserting disable
high and will be switched on when nfc user mode driver will be
on using power ioctl.
Change-Id: Ifcfc031a1fee226bbe8d3966f753ceeaacaca0f4
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
NFC driver to support multiple clock sources and to support patch
version ioctl to be used by the user mode driver.
Change-Id: Idd10fc1284ae1335a3a59179ad6e3e265c952d08
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Bansidhar Gopalachari <bansid@codeaurora.org>
once we do wakeup and if host sends an NCI command,
on nci response we do two i2c reads and on second read
the response packet is corrupted because wake up response
overwrites the buffer.
improve the hard reset of nfcc.
Change-Id: I8ac7b2e152ce9460e616a3e6d135246af8f00c02
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Bansidhar Gopalachari <bansid@codeaurora.org>
This mode is controlled by user mode driver using ioctl
to add Factory Test Mode (FTM) functionality for QCA199x
NFC controller.
This change also implements wake up sleep commands and
hard reset of NFCC.Currently only QCA199x NFCC version 2.0
support has been added.
Change-Id: Ied94996696cb9c1fdc1f559b4e583d989793ace3
CRs-Fixed: 506488
Signed-off-by: Bansidhar Gopalchari <bansid@codeaurora.org>
Add QCA1990 NCI based Near Field Communication chip device.
The NFCC is controlled by sending messages from
user space via this driver which in turn talks
to i2c driver. This driver uses read, write, poll
functions for transferring messages. It is
registered as a misc device and it also
initialises certain NFCC configuration registers.
Change-Id: I20d5e64a460918f00a3035d558e292da1881aa0a
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Madan Mohan Koyyalamudi <mkoyya@codeaurora.org>