WSL2-Linux-Kernel/net/nfc
Thierry Escande 2c66daecc4 NFC Digital: Add NFC-A technology support
This adds support for NFC-A technology at 106 kbits/s. The stack can
detect tags of type 1 and 2. There is no support for collision
detection. Tags can be read and written by using a user space
application or a daemon like neard.

The flow of polling operations for NFC-A detection is as follow:

1 - The digital stack sends the SENS_REQ command to the NFC device.
2 - The NFC device receives a SENS_RES response from a peer device and
    passes it to the digital stack.
3   - If the SENS_RES response identifies a type 1 tag, detection ends.
      NFC core is notified through nfc_targets_found().
4   - Otherwise, the digital stack sets the cascade level of NFCID1 to
      CL1 and sends the SDD_REQ command.
5 - The digital stack selects SEL_CMD and SEL_PAR according to the
    cascade level and sends the SDD_REQ command.
4 - The digital stack receives a SDD_RES response for the cascade level
    passed in the SDD_REQ command.
5 - The digital stack analyses (part of) NFCID1 and verify BCC.
6 - The digital stack sends the SEL_REQ command with the NFCID1
    received in the SDD_RES.
6 - The peer device replies with a SEL_RES response
7   - Detection ends if NFCID1 is complete. NFC core notified of new
      target by nfc_targets_found().
8   - If NFCID1 is not complete, the cascade level is incremented (up
      to and including CL3) and the execution continues at step 5 to
      get the remaining bytes of NFCID1.

Once target detection is done, type 1 and 2 tag commands must be
handled by a user space application (i.e neard) through the NFC core.
Responses for type 1 tag are returned directly to user space via NFC
core.
Responses of type 2 commands are handled differently. The digital stack
doesn't analyse the type of commands sent through im_transceive() and
must differentiate valid responses from error ones.
The response process flow is as follow:

1 - If the response length is 16 bytes, it is a valid response of a
    READ command. the packet is returned to the NFC core through the
    callback passed to im_transceive(). Processing stops.
2 - If the response is 1 byte long and is a ACK byte (0x0A), it is a
    valid response of a WRITE command for example. First packet byte
    is set to 0 for no-error and passed back to the NFC core.
    Processing stops.
3 - Any other response is treated as an error and -EIO error code is
    returned to the NFC core through the response callback.

Moreover, since the driver can't differentiate success response from a
NACK response, the digital stack has to handle CRC calculation.

Thus, this patch also adds support for CRC calculation. If the driver
doesn't handle it, the digital stack will calculate CRC and will add it
to sent frames. CRC will also be checked and removed from received
frames. Pointers to the correct CRC calculation functions are stored in
the digital stack device structure when a target is detected. This
avoids the need to check the current target type for every call to
im_transceive() and for every response received from a peer device.

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-09-25 02:02:23 +02:00
..
hci NFC: hci: Fix enable/disable confusion 2013-08-14 01:13:36 +02:00
nci NFC: NCI: Simplify NCI SPI to become a simple framing/checking layer 2013-09-25 01:35:41 +02:00
Kconfig NFC Digital: Add NFC-A technology support 2013-09-25 02:02:23 +02:00
Makefile NFC Digital: Implement driver commands mechanism 2013-09-25 02:02:07 +02:00
af_nfc.c NFC: Core code identation fixes 2012-03-06 15:16:25 -05:00
core.c NFC: Set active target upon DEP up event reception 2013-09-25 01:35:41 +02:00
digital.h NFC Digital: Add NFC-A technology support 2013-09-25 02:02:23 +02:00
digital_core.c NFC Digital: Add NFC-A technology support 2013-09-25 02:02:23 +02:00
digital_technology.c NFC Digital: Add NFC-A technology support 2013-09-25 02:02:23 +02:00
llcp.h NFC: llcp: Fix non blocking sockets connections 2013-06-14 13:45:07 +02:00
llcp_commands.c NFC: Rename nfc_llcp_disconnect() to nfc_llcp_send_disconnect() 2013-06-14 13:45:04 +02:00
llcp_core.c NFC: llcp: Fix the well known services endianness 2013-06-14 13:45:10 +02:00
llcp_sock.c NFC: llcp: Fix non blocking sockets connections 2013-06-14 13:45:07 +02:00
netlink.c NFC: netlink: Add result of firmware operation to completion event 2013-08-14 01:12:58 +02:00
nfc.h NFC: netlink: Add result of firmware operation to completion event 2013-08-14 01:12:58 +02:00
rawsock.c NFC: Fix some code style and whitespace issues 2012-10-26 18:26:52 +02:00