Commit Graph

279 Commits

Author SHA1 Message Date
Mark A. Greer 7a1e5552af NFC: trf7970a: Prefix TX data when refilling FIFO
When refilling the FIFO with more TX data (using a new
SPI transaction), the driver must prefix the TX data with
a write to the FIFO I/O Register.  This tells the trf7970a
that the following data is destined for the FIFO so it can
be transmitted.

To accomplish this, the driver cannot simply push the
prefix data just before the next set of TX data that
is to be transmitted because that will overwrite part
of the TX data provided by the digital layer.  Instead,
separate the prefix data and the TX data when calling
trf7970a_transmit().  trf7970a_transmit() can then send
the prefix and TX data from different memory locations
with one spi_sync() operation.  This also means that
the driver doesn't require any skb "tx_headroom" as
provided by the digital layer (see
nfc_digital_allocate_device() and digital_skb_alloc()).

Also ensure that the prefix is of type 'u8' and not
'char'.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-09-07 23:13:43 +02:00
Mark A. Greer 5974150dea NFC: trf7970a: Remove unnecessary FIFO reset & RSSI read
It is no longer necessary to reset the FIFO and
read the 'RSSI Levels and Oscillator Status Register'
so remove that code.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-09-07 23:13:43 +02:00
Mark A. Greer aff0564aa7 NFC: trf7970a: Clear possible spurious interrupt before transmitting
The trf7970a occasionally generates spurious interrupts
which can confuse the driver.  To help alleviate this,
clear any interrupts by reading the 'IRQ Status Register'
before starting a new transaction.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-09-07 23:13:43 +02:00
Mark A. Greer 38b4eb1f7f NFC: trf7970a: Recalculate driver timeout values
Some of the timeout values used in the driver
are not long enough to handle worst-case scenarios
so they need to be recalculated.

The time to wait for the FIFO to drain past the
low-watermark is now 20 ms because it can take
around 14.35 ms to send 95 bytes (127 bytes in
full FIFO minus 32 bytes where the low-watermark
interrupt will fire).  95 bytes will take around
14.35 ms at 6.62 kbps (the lowest supported bit
rate used by ISO/IEC 15693) so 20 ms should be a
safe value.

The time to wait before issuing an EOF to complete
an ISO/IEC 15693 write or lock command is 40 ms--
20 ms to drain the FIFO and another 20 ms to ensure
the wait is long enough before sending an EOF.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-09-07 23:13:43 +02:00
Mark A. Greer 4e64eff837 NFC: trf7970a: Add RF technology specific guard times
When turning on the RF field, the driver must wait
an RF-technology-specific amount of time (known as
the guard time) before modulating the field.
Currently, the driver waits 5 ms but that is too
short for NFCF and too long for ISO/IEC 15693.
Fix this by determining the guard time when the
RF technology is set and delaying that amount
of time when turning on the RF field.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-09-07 23:13:43 +02:00
Mark A. Greer a08e54549e 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>
2014-09-07 23:13:43 +02:00
Mark A. Greer 6c08df422e 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>
2014-09-07 23:13:43 +02:00
Mark A. Greer 17b2151733 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>
2014-09-07 23:13:43 +02:00
Mark A. Greer 1568bfef18 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>
2014-09-07 23:13:42 +02:00
Mark A. Greer 4542e8345a 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>
2014-09-07 23:13:42 +02:00
Mark A. Greer 3e7f335689 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>
2014-09-07 23:13:42 +02:00
Mark A. Greer 24707296c7 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>
2014-09-07 23:13:42 +02:00
Mark A. Greer cc8d715864 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>
2014-09-07 23:13:42 +02:00
Mark A. Greer d3a6d33a7f 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>
2014-09-07 23:13:42 +02:00
Mark A. Greer f23b73526b 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>
2014-09-01 00:06:56 +02:00
Mark A. Greer 95064bd95a 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>
2014-09-01 00:06:55 +02:00
Mark A. Greer 772079eb77 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>
2014-09-01 00:06:55 +02:00
Mark A. Greer 3bd14233aa 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>
2014-09-01 00:06:55 +02:00
Christophe Ricard 1892bf844e NFC: st21nfca: Adding P2P support to st21nfca in Initiator & Target mode
Support for Initiator and Target mode with ISO18092 commands support:
- ATR_REQ/ATR_RES
- PSL_REQ/PSL_RES
- DEP_REQ/DEP_RES

Work based on net/nfc/digital_dep.c.
st21nfca is using:
- Gate reader F for P2P in initiator mode.
- Gate card F for P2P in target mode.

Felica tag and p2p are differentiated with NFCID2.
When starting with 01FE it is acting in p2p mode.

On complete_target_discovered on ST21NFCA_RF_READER_F_GATE
supported_protocols is set to NFC_PROTO_NFC_DEP_MASK
for P2P.

Tested against: Nexus S, Galaxy S2, Galaxy S3, Galaxy S3 Mini,
Nexus 4 & Nexus 5.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-07-23 01:14:41 +02:00
Christophe Ricard d57d74eb76 NFC: st21nfca: Implement stop_poll HCI hook
Send DM_DISCONNECT command to disconnect Terminal Host from the HCI network.

- The persistent states of the terminal host pipes, including registry values,
are not modifies. Therefore, there is no NVRAM update to disconnect the
terminal host.
- The terminal host RF card gates are disabled which means that there will be no event
related to card RF gates until communication has been restored.
- The terminal host RF reader request is reset so the RF reader polling for terminal
host is disabled.

To restore the communication, the terminal host can send any HCI command or event.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-07-23 01:04:31 +02:00
Christophe Ricard 0531107e1c NFC: st21nfca: Improve read length sequence for P2P mode.
A DEP_RES with a SUPERVISOR PDU can be up to 16 bytes long.

In order to avoid useless read during p2p, extend first read
sequence to 16 and reduce third sequence to 12 to keep same
total on the full sequence.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-07-23 01:04:31 +02:00
Christophe Ricard 8e9466ccda NFC: st21nfca: Improved start of frame detection
A start of frame is 7E 00 not only 7E. Make sure the first read sequence is
starting with 7E 00.
For example: 7E FF FF FF FF is as a correct crc but it is a bad frame.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-07-23 01:04:31 +02:00
Christophe Ricard cf577344e2 NFC: st21nfca: Free buffer in case no data are retrieved.
In case no data are retrieve through i2c or one specific case is not handled.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-07-23 01:04:30 +02:00
Christophe Ricard fb92ff78f8 NFC: st21nfcb: few code clean up
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-07-23 00:49:37 +02:00
Christophe Ricard 35630df68d NFC: st21nfcb: Add driver for STMicroelectronics ST21NFCB NFC chip
Add driver for STMicroelectronics ST21NFCB NFC controller.
ST21NFCB is using NCI protocol and a proprietary low level transport
protocol called NDLC used on top.

NDLC:
The protocol defines 2 types of frame:
- One type carrying NCI data (referred as DATAFRAME frames).
- One type carrying protocol information used for flow control and error
control mechanisms (referred as SUPERVISOR frames).

After each frame transmission to the NFC controller, the device host
SHALL waitfor  an ACK (SUPERVISOR frame) reception before sending a
new frame.
The NFC controller MAY send a frame at anytime to the device host.
The NFC controller MAY send a specific WAIT supervisor frame to indicate
to device host that a NCI data packet has been received but that it could
take significant time before the NFC controller sends an ACK and thus
allows next data reception.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-07-23 00:49:28 +02:00
Mark A. Greer 6857bb9627 NFC: trf7970a: Add support for Felica Type 3 tags
Add support for the Felica protocol and Type 3 tags.
Both 212 and 424 kbps are supported.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-05-26 01:28:28 +02:00
Thierry Escande 09592ccfc2 NFC: port100: Add support for type 4B tag
This patch adds support for ISO-DEP protocol over NFC-B rf technology
by adding NFC_PROTO_ISO14443_B to the supported protocols and an entry
for framing configuration.

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-05-26 00:42:02 +02:00
Christophe Ricard 7974728094 NFC: st21nfca: Add ISO15693 Reader/Writer support
Add support for ISO/IEC 15693 RF technology and Type 5 tags.
ISO15963 is using proprietary gate 12.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-05-20 00:48:28 +02:00
Christophe Ricard a779b8878c NFC: st21nfca: Improve load_session
In case anybody uses previous patchset with the CLF, add a check to make sure
missing pipe are created.
st21nfca returns its pipe list in the creation order (most recent latest).

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-05-20 00:48:06 +02:00
Christophe Ricard c44cb2edd0 NFC: dts: st21nfca: Add device-tree (Open Firmware) support to st21nfca
Add functions to recover hardware resources from the device-tree
when not provided by the platform data.

Based on pn544 devicetree implementation

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-05-20 00:47:43 +02:00
Christophe Ricard 0c942b007b NFC: st21nfca: Free buffer when a bad frame is detected
When a bad frame is detected for a bad crc.
We were reallocating and loosing the previous frame pointer.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-05-05 01:04:10 +02:00
Christophe Ricard a3c5d8fb7f NFC: st21nfca: Synchronize i2c Tx and Rx path
Stabilize communication by using a mutex.
This avoids running a write transaction during a read retry or a read
transaction during a write retry.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-05-05 01:01:23 +02:00
Christophe Ricard c97ffdbf51 NFC: st21nfca: Improved i2c Rx data correctness check
A frame starts with ST21NFCA_SOF_EOF(0x7e) + 0x00.
A frame ends with ST21NFCA_SOF_EOF(0x7e).
It is possible that the i2c macrocell is stopped for other
communication interfaces with highest priority(RF or SWP).
This can be seen with some 0xFF data at the end of a received shdlc buffer.
If this happen we need to discard the frame because the CLF will repeat it.

In order to push accurate data to hci layer, we add the following fix:
- Instead of looking for the first 0x7e in the frame, check that the last
received byte is 0x7e.
- Check that the first frame reception block start with start of
frame(0x7e 0x00). If not, clear the buffer.
- Check that the next frame reception block do not start with start of
frame(0x7e). If so, clear the buffer.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-05-05 01:00:34 +02:00
Christophe Ricard e1fb97b925 NFC: st21nfca: Fix st21nfca_hci_remove_len_crc tail room handling
There is no byte stuffing when data are stored in skb.
TAILROOM is 2 byte crc + 1 byte eof.

st21nfca_hci_remove_len_crc was doing an incorrect operation on
the TAILROOM data.
If shdlc timer T2 is triggered, it will request to send the same data.
Before every hci data was lost after st21nfca_hci_remove_len_crc.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-05-05 00:15:26 +02:00
Christophe Ricard 3096e25a3e NFC: st21nfca: Fix incorrect byte stuffing revocation
Byte stuffing was not correctly removed after a i2c read operation.
This was causing improper crc calculation when byte stuffing was
applied to more than 1 byte.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-05-05 00:06:27 +02:00
Christophe Ricard 0bb8a622d6 NFC: st21nfca: Remove few useless include
Remove unneeded includes from i2c.c

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-05-05 00:05:36 +02:00
Christophe Ricard 18d2c624f9 NFC: st21nfca: Improve st21nfca initialization by handling reboot properly
Change in st21nfca_hci_platform_init in order to handle in a better way the
internal reboot command.
Once the reboot is completed, the driver expect to receive a 0x7e filled
buffer.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22 00:37:30 +02:00
Christophe Ricard fcb45e6ab3 NFC: st21nfca: Reworked st21nfca_request_resources
Remove struct st21nfca_i2c_phy* as this parameter can be retrieve
through i2c_get_clientdata(client)

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22 00:37:30 +02:00
Christophe Ricard 9bac75d0ec NFC: st21nfca: st21nfca_hci_i2c_probe returns st21nfca_hci_probe result.
st21nfca_hci_probe return 0 in case of successful call and a different
value in any other cases.

There is no need to check for st21nfca_hci_probe return as this will be
checked after st21nfca_hci_i2c_probe is completed.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22 00:37:30 +02:00
Christophe Ricard 761a2c4f90 NFC: st21nfca: Add __packed to struct st21nfca_pipe_info
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22 00:37:29 +02:00
Christophe Ricard c5b0c370fc NFC: st21nfca: Remove sporadic wait_tab variable from functions.
wait_tab variable is already global and may create conflicts.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22 00:37:29 +02:00
Christophe Ricard e8efab6e6b NFC: st21nfca: Fix warning: array subscript is above array bounds
Fix "warning: array subscript is above array bounds" in load_session

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22 00:37:29 +02:00
Christophe Ricard cc3a9f7254 NFC: st21nfca: Fix sparse: cast to restricted __be16
Fixing "sparse: cast to restricted __be16" message when building with
make C=1 CF=-D__CHECK_ENDIAN__

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22 00:37:29 +02:00
Clement Perrochaud 12b25dbf11 NFC: pn544_i2c: Fix null pointer exception when not using platform data
Fixes a null pointer exception occurring when the IRQ request in
pn544_hci_i2c_probe fails and no platform data is available.

Signed-off-by: Clément Perrochaud <clement.perrochaud@nxp.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22 00:37:29 +02:00
Mark A. Greer 742b1f9fa2 NFC: trf7970a: Add support for the ISO/IEC 14443-B and Type 4B tags
Now that the NFC digital layer has support for the ISO/IEC 14443-B
protocol and type 4B tags, add the corresponding support to the
trf7970a driver.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22 00:37:28 +02:00
Mark A. Greer fd0c8280cf NFC: trf7970a: Add 'autosuspend-delay' DTS property
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-22 00:37:28 +02:00
Mark A. Greer 18422e686e NFC: trf7970a: Don't return value from trf7970a_switch_rf_on()
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-22 00:37:28 +02:00
Mark A. Greer e6403b7c75 NFC: trf7970a: Add pm_runtime support
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-22 00:37:28 +02:00
Mark A. Greer a1d2dc5b40 NFC: trf7970a: Turn RF on after hardware is configured
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-22 00:37:27 +02:00
Mark A. Greer ebcc5a0d08 NFC: trf7970a: Set correct Vin voltage in Chip Status Control register
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-22 00:37:27 +02:00