summaryrefslogtreecommitdiffstats
path: root/drivers/nfc/trf7970a.c
AgeCommit message (Collapse)AuthorFilesLines
2014-04-22NFC: trf7970a: Add 'autosuspend-delay' DTS propertyMark A. Greer1-2/+17
The trf7970a driver currently uses a fixed autosuspend delay of 30 seconds. To enable users to customize the delay as they see fit, add support for the new 'autosuspend-delay' DTS property (part of the nfc node) which can override the default 30 seconds. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22NFC: trf7970a: Don't return value from trf7970a_switch_rf_on()Mark A. Greer1-13/+6
trf7970a_switch_rf_on() no longer returns anything other than 0 so make it void and clean up the code that checks for errors when its called. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22NFC: trf7970a: Add pm_runtime supportMark A. Greer1-37/+85
Add pm_runtime support by moving the code that enables the trf7970a to the pm_runtime hook routines. The pm_runtime 'autosuspend' feature is used so that the device isn't disabled until at least 30 seconds have passed since trf7970a_switch_rf_off() was last called. The result is that when trf7970a_switch_rf_on() is called, the device will be enabled and initialized (if it isn't already). When trf7970a_switch_rf_off() is called, it will turn off the RF immediately but leave the device enabled for at least 30 seconds. If 30 seconds have passed and the pm_runtime facility decides to suspend the driver, the device will be disabled then. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22NFC: trf7970a: Turn RF on after hardware is configuredMark A. Greer1-5/+16
The NFC digital layer calls the 'switch_rf' hook to turn the RF on before it configures the RF technology and framing. There is potential to confuse a tag doing it this way so don't enable the RF until the RF technology and initial framing have been configured. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22NFC: trf7970a: Set correct Vin voltage in Chip Status Control registerMark A. Greer1-3/+8
Currently, the trf7970a driver assumes that the Vin voltage is 5V when it writes to the 'Chip Status Control' register. That may not be correct so use the regulator facility to get the Vin voltage and set the VRS5_3 bit correctly when writing to that register. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22NFC: trf7970a: Allow different Modulator and SYS_CLK Control register valuesMark A. Greer1-1/+4
Currently the driver writes the same value to the 'Modulator and SYS_CLK Control' register no matter what RF technology is being used. That works for now but new RF technologies (e.g., ISO/IEC 14443-B) will require different values to be written to that register. To support this, add a member to the trf7970a structure which is set by the RF technology handling code and used by the framing code when it writes to that register. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22NFC: trf7970a: Set 'Modulator and SYS_CLK Control' after 'ISO Control'Mark A. Greer1-5/+5
Writing to the 'ISO Control' register may cause the contents of the 'Modulator and SYS_CLK Control' register to change so be sure to write to 'Modulator and SYS_CLK Control' after writing to 'ISO Control'. Note that writing to the 'Modulator and SYS_CLK Control' register shouldn't be necessary at all according to the trf790a manual but testing shows that it is necessary. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22NFC: trf7970a: Only write 'ISO Control' when its changingMark A. Greer1-6/+19
The current code always writes to the 'ISO Control' register when the RF framing is set. That's not necessary since the register's value doesn't always change. Instead, only write to it when its value is actually being changed. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22NFC: trf7970a: Reset FIFO when 'End of TX' Interrupt OccursMark A. Greer1-1/+3
Sometimes after sending a frame there is tx data leftover in the FIFO which the driver will think is part of the receive frame. That data can be cleared when an 'End of TX' interrupt is received by issuing the 'FIFO Reset' command. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22NFC: trf7970a: Clear 'NFC Target Detection Level' registerMark A. Greer1-0/+5
Due to a trf7970a erratum, the 'NFC Target Detection Level' register (0x18) must be cleared after power-up. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22NFC: trf7970a: Only abort a command if one is activeMark A. Greer1-1/+12
Only initiate the abort command process when there is an active command. If the abort process were started and there wasn't an active command then the next command issued by the digital layer would be incorrectly aborted. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22NFC: trf7970a: Increase TRF7970A_WAIT_FOR_RX_DATA_TIMEOUT to 20 msMark A. Greer1-5/+5
After further testing periods of ~16 ms have been observed between interrupts indicating that there is receive data in the FIFO. To accomodate that, increase the time the driver waits before deciding there is no more data to receive to 20 ms. The macro that represents that delay is 'TRF7970A_WAIT_FOR_RX_DATA_TIMEOUT'. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-03-11NFC: trf7970a: Add ISO/IEC 15693 and Type 5 tag SupportMark A. Greer1-4/+148
Add support for ISO/IEC 15693 RF technology and Type 5 tags. Note that Type 5 tags used to be referred to as Type V tags. CC: Erick Macias <emacias@ti.com> CC: Felipe Balbi <balbi@ti.com> Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-03-11NFC: trf7970a: Add support for Type 4A TagsMark A. Greer1-1/+3
Add support for Type 4A Tags which includes supporting the underlying ISO/IEC 14443-A protocol. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-03-11NFC: trf7970a: Add driver with ISO/IEC 14443 Type 2 Tag SupportMark A. Greer1-0/+1224
Add a driver for the Texas Instruments TRF7970a RFID/NFC/15693 transceiver. The driver currently supports ISO/IEC 14443 Type 2 tags only (MIFARE Ultralight and Ultralight C but not Classic). CC: Erick Macias <emacias@ti.com> CC: Felipe Balbi <balbi@ti.com> Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>