History log of /drivers/nfc/st21nfca/st21nfca.c
Revision Date Author Comments
90d5f81afc8369774a6c581b600aef80b1448d35 13-Sep-2014 Christophe Ricard <christophe.ricard@gmail.com> NFC: st21nfca: Fix recursive fault when doing p2p in target mode.

This patch fix a previous patch introduce by commit 0a91e8ac240a12ac3a03581deb8cd531788c63d4

It is actually fixing a double free mistake in all st21nfca_tm_* function.
We decide to return directly in case of successful execution because skb
got already freed. In st21nfca_tm_recv_dep_req it got freed by nfc_tm_data_received.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
0a91e8ac240a12ac3a03581deb8cd531788c63d4 03-Sep-2014 Christophe Ricard <christophe.ricard@gmail.com> NFC: st21nfca: fix "WARNING: else is not generally useful after a break or return"

scripts/checkpatch.pl -f drivers/nfc/st21nfca.c is throwing the following:
WARNING: else is not generally useful after a break or return
#866: FILE: drivers/nfc/st21nfca/st21nfca.c:866:
+ return 0;
+ } else {

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
efaf956ad6852a7ae0cc4c78bd31079f8039daa6 03-Sep-2014 Christophe Ricard <christophe.ricard@gmail.com> NFC: st21nfca: Clean up macros alignment

Align every macros on the same column.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
cebe22244206d51b80c778f09304d21198652f71 03-Sep-2014 Christophe Ricard <christophe.ricard@gmail.com> NFC: st21nfca: Clean up st21nfca.h macros

Clean up st21nfca.h macros and move the one only used in st21nfca.c.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9ec1f58b9a8ecd72e675c33bfe8ceaf1bc0dc4c5 28-Jul-2014 Christophe Ricard <christophe.ricard@gmail.com> NFC: st21nfca: Fix logic when setting session_id

If dev_num >= ST21NFCA_NUM_DEVICES, the driver was returning an incorrect
success return code.

Once dev_num is set, it was not stated as busy.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
3e6df9191abe9dc46b7f9f540e1c3c73cfaccedf 28-Jul-2014 Christophe Ricard <christophe.ricard@gmail.com> NFC: st21nfca: Fix scripts/checkpatch.pl warnings "Missing a blank line after declarations"

Fixing scripts/checkpatch.pl warning "Missing a blank line after declarations" in:
- st21nfca.c:
- check_presence after fwi variable declaration.
- get_frame_size after len variable declaration.
- st21nfca_hci_i2c_repack after "i, j, r, size" variable declaration.

- st21nfca_dep.c st21nfca_tx_work after skb pointer declaration.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
6ae3ed1c52b9ce12e1b3d2ac8f648b7de1569dfe 28-Jul-2014 Christophe Ricard <christophe.ricard@gmail.com> NFC: st21nfca: Fix sparse: cast to restricted __be32

Fixing "sparse: cast to restricted __be32" 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>
1892bf844ea0261736bd5e75546fc996e9daeedf 20-May-2014 Christophe Ricard <christophe.ricard@gmail.com> 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>
d57d74eb7626a2aeefad47a8d4246e9daf2199f5 20-May-2014 Christophe Ricard <christophe.ricard@gmail.com> 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>
7974728094d35f38775417a26d8f30ea3602496a 13-May-2014 Christophe Ricard <christophe.ricard@gmail.com> 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>
a779b8878c20a5cafff26d774eed4d36a903882a 13-May-2014 Christophe Ricard <christophe.ricard@gmail.com> 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>
0bb8a622d6b47e4dde9ec877029f9e64a997c57f 24-Apr-2014 Christophe Ricard <christophe.ricard@gmail.com> 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>
761a2c4f90d6ea5a821050edccff13adc4a34fae 01-Apr-2014 Christophe Ricard <christophe.ricard@gmail.com> 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>
e8efab6e6bad1bb116bb9dfa6e0f65dd1bb9cc0e 01-Apr-2014 Christophe Ricard <christophe.ricard@gmail.com> 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>
cc3a9f72548e9f497e77b7f6625f021b8cd2bb77 01-Apr-2014 Christophe Ricard <christophe.ricard@gmail.com> 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>
58e1e0a920358cd0dd7fdccc8cbcaa1d117078cf 25-Mar-2014 Christophe Ricard <christophe.ricard@gmail.com> 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>
68957303f44a501af5cf37913208a2acaa6bcdf1 25-Mar-2014 Christophe Ricard <christophe.ricard@gmail.com> 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>