summaryrefslogtreecommitdiff
path: root/drivers/nfc
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-09-02 15:12:30 -0700
committerSamuel Ortiz <sameo@linux.intel.com>2014-09-07 23:13:44 +0200
commitbece3c544fee62ba7750f70b214d612fd02dcc8f (patch)
tree6ac60b17bcda0b575d3cd39d7625882fb6d1e138 /drivers/nfc
parent0e840ed59ba79670b66bba8c1d50b6f67e72d3fb (diff)
NFC: trf7970a: Handle low-watermark IRQ when transmitting
Commit 4dd836e46c3d ("NFC: trf7970a: Reset FIFO when 'End of TX' Interrupt Occurs") fixes the issue that it was meant to fix but adds the unfortunate side effect of causing the driver to report an error when the TX low-watermark level is passed during transmits. This can be fixed by checking whether the IRQ status indicates that the low-watermark has been passed when transmitting. If it has been passed and the FIFO is empty, then its safe to reset the FIFO. Otherwise, silently continue since another TX interrupt will be generated and the FIFO will be reset then. 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.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index e9e961fe6756..6d2b06ddf191 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -667,7 +667,7 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
{
struct trf7970a *trf = dev_id;
int ret;
- u8 status;
+ u8 status, fifo_bytes;
mutex_lock(&trf->lock);
@@ -720,6 +720,16 @@ static irqreturn_t trf7970a_irq(int irq, void *dev_id)
trf->ignore_timeout =
!cancel_delayed_work(&trf->timeout_work);
trf7970a_drain_fifo(trf, status);
+ } else if (status & TRF7970A_IRQ_STATUS_FIFO) {
+ ret = trf7970a_read(trf, TRF7970A_FIFO_STATUS,
+ &fifo_bytes);
+
+ fifo_bytes &= ~TRF7970A_FIFO_STATUS_OVERFLOW;
+
+ if (ret)
+ trf7970a_send_err_upstream(trf, ret);
+ else if (!fifo_bytes)
+ trf7970a_cmd(trf, TRF7970A_CMD_FIFO_RESET);
} else if (status == TRF7970A_IRQ_STATUS_TX) {
trf7970a_cmd(trf, TRF7970A_CMD_FIFO_RESET);
} else {