From: Mark A. Greer Date: Tue, 2 Sep 2014 22:12:32 +0000 (-0700) Subject: NFC: trf7970a: Ensure no more RX data before completing receive X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=afa5b5f13e0e2372e440f3ab44620d4e10fca496;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git NFC: trf7970a: Ensure no more RX data before completing receive Depending on the interrupt status value given by the trf7970a, the driver may not know when a receive operation is complete. To handle this, the driver waits for a period of time in case the trf7970a interrupts it again indicating there are more RX data in the FIFO. It is possible that the timeout will occur when there are RX data in the FIFO but before the trf7970a has generated an interrupt to tell the driver about it. Handle this by calling trf7970a_drain_fifo() (instead of trf7970a_send_upstream() which just passes up the data gathered to far) to check if there are more data in the FIFO. If so, gather that data into the receive buffer. If not, pass the data collected so far upstream as before. Signed-off-by: Mark A. Greer Signed-off-by: Samuel Ortiz --- diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c index 8c00827893f1..2b1573fb6e9f 100644 --- a/drivers/nfc/trf7970a.c +++ b/drivers/nfc/trf7970a.c @@ -800,7 +800,7 @@ static void trf7970a_timeout_work_handler(struct work_struct *work) if (trf->ignore_timeout) trf->ignore_timeout = false; else if (trf->state == TRF7970A_ST_WAIT_FOR_RX_DATA_CONT) - trf7970a_send_upstream(trf); /* No more rx data so send up */ + trf7970a_drain_fifo(trf, TRF7970A_IRQ_STATUS_SRX); else if (trf->state == TRF7970A_ST_WAIT_TO_ISSUE_EOF) trf7970a_issue_eof(trf); else