summaryrefslogtreecommitdiff
path: root/drivers/nfc
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-09-02 22:12:31 (GMT)
committerSamuel Ortiz <sameo@linux.intel.com>2014-09-07 21:13:44 (GMT)
commit5d8f759424d3d7da998a7a9eee702071c8e5d381 (patch)
treec82b826a0fbaf05eb8eb4e7669a080fd92b79477 /drivers/nfc
parentbece3c544fee62ba7750f70b214d612fd02dcc8f (diff)
downloadlinux-5d8f759424d3d7da998a7a9eee702071c8e5d381.tar.xz
NFC: trf7970a: Reread FIFO Status Register when draining FIFO
Receiving an interrupt whose Interrupt Status Register value has only the SRX bit set is supposed to mean that all of the data from the tag has been received. That turns out to not be true so we need to reread the FIFO Status Register to tell if there are any new bytes in the FIFO. If there are, continue receiving them; if there aren't, assume that the receive is complete and pass the data up. Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/trf7970a.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 6d2b06d..8c00827 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -648,6 +648,21 @@ static void trf7970a_drain_fifo(struct trf7970a *trf, u8 status)
status = TRF7970A_IRQ_STATUS_SRX;
} else {
trf->state = TRF7970A_ST_WAIT_FOR_RX_DATA_CONT;
+
+ ret = trf7970a_read(trf, TRF7970A_FIFO_STATUS, &fifo_bytes);
+ if (ret) {
+ trf7970a_send_err_upstream(trf, ret);
+ return;
+ }
+
+ fifo_bytes &= ~TRF7970A_FIFO_STATUS_OVERFLOW;
+
+ /* If there are bytes in the FIFO, set status to '0' so
+ * the if stmt below doesn't fire and the driver will wait
+ * for the trf7970a to generate another RX interrupt.
+ */
+ if (fifo_bytes)
+ status = 0;
}
no_rx_data: