NFC: digital: Add Inititor-side PSL support

In order to operate at the fasted bit rate
possible, add initiator-side support for
PSL REQ while in P2P mode.  The PSL REQ
will switch the RF technology to 424F
whenever possible.

Reviewed-by: Thierry Escande <thierry.escande@linux.intel.com>
Tested-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Add VIN voltage override support

The trf7970a driver uses the voltage from the
power/regulator subsystem to determine what the
voltage on the VIN pin is.  Normally, this is
the right thing to do but sometimes the board
that the trf7970a is on may change the voltage.
This is the case for the trf7970atb board from
Texas Instruments where it boosts the VIN voltage
from 3.3V to 5V (see http://www.ti.com/tool/trf7970atb).

To handle this, add support for the 'vin-voltage-override'
device tree property which overrides the voltage value
given by the regulator subsystem.  When the DT property
is not present, the value from the regulator subsystem
is used.

The value of 'vin-voltage-override' is in uVolts.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Document the 'vin-voltage-override' DTS property

The trf7970a driver recently had support for the
'vin-voltage-override' property added to it.  This
property is used to override the value given by
the regulator subsystem for the VIN pin's voltage.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Move IRQ Status Read quirk to device tree

The quirk indicating whether the trf7970a has
the "IRQ Status Read" erratum or not is currently
implemented using the 'driver_data' member of the
'spi_device_id' structure.  That requires the
driver to be modified to turn the quirk off when
a version of the trf7970a that doesn't have the
erratum is being used.  To fix that, create a
new device tree property called
'irq-status-read-quirk' that indicates that the
trf7970a being used has the erratum.

While at it, rename 'TRF7970A_QUIRK_IRQ_STATUS_READ_ERRATA'
to 'TRF7970A_QUIRK_IRQ_STATUS_READ' to make it
less of an eyesore.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Document the 'irq-status-read-quirk' DT property

The mechanism for specifying that the trf7970a
being used by the driver has the "IRQ Status Read"
erratum has been changed to a device tree property
('irq-status-read-quirk').

Document the new device tree property.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Add quirk to keep EN2 low

A bug has been discovered in the trf7970a where it
will generate an RF field even in passive target
mode when EN2 is asserted.  To work around this,
add support for the 'en2-rf-quirk' device tree
property which indicates that EN2 must remain low.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Document the 'en2-rf-quirk' DT property

Current versions of the trf7970a have an erratum where
the EN2 pin must be kept low.  If it isn't kept low,
it will generate an RF field even when in passive
target mode.  To work around this issue, create the
'en2-rf-quirk' device tree property to indicate that
the trf7970a that the driver is using has this erratum.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Make gpio labels more readable

Make the labels for the two gpio enable lines
more user friendly by prefixing them with the
driver name.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: NCI: Add support of ISO15693

Update nci.h to respect latest NCI specification proposal
(stop using proprietary opcodes). Handle ISO15693 parameters
in NCI_RF_ACTIVATED_NTF handler.

Signed-off-by: Vincent Cuissard <cuissard@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: NCI: Fix nci_register_device init sequence

All contexts have to be initiliazed before calling
nfc_register_device otherwise it is possible to call
nci_dev_up before ending the nci_register_device
function. In such case kernel will crash on non
initialized variables.

Signed-off-by: Vincent Cuissard <cuissard@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: NCI: Fix NCI RF FRAME interface usage

NCI RF FRAME interface is used for all kind of tags
except ISODEP ones. So for all other kind of tags the
status byte has to be removed.

Signed-off-by: Vincent Cuissard <cuissard@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Remove incorrect of_node_put() call

of_property_read_u32() does not take a reference
to the specified OF node so don't call of_node_put()
in trf7970a_get_autosuspend_delay().

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Remove trf7970a_tg_listen_mdaa()

Currently, the digital layer 'tg_listen_mdaa'
hook is not used and it isn't necessary to have
a stub routine so remove it.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Call spi_setup() to configure SPI communication

Call spi_setup() to configure SPI communication
with the trf7970a.  This will ensure that the
correct SPI parameters are used.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Use spi_sync() instead of spi_write_then_read()

To more efficiently handle long continuous reads,
use spi_sync() instead of spi_write_then_read().

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Ignore Overflow bit in FIFO Status Register

The Overflow bit in the 'FIFO Status Register' has
proven to be untrustworthy so ignore it.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: FIFO Size is really 127 bytes

Despite what the manual says, the FIFO size
on the trf7970a is really 127 bytes so make
the code respect that.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Remove unnecessary sleep

There is no need to sleep for 1-2 ms before
transmitting a new command.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Disable SYS_CLK Output

Currently, support for providing the external
SYS_CLK signal on pin 27 is not supported so
turn it off by writing to the 'Modulator and
SYS_CLK Control' register immediately after
reset.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
NFC: trf7970a: Initialize when enabling RF

Currently, the trf7970a is reset & initialized only
when the pm_runtime resume hook is called.  Instead,
initialize it every time the RF is enabled to ensure
that the trf7970a is quiesced and in a known state
before being set up for another RF technology.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>