1 From 543618f5388d487ba88e3d5304c161fc3ccf61d1 Mon Sep 17 00:00:00 2001
2 From: Matthew McClintock <mmcclint@codeaurora.org>
3 Date: Thu, 10 Mar 2016 16:44:55 -0600
4 Subject: [PATCH 10/37] spi: qup: properly detect extra interrupts
6 It's possible for a SPI transaction to complete and get another
7 interrupt and have it processed on the same spi_transfer before the
8 transfer_one can set it to NULL.
10 This masks unexpected interrupts, so let's set the spi_transfer to
11 NULL in the interrupt once the transaction is done. So we can
12 properly detect these bad interrupts and print warning messages.
14 Signed-off-by: Matthew McClintock <mmcclint@codeaurora.org>
16 drivers/spi/spi-qup.c | 15 +++++++++------
17 1 file changed, 9 insertions(+), 6 deletions(-)
19 --- a/drivers/spi/spi-qup.c
20 +++ b/drivers/spi/spi-qup.c
21 @@ -507,6 +507,7 @@ static irqreturn_t spi_qup_qup_irq(int i
22 u32 opflags, qup_err, spi_err;
27 spin_lock_irqsave(&controller->lock, flags);
28 xfer = controller->xfer;
29 @@ -565,16 +566,19 @@ static irqreturn_t spi_qup_qup_irq(int i
30 spi_qup_write(controller, xfer);
33 - spin_lock_irqsave(&controller->lock, flags);
34 - controller->error = error;
35 - controller->xfer = xfer;
36 - spin_unlock_irqrestore(&controller->lock, flags);
38 /* re-read opflags as flags may have changed due to actions above */
39 opflags = readl_relaxed(controller->base + QUP_OPERATIONAL);
41 if ((controller->rx_bytes == xfer->len &&
42 (opflags & QUP_OP_MAX_INPUT_DONE_FLAG)) || error)
45 + spin_lock_irqsave(&controller->lock, flags);
46 + controller->error = error;
47 + controller->xfer = done ? NULL : xfer;
48 + spin_unlock_irqrestore(&controller->lock, flags);
51 complete(&controller->done);
54 @@ -767,7 +771,6 @@ static int spi_qup_transfer_one(struct s
56 spi_qup_set_state(controller, QUP_STATE_RESET);
57 spin_lock_irqsave(&controller->lock, flags);
58 - controller->xfer = NULL;
60 ret = controller->error;
61 spin_unlock_irqrestore(&controller->lock, flags);