summaryrefslogtreecommitdiffstats
path: root/drivers/nfc/trf7970a.c
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-09-03 00:12:26 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2014-09-07 23:13:43 +0200
commitaff0564aa7b2118a1d76dc0118dfdbf4beaf4b8c (patch)
tree98bcfb841f90f785944687d1373546f9dc72ef2b /drivers/nfc/trf7970a.c
parentNFC: trf7970a: Recalculate driver timeout values (diff)
downloadlinux-aff0564aa7b2118a1d76dc0118dfdbf4beaf4b8c.tar.xz
linux-aff0564aa7b2118a1d76dc0118dfdbf4beaf4b8c.zip
NFC: trf7970a: Clear possible spurious interrupt before transmitting
The trf7970a occasionally generates spurious interrupts which can confuse the driver. To help alleviate this, clear any interrupts by reading the 'IRQ Status Register' before starting a new transaction. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/trf7970a.c')
-rw-r--r--drivers/nfc/trf7970a.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index b67946c18b40..e7f22a44dc52 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -1120,6 +1120,7 @@ static int trf7970a_in_send_cmd(struct nfc_digital_dev *ddev,
char *prefix;
unsigned int len;
int ret;
+ u8 status;
dev_dbg(trf->dev, "New request - state: %d, timeout: %d ms, len: %d\n",
trf->state, timeout, skb->len);
@@ -1195,6 +1196,11 @@ static int trf7970a_in_send_cmd(struct nfc_digital_dev *ddev,
len = min_t(int, skb->len, TRF7970A_FIFO_SIZE);
+ /* Clear possible spurious interrupt */
+ ret = trf7970a_read_irqstatus(trf, &status);
+ if (ret)
+ goto out_err;
+
ret = trf7970a_transmit(trf, skb, len);
if (ret) {
kfree_skb(trf->rx_skb);