Commit Graph

40 Commits

Author SHA1 Message Date
Houston Hoffman 1a49269bf6 NFC: increase reset notification timeout
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>
2015-03-09 16:26:14 -07:00
Srinivas Ankem f53392f613 NFC: Set pull down registors during initialization
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>
2015-02-23 08:40:48 -08:00
Nakul Kadannavar 4109498341 NFC: Add error handling to i2c access
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>
2014-12-02 16:33:05 +00:00
Nakul Kadannavar 161ad7ac72 NFC: Return status of nci wake to userspace
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>
2014-11-20 17:35:23 +00:00
Nakul Kadannavar 551b981cb8 NFC: Wake up HOST from NFCC read interrupt
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>
2014-10-24 15:06:18 +01:00
Nakul Kadannavar e66e8265cf NFC: Read core reset notification
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>
2014-09-24 21:22:51 +01:00
Nakul Kadannavar b4ec378007 NFC: Read NFCC is fused or unfused for 64 bit arch
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>
2014-09-05 12:10:27 +01:00
Nakul Kadannavar e9593670b1 NFC: Read NFCC is fused or unfused
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>
2014-08-20 11:10:24 +01:00
Houston Hoffman 7af3030d53 NFC: fix null checks before dma_pool_free
Need proper null checks to ensure good behavior.

Change-Id: I5df3b70f47bf9009be624f338774d3773e217106
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
2014-07-29 12:14:15 -07:00
Houston Hoffman 1325a61798 NFC: detect NFC wakeup complete
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>
2014-06-23 18:40:50 +05:30
Linux Build Service Account 3e6594ef3a Merge "NFC: NFC reset wait causes bark due to excessive logging" 2014-06-05 08:36:06 -07:00
Houston Hoffman fa5683e251 NFC: add support for pwrreq input device tree entry
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>
2014-05-31 21:03:22 -07:00
Houston Hoffman 50a8bbc0c2 NFC: NFC reset wait causes bark due to excessive logging
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>
2014-05-30 14:20:40 -07:00
Linux Build Service Account 276f55b936 Merge "NFC: don't reparse device tree" 2014-05-07 05:34:56 -07:00
Houston Hoffman cbd668d752 NFC: don't reparse device tree
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>
2014-04-29 09:02:34 -07:00
Houston Hoffman c77ab4f8fb NFC: qca199x: Enable 64/32 compat mode
QCA NFC device driver needs to work in compatibility mode.

Change-Id: Ie27b907ac9b373defecf1cebbafa00c0c9b3b421
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
2014-04-15 12:43:13 -07:00
Houston Hoffman 2163ddd672 NFC: qca199x: use coherent memory for i2c read
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>
2014-04-14 18:26:19 -07:00
Houston Hoffman 2f4a89d1ea NFC: remove clk controll support for msm based nfc clocks
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>
2014-04-10 18:24:48 -07:00
Houston Hoffman e0b3a05af8 NFC: NFCC wake up check by register read.
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>
2014-03-22 05:57:12 -07:00
keith fallows 434b7d76dd nfc: Check hardware before registering the reboot notifer
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>
2014-03-21 01:54:14 -07:00
Houston Hoffman f5bd788a99 NFC: add hw reset before testing hw presence.
Need to reset the NFCC to guarantee that its i2c interface is up.

Change-Id: I4d07ecb0756a0d0afe0a65551f51a253a3c7b6b5
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
2014-03-14 12:19:45 -07:00
Linux Build Service Account 9369a97a31 Merge "NFC: metal version delay" 2014-03-05 03:48:10 -08:00
Satish Kumar Singh eed97a7349 NFC: Remove Hardcoded 2.0 version check
Remove Hardcoded 2.0 version check

Change-Id: I571f063ba36a45d4bf65cff886808abe956d4626
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Satish Singh <ssing@codeaurora.org>
2014-03-04 14:54:31 -08:00
Linux Build Service Account c78973bdd8 Merge "NFC: Remove unused LDO request code" 2014-02-22 14:49:46 -08:00
Satish Kumar Singh fff2b357a7 NFC: metal version delay
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>
2014-02-21 13:11:41 -08:00
Houston Hoffman 2f069fedb3 NFC: if region2 set don't disable NFC on phone shutdown
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>
2014-02-13 16:24:47 -08:00
Houston Hoffman 1a0b82a775 NFC: Remove unused LDO request code
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>
2014-02-08 14:20:06 -08:00
Houston Hoffman f822fe3b37 NFC: Introduce a presence check
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>
2014-01-29 23:08:48 -08:00
Houston Hoffman 3287d65c0a NFC: Set PLL before attempting to prepare clk src
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>
2014-01-28 13:45:59 -08:00
Houston Hoffman 294db64b5f NFC: add gpio clk interrupt for 8610 qrd device
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>
2014-01-24 03:22:54 -08:00
Linux Build Service Account 9d0a07c964 Merge "NFC: Fix for wrong chip version." 2014-01-23 03:22:04 -08:00
Houston Hoffman 547dd1d142 NFC: Fix for wrong chip version.
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>
2014-01-22 09:54:32 -08:00
Houston Hoffman 6c920b58ab NFC: Start nfc-nci driver in hard power down state
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>
2014-01-17 15:02:42 -08:00
Houston Hoffman 2b416e135d NFC: Implement GP clock for 8610 qrd V2 skuaa devices
Enable GPCLK2 device tree entry in the nfc driver.

Change-Id: Ia4f88b670d691d0202f452b3228eacf333b4e812
Signed-off-by: Houston Hoffman <hhoffman@codeaurora.org>
2014-01-17 15:02:27 -08:00
Houston Hoffman 7d66e8c312 NFC: Implement disable and clock enable using ioctl
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>
2013-12-11 19:34:34 -08:00
Bansidhar Gopalachari 176c999508 NFC: Implement LDO control for 8610 qrd skuaa devices
control voltage regulators LD0 14 for 8610 qrd skuaa device from
nfc-nci device.

Change-Id: I65118b64b3330f033312de1889e7df4f6ad4fd27
Acked-by: Umesh Jagga <ujagga@qti.qualcomm.com>
Signed-off-by: Bansidhar Gopalachari <bansid@codeaurora.org>
2013-10-24 12:56:08 -07:00
Bansidhar Gopalachari f95a78fed8 NFC: Implement multiple NFC clock source and patch version
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>
2013-09-25 11:07:44 -07:00
Bansidhar Gopalachari 52824d4c52 NFC: avoid receive packet corruption on wake up
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>
2013-09-04 17:15:33 -07:00
Bansidhar Gopalachari 5d7b289850 NFC: Add support for ftm mode
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>
2013-09-04 17:12:16 -07:00
Madan Mohan Koyyalamudi 010cf2969b NFC: Add QCA199x NFC NCI device
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>
2013-09-04 17:04:00 -07:00