01 Nov, 2016

1 commit

  • NFC version reply size checked against only header size, not against
    full message size. That may lead potentially to uninitialized memory access
    in version data.

    That leads to warnings when version data is accessed:
    drivers/misc/mei/bus-fixup.c: warning: '*((void *)&ver+11)' may be used uninitialized in this function [-Wuninitialized]: => 212:2

    Reported in
    Build regressions/improvements in v4.9-rc3
    https://lkml.org/lkml/2016/10/30/57

    Fixes: 59fcd7c63abf (mei: nfc: Initial nfc implementation)
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     

21 Jul, 2016

1 commit

  • Samuel Ortiz says:

    ====================
    NFC 4.8 pull request

    This is the first NFC pull request for 4.8. We have:

    - A fairly large NFC digital stack patchset:
    * RTOX fixes.
    * Proper DEP RWT support.
    * ACK and NACK PDUs handling fixes, in both initiator
    and target modes.
    * A few memory leak fixes.

    - A conversion of the nfcsim driver to use the digital stack.
    The driver supports the DEP protocol in both NFC-A and NFC-F.

    - Error injection through debugfs for the nfcsim driver.

    - Improvements to the port100 driver for the Sony USB chipset, in
    particular to the command abort and cancellation code paths.

    - A few minor fixes for the pn533, trf7970a and fdp drivers.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

20 Jul, 2016

2 commits

  • This patch allows to simulate the lost of frames exchanged between the 2
    nfcsim devices through a control entry in the debugfs and is used as
    follow:

    echo n > /sys/kernel/debug/nfcsim/nfcX/dropframe

    Where n specifies the number of frames to be dropped between 0 and 255
    and nfcX is either nfc0 or nfc1, one of the two nfcsim devices.

    In the following example, the next frame that should be sent by the nfc0
    device will be dropped and thus not received by the nfc1 device:

    echo 1 > /sys/kernel/debug/nfcsim/nfc0/dropframe

    The value of 0 can be used to reset the dropframe counter.

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

    Thierry Escande
     
  • The idea is to have a way to control and/or modify the behavior of the
    nfcsim virtual devices.

    This patch creates a folder tree in the debug filesystem. The debugfs is
    usually mounted into /sys/kernel/debug and the nfcsim entries are
    located in DEBUGFS/nfcsim/nfcX/ where X is either 0 or 1 depending on
    the device you want to address.

    These folders are empty for now and control entries will be added by
    upcoming commits.

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

    Thierry Escande
     

18 Jul, 2016

1 commit

  • On mips and parisc:

    drivers/bluetooth/btwilink.c: In function 'ti_st_open':
    drivers/bluetooth/btwilink.c:174:21: warning: overflow in implicit constant conversion [-Woverflow]
    hst->reg_status = -EINPROGRESS;

    drivers/nfc/nfcwilink.c: In function 'nfcwilink_open':
    drivers/nfc/nfcwilink.c:396:31: warning: overflow in implicit constant conversion [-Woverflow]
    drv->st_register_cb_status = -EINPROGRESS;

    There are actually two issues:
    1. Whether "char" is signed or unsigned depends on the architecture.
    As the completion callback data is used to pass a (negative) error
    code, it should always be signed.
    2. EINPROGRESS is 150 on mips, 245 on parisc.
    Hence -EINPROGRESS doesn't fit in a signed 8-bit number.

    Change the callback status from "char" to "int" to fix these.

    Signed-off-by: Geert Uytterhoeven
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Samuel Ortiz
    Signed-off-by: Marcel Holtmann

    Geert Uytterhoeven
     

06 Jul, 2016

5 commits


04 Jul, 2016

6 commits

  • With this complete rewrite, the loopback nfcsim driver now relies on the
    Digital layer of the nfc stack. As with the previous version, 2 nfc
    devices are declared when the driver is initialized. The driver supports
    the NFC_DEP protocol in NFC-A and NFC-F technologies.

    The 2 devices are using a pair of virtual links for sk_buff exchange.
    The out-link of one device is the in-link of the other and conversely.

    To receive data, a device calls nfcsim_link_recv_skb() on its in-link
    and waits for incoming data on a wait queue. To send data, a device
    calls nfcsim_link_send_skb() on its out-link which stores the passed skb
    and signals its wait queue. If the peer device was in the
    nfcsim_link_recv_skb() call, it will be signaled and will be able to
    pass the received sk_buff up to the Digital layer.

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

    Thierry Escande
     
  • When setting the driver framing as NFC_DIGITAL_FRAMING_NFCF_NFC_DEP it
    used to be already configured as NFC_DIGITAL_FRAMING_NFCF which is the
    same. So this entry was empty in the in_protocols table.
    Now that the digital stack can handle PLS requests, it can be changed
    on the fly from NFC_DIGITAL_FRAMING_NFCA_NFC_DEP.
    This patch explicitly defines the framing configuration values for
    NFC_DIGITAL_FRAMING_NFCF_NFC_DEP.

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

    Thierry Escande
     
  • Signed-off-by: Geoff Lansberry
    Signed-off-by: Samuel Ortiz

    Geoff Lansberry
     
  • drivers/nfc/fdp/fdp.c: In function ‘fdp_nci_patch_otp’:
    drivers/nfc/fdp/fdp.c:373: warning: comparison is always false due to limited range of data type
    drivers/nfc/fdp/fdp.c: In function ‘fdp_nci_patch_ram’:
    drivers/nfc/fdp/fdp.c:444: warning: comparison is always false due to limited range of data type

    fdp_nci_create_conn() may return a negative error code, which is
    silently ignored by assigning it to a u8.

    Change conn_id from u8 to int to fix this.

    Fixes: a06347c04c13e380 ("NFC: Add Intel Fields Peak NFC solution driver")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Samuel Ortiz

    Geert Uytterhoeven
     
  • We can't pass devm_ allocated pointers to kfree() because they will be
    freed again after the drive is unloaded.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Samuel Ortiz

    Dan Carpenter
     
  • When info->ram_patch is released info->otp_patch is being set
    to NULL rather than info->ram_patch. I believe this is a cut-n-paste
    bug from almost identical code proceeding it that uses the same
    idiom for info->otp_patch.

    Signed-off-by: Colin Ian King
    Signed-off-by: Samuel Ortiz

    Colin Ian King
     

10 May, 2016

5 commits


04 May, 2016

17 commits

  • NCI provides possible way to run loopback testing has done over HCI.

    For us it offers many advantages:
    - It simplifies the code: No more need for a vendor_cmds structure
    - Loopback over HCI may not be supported in future st-nci firmware

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • According to NCI specification, destination type and destination
    specific parameters shall uniquely identify a single destination
    for the Logical Connection.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • ST21NFCA_ESE_HOST_ID is already defined in st21nfca.h.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • ST_NCI_HCI_HOST_ID_ESE is already having an equivalent in se.c
    (ST_NCI_ESE_HOST_ID).

    Remove and replace where relevant.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • When st_nci_spi_acpi_request_resources() gets called we
    already know that the entries in ->acpi_match_table have
    matched ACPI ID of the device.
    In addition spi_device pointer cannot be NULL in any case
    (otherwise SPI core would not call ->probe() for the driver
    in the first place).

    Drop the two useless checks from the driver.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • When st_nci_i2c_acpi_request_resources() gets called we already
    know that the entries in ->acpi_match_table have matched ACPI ID
    of the device.
    In addition I2C client pointer cannot be NULL in any case
    (otherwise I2C core would not call ->probe() for the driver in
    the first place).

    Drop the two useless checks from the driver.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • When st21nfca_hci_i2c_acpi_request_resources() gets called we
    already know that the entries in ->acpi_match_table have matched
    ACPI ID of the device.
    In addition I2C client pointer cannot be NULL in any case
    (otherwise I2C core would not call ->probe() for the driver in
    the first place).

    Drop the two useless checks from the driver.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • An APDU_READER_GATE pipe is not expected on a UICC. Be more
    explicit so that an other secure element form factor (SD card)
    does not prompt this message.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • An APDU_READER_GATE pipe is not expected on a UICC. Be more
    explicit so that an other secure element form factor (SD card)
    does not prompt this message.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • Simplify white list Building

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • Simplify white list Building

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • When they're present, set is_ese_present and set is_uicc_present
    to the value describe in their package description.

    So far is_ese_present and is_uicc_present was set to true if their
    property was present.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • When they're present, set is_ese_present and set is_uicc_present
    to the value describe in their package description.

    So far is_ese_present and is_uicc_present was set to true if their
    property was present.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • Since
    commit 10cf4899f8af ("gpiolib: tighten up ACPI legacy gpio lookups")

    If _DSD properties are available in an ACPI node, we are not
    allowed to fallback to _CRS data to retrieve gpio properties.
    This was causing us to fail if uicc-present and/or ese-present
    are defined.

    To be consistent with devicetree change ST_NCI_GPIO_NAME_RESET
    content to reset so that acpi_find_gpio in drivers/gpio/gpiolib.c
    will look for reset-gpios. In the mean time the ACPI table needs
    to be fixed as follow:

    Device (NFC1)
    {
    Name (_ADR, Zero) // _ADR: Address
    Name (_HID, "SMO2100") // _HID: Hardware ID
    Name (_CID, "SMO2100") // _CID: Compatible ID
    Name (_DDN, "SMO NFC") // _DDN: DOS Device Name
    Name (_UID, One) // _UID: Unique ID
    Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
    {
    Name (SBUF, ResourceTemplate ()
    {
    I2cSerialBus (0x0008, ControllerInitiated, 400000,
    AddressingMode7Bit, "\\_SB.I2C7",
    0x00, ResourceConsumer, ,)
    GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone, 0x0000,
    "\\_SB.GPO2", 0x00, ResourceConsumer, ,)
    { // Pin list
    0x0001
    }
    GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly,
    "\\_SB.GPO2", 0x00, ResourceConsumer, ,)
    { // Pin list
    0x0002,
    }
    })
    Name (_DSD, Package (0x02)
    {
    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */,
    Package (0x03)
    {
    Package (0x02) { "uicc-present", 1 },
    Package (0x02) { "ese-present", 1 },
    Package (0x02) { "enable-gpios", Package(0x04) { ^NFC1, 1, 0, 0} },
    }
    })
    Return (SBUF) /* \_SB_.I2C7.NFC1._CRS.SBUF */
    }
    Method (_STA, 0, NotSerialized) // _STA: Status
    {
    Return (0x0F)
    }
    }

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • Since
    commit 10cf4899f8af ("gpiolib: tighten up ACPI legacy gpio lookups")

    If _DSD properties are available in an ACPI node, we are not
    allowed to fallback to _CRS data to retrieve gpio properties.
    This was causing us to fail if uicc-present and/or ese-present
    are defined.

    To be consistent with devicetree change ST_NCI_GPIO_NAME_RESET
    content to reset so that acpi_find_gpio in drivers/gpio/gpiolib.c
    will look for reset-gpios. In the mean time the ACPI table needs
    to be fixed as follow (Tested on Minnowboard Max):

    Device (NFC1)
    {
    Name (_ADR, Zero) // _ADR: Address
    Name (_HID, "SMO2101") // _HID: Hardware ID
    Name (_CID, "SMO2101") // _CID: Compatible ID
    Name (_DDN, "SMO NFC") // _DDN: DOS Device Name
    Name (_UID, One) // _UID: Unique ID
    Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
    {
    Name (SBUF, ResourceTemplate ()
    {
    SpiSerialBus (0, PolarityLow, FourWireMode, 8,
    ControllerInitiated, 4000000, ClockPolarityLow,
    ClockPhaseFirst, "\\_SB.SPI1",
    0x00, ResourceConsumer, ,)
    GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone, 0x0000,
    "\\_SB.GPO2", 0x00, ResourceConsumer, ,)
    { // Pin list
    0x0001
    }
    GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly,
    "\\_SB.GPO2", 0x00, ResourceConsumer, ,)
    { // Pin list
    0x0002,
    }
    })
    Name (_DSD, Package (0x02)
    {
    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */,
    Package (0x03)
    {
    Package (0x02) { "uicc-present", 1 },
    Package (0x02) { "ese-present", 1 },
    Package (0x02) { "reset-gpios", Package(0x04) { ^NFC1, 1, 0, 0} },
    }
    })
    Return (SBUF) /* \_SB_.SPI1.NFC1._CRS.SBUF */
    }
    Method (_STA, 0, NotSerialized) // _STA: Status
    {
    Return (0x0F)
    }
    }

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • Since
    commit 10cf4899f8af ("gpiolib: tighten up ACPI legacy gpio lookups")

    If _DSD properties are available in an ACPI node, we are not
    allowed to fallback to _CRS data to retrieve gpio properties.
    This was causing us to fail if uicc-present and/or ese-present
    are defined.

    To be consistent with devicetree change ST_NCI_GPIO_NAME_RESET
    content to reset so that acpi_find_gpio in drivers/gpio/gpiolib.c
    will look for reset-gpios. In the mean time the ACPI table needs
    to be fixed as follow:

    Device (NFC1)
    {
    Name (_ADR, Zero) // _ADR: Address
    Name (_HID, "SMO2101") // _HID: Hardware ID
    Name (_CID, "SMO2101") // _CID: Compatible ID
    Name (_DDN, "SMO NFC") // _DDN: DOS Device Name
    Name (_UID, One) // _UID: Unique ID
    Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
    {
    Name (SBUF, ResourceTemplate ()
    {
    I2cSerialBus (0x0008, ControllerInitiated, 400000,
    AddressingMode7Bit, "\\_SB.I2C7",
    0x00, ResourceConsumer, ,)
    GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone, 0x0000,
    "\\_SB.GPO2", 0x00, ResourceConsumer, ,)
    { // Pin list
    0x0001
    }
    GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly,
    "\\_SB.GPO2", 0x00, ResourceConsumer, ,)
    { // Pin list
    0x0002,
    }
    })
    Name (_DSD, Package (0x02)
    {
    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */,
    Package (0x03)
    {
    Package (0x02) { "uicc-present", 1 },
    Package (0x02) { "ese-present", 1 },
    Package (0x02) { "reset-gpios", Package(0x04) { ^NFC1, 1, 0, 0} },
    }
    })
    Return (SBUF) /* \_SB_.I2C7.NFC1._CRS.SBUF */
    }
    Method (_STA, 0, NotSerialized) // _STA: Status
    {
    Return (0x0F)
    }
    }

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • Fix static checker warning:
    drivers/nfc/st21nfca/i2c.c:530 st21nfca_hci_i2c_acpi_request_resources()
    error: 'gpiod_ena' dereferencing possible ERR_PTR()

    Fix so that if no enable gpio can be retrieved an -ENODEV is returned.

    Reported-by: Dan Carpenter
    Fixes: dfa8070d7f64 ("nfc: st21nfca: Add support for acpi probing for i2c device.")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     

02 May, 2016

1 commit


10 Apr, 2016

1 commit