14 Aug, 2013

7 commits


31 Jul, 2013

1 commit


19 Jul, 2013

1 commit

  • kbuild test robot found following error:

    net/built-in.o: In function `nci_spi_send':
    >> spi.c:(.text+0x19a76f): undefined reference to `crc_ccitt'

    Add CRC_CCITT module to Kconfig to fix it

    Reported-by: kbuild test robot.
    Signed-off-by: Frederic Danis
    Signed-off-by: Samuel Ortiz

    Frederic Danis
     

14 Jun, 2013

21 commits

  • The WKS (Well Known Services) bitmask should be transmitted in big endian
    order. Picky implementations will refuse to establish an LLCP link when the
    WKS bit 0 is not set to 1. The vast majority of implementations out there
    are not that picky though...

    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • In order to advertise our LLCP support properly and to follow the LLCP
    specs requirements, we need to initialize the WKS (Well-Known Services)
    bitfield to 1 as SAP 0 is the only mandatory supported service.

    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • When we receive a RNR, the remote is busy processing the last received
    frame. We set a local flag for that, and we should send a SYMM when it
    is set instead of sending any pending frame.

    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • Without the new LLCP_CONNECTING state, non blocking sockets will be
    woken up with a POLLHUP right after calling connect() because their
    state is stuck at LLCP_CLOSED.
    That prevents userspace from implementing any proper non blocking
    socket based NFC p2p client.

    Cc: stable@vger.kernel.org
    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • In nfc_llcp_tx_work() the sk_buff is not freed when the llcp_sock
    is null and the PDU is an I one.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • This patch keeps the socket alive and therefore does not remove
    it from the sockets list in the local until the DISC PDU has been
    actually sent. Otherwise we would reply with DM PDUs before sending
    the DISC one.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • nfc_llcp_send_disconnect() already exists but is not used.
    nfc_llcp_disconnect() naming is not consistent with other PDU
    sending functions.
    This patch removes nfc_llcp_send_disconnect() and renames
    nfc_llcp_disconnect()

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • Enabling or disabling an NFC accessible secure element through netlink
    requires giving both an NFC controller and a secure element indexes.
    Once enabled the secure element will handle card emulation once polling
    starts.

    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • Called via netlink, this API will enable or disable a specific secure
    element. When a secure element is enabled, it will handle card emulation
    and more generically ISO-DEP target mode, i.e. all target mode cases
    except for p2p target mode.

    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • When an NFC driver or host controller stack discovers a secure element,
    it will call nfc_add_se(). In order for userspace applications to use
    these secure elements, a netlink event will then be sent with the SE
    index and its type. With that information userspace applications can
    decide wether or not to enable SEs, through their indexes.

    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • This API will allow NFC drivers to add and remove the secure elements
    they know about or detect. Typically this should be called (asynchronously
    or not) from the driver or the host interface stack detect_se hook.

    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • Secure elements need to be discovered after enabling the NFC controller.
    This is typically done by the NCI core and the HCI drivers (HCI does not
    specify how to discover SEs, it is left to the specific drivers).
    Also, the SE enable/disable API explicitely takes a SE index as its
    argument.

    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • Supported secure elements are typically found during a discovery process
    initiated when the NFC controller is up and running. For a given NFC
    chipset there can be many configurations (embedded SE or not, with or
    without a SIM card wired to the NFC controller SWP interface, etc...) and
    thus driver code will never know before hand which SEs are available.
    So we remove this field, it will be replaced by a real SE discovery
    mechanism.

    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • Before any operation, driver interruption is de-asserted to prevent
    race condition between TX and RX.

    Transaction starts by emitting "Direct read" and acknowledged mode
    bytes. Then packet length is read allowing to allocate correct NCI
    socket buffer. After that payload is retrieved.

    A delay after the transaction can be added.
    This delay is determined by the driver during nci_spi_allocate_device()
    call and can be 0.

    If acknowledged mode is set:
    - CRC of header and payload is checked
    - if frame reception fails (CRC error): NACK is sent
    - if received frame has ACK or NACK flag: unblock nci_spi_send()

    Payload is passed to NCI module.

    At the end, driver interruption is re asserted.

    Signed-off-by: Frederic Danis
    Signed-off-by: Samuel Ortiz

    Frederic Danis
     
  • Before any operation, driver interruption is de-asserted to prevent
    race condition between TX and RX.

    The NCI over SPI header is added in front of NCI packet.
    If acknowledged mode is set, CRC-16-CCITT is added to the packet.
    Then the packet is forwarded to SPI module to be sent.

    A delay after the transaction is added.
    This delay is determined by the driver during nci_spi_allocate_device()
    call and can be 0.

    After data has been sent, driver interruption is re-asserted.

    If acknowledged mode is set, nci_spi_send will block until
    acknowledgment is received.

    Signed-off-by: Frederic Danis
    Signed-off-by: Samuel Ortiz

    Frederic Danis
     
  • The NFC Forum defines a transport interface based on
    Serial Peripheral Interface (SPI) for the NFC Controller
    Interface (NCI).

    This module implements the SPI transport of NCI, calling SPI module
    directly to read/write data to NFC controller (NFCC).

    NFCC driver should provide functions performing device open and close.
    It should also provide functions asserting/de-asserting interruption
    to prevent TX/RX race conditions.
    NFCC driver can also fix a delay between transactions if needed by
    the hardware.

    Signed-off-by: Frederic Danis
    Signed-off-by: Samuel Ortiz

    Frederic Danis
     
  • Exiting on the error case is more typical to the kernel coding style.

    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • This is a simple forward to the HCI driver. When driver is done with the
    operation, it shall directly notify NFC Core by calling
    nfc_fw_upload_done().

    Signed-off-by: Eric Lapuyade
    Signed-off-by: Samuel Ortiz

    Eric Lapuyade
     
  • As several NFC chipsets can have their firmwares upgraded and
    reflashed, this patchset adds a new netlink command to trigger
    that the driver loads or flashes a new firmware. This will allows
    userspace triggered firmware upgrade through netlink.
    The firmware name or hint is passed as a parameter, and the driver
    will eventually fetch the firmware binary through the request_firmware
    API.
    The cmd can only be executed when the nfc dev is not in use. Actual
    firmware loading/flashing is an asynchronous operation. Result of the
    operation shall send a new event up to user space through the nfc dev
    multicast socket. During operation, the nfc dev is not openable and
    thus not usable.

    Signed-off-by: Eric Lapuyade
    Signed-off-by: Samuel Ortiz

    Eric Lapuyade
     
  • skb->dev is used for carrying a net_device pointer and not
    an nci_dev pointer.

    Remove usage of skb-dev to carry nci_dev and replace it by parameter
    in nci_recv_frame(), nci_send_frame() and driver send() functions.

    NfcWilink driver is also updated to use those functions.

    Signed-off-by: Frederic Danis
    Signed-off-by: Samuel Ortiz

    Frederic Danis
     

21 May, 2013

1 commit


30 Apr, 2013

2 commits


27 Apr, 2013

1 commit

  • Since the NFC subsystem gained RFKILL support, it needs to be able
    to build properly with whatever option for RFKILL has been selected.

    on i386:

    net/built-in.o: In function `nfc_unregister_device':
    (.text+0x6a36d): undefined reference to `rfkill_unregister'
    net/built-in.o: In function `nfc_unregister_device':
    (.text+0x6a378): undefined reference to `rfkill_destroy'
    net/built-in.o: In function `nfc_register_device':
    (.text+0x6a493): undefined reference to `rfkill_alloc'
    net/built-in.o: In function `nfc_register_device':
    (.text+0x6a4a4): undefined reference to `rfkill_register'
    net/built-in.o: In function `nfc_register_device':
    (.text+0x6a4b3): undefined reference to `rfkill_destroy'
    net/built-in.o: In function `nfc_dev_up':
    (.text+0x6a8e8): undefined reference to `rfkill_blocked'

    when CONFIG_RFKILL=m but NFC is builtin.

    Reported-by: Randy Dunlap
    Acked-by: Randy Dunlap
    Signed-off-by: Marcel Holtmann
    Signed-off-by: Samuel Ortiz

    Marcel Holtmann
     

26 Apr, 2013

1 commit


25 Apr, 2013

1 commit

  • The sockaddr_nfc_llcp struct has as hole between ->sa_family and
    ->dev_idx so I've added a memset() to clear it and prevent an
    information leak.

    Also the ->nfc_protocol element wasn't set so I've added that.

    "uaddr->sa_family" and "llcp_addr->sa_family" are the same thing but
    it's less confusing to use llcp_addr consistently throughout.

    Signed-off-by: Dan Carpenter
    Signed-off-by: David S. Miller

    Dan Carpenter
     

24 Apr, 2013

1 commit


12 Apr, 2013

1 commit

  • All NFC devices will now get proper RFKILL support as long as they provide
    some dev_up and dev_down hooks. Rfkilling an NFC device will bring it down
    while it is left to userspace to bring it back up when being rfkill unblocked.
    This is very similar to what Bluetooth does.

    Acked-by: Marcel Holtmann
    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     

11 Apr, 2013

2 commits