summaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
authorMark Greer <mgreer@animalcreek.com>2017-06-15 13:46:17 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2017-06-22 18:20:00 -0400
commita81d1ab3cad77e20c2df8baef0a35a4980fc511c (patch)
treee4a98dee491606a76bd7c8f749e95d80dec1044e /drivers/nfc
parent1b609e4384a10bc4139ab6ca63caa809eb2d5d0c (diff)
Revert "NFC: trf7970a: Handle extra byte in response to Type 5 RMB commands"
This reverts commit ab714817d7e891608d31f6996b1e4c43cf2bf342. The original commit was designed to handle a bug in the trf7970a NFC controller where an extra byte was returned in Read Multiple Blocks (RMB) command responses. However, it has become less clear whether it is a bug in the trf7970a or in the tag. In addition, it was assumed that the extra byte was always returned but it turns out that is not always the case. The result is that a byte of good data is trimmed off when the extra byte is not present ultimately causing the neard deamon to fail the read. Since the trf7970a driver does not have the context to know when to trim the byte or not, remove the code from the trf7970a driver all together (and move it up to the neard daemon). This has the added benefit of simplifying the kernel driver and putting the extra complexity into userspace. CC: Rob Herring <robh@kernel.org> CC: devicetree@vger.kernel.org Signed-off-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/trf7970a.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 914463a0e7b3..6ee7b038823d 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -150,7 +150,6 @@
150 */ 150 */
151#define TRF7970A_QUIRK_IRQ_STATUS_READ BIT(0) 151#define TRF7970A_QUIRK_IRQ_STATUS_READ BIT(0)
152#define TRF7970A_QUIRK_EN2_MUST_STAY_LOW BIT(1) 152#define TRF7970A_QUIRK_EN2_MUST_STAY_LOW BIT(1)
153#define TRF7970A_QUIRK_T5T_RMB_EXTRA_BYTE BIT(2)
154 153
155/* Direct commands */ 154/* Direct commands */
156#define TRF7970A_CMD_IDLE 0x00 155#define TRF7970A_CMD_IDLE 0x00
@@ -449,7 +448,6 @@ struct trf7970a {
449 u8 md_rf_tech; 448 u8 md_rf_tech;
450 u8 tx_cmd; 449 u8 tx_cmd;
451 bool issue_eof; 450 bool issue_eof;
452 bool adjust_resp_len;
453 struct gpio_desc *en_gpiod; 451 struct gpio_desc *en_gpiod;
454 struct gpio_desc *en2_gpiod; 452 struct gpio_desc *en2_gpiod;
455 struct mutex lock; 453 struct mutex lock;
@@ -630,13 +628,6 @@ static void trf7970a_send_upstream(struct trf7970a *trf)
630 trf->aborting = false; 628 trf->aborting = false;
631 } 629 }
632 630
633 if (trf->adjust_resp_len) {
634 if (trf->rx_skb)
635 skb_trim(trf->rx_skb, trf->rx_skb->len - 1);
636
637 trf->adjust_resp_len = false;
638 }
639
640 trf->cb(trf->ddev, trf->cb_arg, trf->rx_skb); 631 trf->cb(trf->ddev, trf->cb_arg, trf->rx_skb);
641 632
642 trf->rx_skb = NULL; 633 trf->rx_skb = NULL;
@@ -1459,15 +1450,10 @@ static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
1459 trf->iso_ctrl = iso_ctrl; 1450 trf->iso_ctrl = iso_ctrl;
1460 } 1451 }
1461 1452
1462 if (trf->framing == NFC_DIGITAL_FRAMING_ISO15693_T5T) { 1453 if ((trf->framing == NFC_DIGITAL_FRAMING_ISO15693_T5T) &&
1463 if (trf7970a_is_iso15693_write_or_lock(req[1]) && 1454 trf7970a_is_iso15693_write_or_lock(req[1]) &&
1464 (req[0] & ISO15693_REQ_FLAG_OPTION)) 1455 (req[0] & ISO15693_REQ_FLAG_OPTION))
1465 trf->issue_eof = true; 1456 trf->issue_eof = true;
1466 else if ((trf->quirks &
1467 TRF7970A_QUIRK_T5T_RMB_EXTRA_BYTE) &&
1468 (req[1] == ISO15693_CMD_READ_MULTIPLE_BLOCK))
1469 trf->adjust_resp_len = true;
1470 }
1471 } 1457 }
1472 1458
1473 return 0; 1459 return 0;
@@ -2032,9 +2018,6 @@ static int trf7970a_probe(struct spi_device *spi)
2032 return ret; 2018 return ret;
2033 } 2019 }
2034 2020
2035 if (of_property_read_bool(np, "t5t-rmb-extra-byte-quirk"))
2036 trf->quirks |= TRF7970A_QUIRK_T5T_RMB_EXTRA_BYTE;
2037
2038 if (of_property_read_bool(np, "irq-status-read-quirk")) 2021 if (of_property_read_bool(np, "irq-status-read-quirk"))
2039 trf->quirks |= TRF7970A_QUIRK_IRQ_STATUS_READ; 2022 trf->quirks |= TRF7970A_QUIRK_IRQ_STATUS_READ;
2040 2023