Commit Graph

264 Commits

Author SHA1 Message Date
Christophe Ricard
300c627fbc NFC: st21nfca: Fix potential depmod dependency cycle
In the previous makefile 2 modules were generated for CONFIG_NFC_ST21NFCA
(st21nfca.ko and st21nfca_dep.ko). Merge both of them into st21nfca_hci.ko
and fix a potential depmod dependency cycle, similar to the one we saw
on st21nfcb:

depmod: WARNING: found 6 modules in dependency cycles!
depmod: WARNING:
/lib/modules/3.17.0-rc3-00002-g7505cea/kernel/drivers/nfc/st21nfcb/st21nfcb.ko
in dependency cycle!
depmod: WARNING:
/lib/modules/3.17.0-rc3-00002-g7505cea/kernel/drivers/nfc/st21nfcb/ndlc.ko
in dependency cycle!
depmod: WARNING:
/lib/modules/3.17.0-rc3-00002-g7505cea/kernel/net/rfkill/rfkill.ko in
dependency cycle!
depmod: WARNING:
/lib/modules/3.17.0-rc3-00002-g7505cea/kernel/net/nfc/nfc.ko in
dependency cycle!
depmod: WARNING:
/lib/modules/3.17.0-rc3-00002-g7505cea/kernel/net/nfc/nci/nci.ko in
dependency cycle!
depmod: WARNING:
/lib/modules/3.17.0-rc3-00002-g7505cea/kernel/lib/crc-ccitt.ko in
dependency cycle!
./scripts/depmod.sh: line 57: 23387 Segmentation fault      (core
dumped) "$DEPMOD" "$@" "$KERNELRELEASE" $SYMBOL_PREFIX
make: *** [_modinst_post] Error 139

Reported-by: Daniel Wagner <wagi@monom.org>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-09-07 23:45:53 +02:00
Christophe Ricard
a1b27b3867 NFC: st21nfcb: Fix depmod dependency cycle
This fix issue reported here:
https://lists.01.org/pipermail/linux-nfc/2014-September/002871.html

depmod: WARNING: found 6 modules in dependency cycles!
depmod: WARNING:
/lib/modules/3.17.0-rc3-00002-g7505cea/kernel/drivers/nfc/st21nfcb/st21nfcb.ko
in dependency cycle!
depmod: WARNING:
/lib/modules/3.17.0-rc3-00002-g7505cea/kernel/drivers/nfc/st21nfcb/ndlc.ko
in dependency cycle!
depmod: WARNING:
/lib/modules/3.17.0-rc3-00002-g7505cea/kernel/net/rfkill/rfkill.ko in
dependency cycle!
depmod: WARNING:
/lib/modules/3.17.0-rc3-00002-g7505cea/kernel/net/nfc/nfc.ko in
dependency cycle!
depmod: WARNING:
/lib/modules/3.17.0-rc3-00002-g7505cea/kernel/net/nfc/nci/nci.ko in
dependency cycle!
depmod: WARNING:
/lib/modules/3.17.0-rc3-00002-g7505cea/kernel/lib/crc-ccitt.ko in
dependency cycle!
./scripts/depmod.sh: line 57: 23387 Segmentation fault      (core
dumped) "$DEPMOD" "$@" "$KERNELRELEASE" $SYMBOL_PREFIX
make: *** [_modinst_post] Error 139

Reported-by: Daniel Wagner <wagi@monom.org>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-09-07 23:45:35 +02:00
Dan Carpenter
d07f1e8600 NFC: microread: Potential overflows in microread_target_discovered()
Smatch says that skb->data is untrusted so we need to check to make sure
that the memcpy() doesn't overflow.

Fixes: cfad1ba871 ('NFC: Initial support for Inside Secure microread')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-09-05 00:57:32 +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
Mark A. Greer
12e9ade309 NFC: trf7970a: Allow different Modulator and SYS_CLK Control register values
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-22 00:37:27 +02:00
Mark A. Greer
a0822a7e3b NFC: trf7970a: Set 'Modulator and SYS_CLK Control' after 'ISO Control'
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-22 00:37:27 +02:00
Mark A. Greer
49d19cc794 NFC: trf7970a: Only write 'ISO Control' when its changing
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-22 00:37:27 +02:00
Mark A. Greer
4dd836e46c NFC: trf7970a: Reset FIFO when 'End of TX' Interrupt Occurs
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-22 00:37:27 +02:00
Mark A. Greer
b887eb09d3 NFC: trf7970a: Clear 'NFC Target Detection Level' register
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-22 00:37:27 +02:00
Mark A. Greer
5876bc75e2 NFC: trf7970a: Only abort a command if one is active
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-22 00:37:26 +02:00
Mark A. Greer
5fa3af352b NFC: trf7970a: Increase TRF7970A_WAIT_FOR_RX_DATA_TIMEOUT to 20 ms
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-04-22 00:37:26 +02:00
Clement Perrochaud
eda8565af3 NFC: pn544: i2c: Add device-tree (Open Firmware) support to PN544
Add functions to recover hardware resources from the device-tree when not
provided by the platform data.

Signed-off-by: Clément Perrochaud <clement.perrochaud@nxp.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22 00:37:26 +02:00
Christophe Ricard
58e1e0a920 NFC: st21nfca: Implement load_session HCI hook
This implementation rely on the ST21NFCA_DEVICE_MGNT_GATE and
ST21NFCA_DM_GETINFO proprietary gates commands.

First we are retrieving a pipe list available on the CLF with the
ST21NFCA_DM_GETINFO_PIPE_LIST parameter. A gate<->pipe table match
is done with ST21NFCA_DM_GETINFO_PIPE_INFO for each pipe.
If the pipe is created and open, we fill st21nfca_gates table.
If the pipe is create but closed or is not created we keep the gate
with NFC_HCI_INVALID_PIPE.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22 00:37:26 +02:00
Christophe Ricard
68957303f4 NFC: ST21NFCA: Add driver for STMicroelectronics ST21NFCA NFC Chip
Add driver for STMicroelectronics ST21NFCA NFC controller.
ST21NFCA is using HCI protocol, shdlc as LLC layer & I2C as
communication protocol.

Adding support for Reader/Writer mode with Tag type 1/2/3/4 A & B.
It is using proprietary gate 15 for ISO14443-3 such as type 1 &
type 2 tags. It is using proprietary gate 14 for type F tags.
ST21NFCA_DEVICE_MGNT_GATE gives access to proprietary CLF configuration.
Standard gate for ISO14443-4 A (13) & B (11) are also used.

ST21NFCA specific mecanism:

One particular point to notice for the data handling is that frame
does not contain any length value. Therefore the i2c part of this driver
is managing the reception with a read length sequence until the end of
frame (0x7e) is reached.

In order to avoid conflict between sof & eof a mecanism
called byte stuffing concist of an escape byte (0x7d) insertion before
special byte (0x7e, 0x7d). The special byte is then xored with 0x20.

In this driver, When data are available in the CLF, the interrupt
gpio is driven to active state and triggered an interrupt.
Once the i2c_master_recv start, the interrupt gpio is driven to idle
state until its complete. If the frame is incomplete or data are still
available, interrupts will be triggered again.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-04-22 00:37:25 +02:00
Mark A. Greer
9d9304b321 NFC: trf7970a: Add ISO/IEC 15693 and Type 5 tag Support
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-11 00:47:09 +01:00
Mark A. Greer
8006289108 NFC: trf7970a: Add support for Type 4A Tags
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-11 00:47:08 +01:00
Mark A. Greer
165063f1da NFC: trf7970a: Add driver with ISO/IEC 14443 Type 2 Tag Support
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>
2014-03-11 00:46:55 +01:00
Axel Lin
99968e0616 NFC: pn533: Convert to use USB_DEVICE macro
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-02-23 23:32:18 +01:00
Axel Lin
4aa7ed02f5 NFC: port100: Convert to use USB_DEVICE macro
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-02-23 23:32:18 +01:00