dd4bad344bc34aab5ad28d18a7ebc3f6659ea5cb
[openwrt/openwrt.git] / target / linux / ipq806x / patches-4.4 / 711-spi-qup-Fix-transaction-done-signaling.patch
1 From 8e830bd17e945e74964a5b61353d74e34c0791cd Mon Sep 17 00:00:00 2001
2 From: Andy Gross <andy.gross@linaro.org>
3 Date: Fri, 29 Jan 2016 22:06:50 -0600
4 Subject: [PATCH] spi: qup: Fix transaction done signaling
5
6 Wait to signal done until we get all of the interrupts we are expecting
7 to get for a transaction. If we don't wait for the input done flag, we
8 can be inbetween transactions when the done flag comes in and this can
9 mess up the next transaction.
10
11 Change-Id: I08d78376e71590663158d6434a3fb7c0623264c9
12 CC: Grant Grundler <grundler@chromium.org>
13 CC: Sarthak Kukreti <skukreti@codeaurora.org>
14 Signed-off-by: Andy Gross <andy.gross@linaro.org>
15 ---
16 drivers/spi/spi-qup.c | 3 ++-
17 1 file changed, 2 insertions(+), 1 deletion(-)
18
19 diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
20 index 714fd4e..fe629f2 100644
21 --- a/drivers/spi/spi-qup.c
22 +++ b/drivers/spi/spi-qup.c
23 @@ -447,7 +447,8 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id)
24 controller->xfer = xfer;
25 spin_unlock_irqrestore(&controller->lock, flags);
26
27 - if (controller->rx_bytes == xfer->len || error)
28 + if ((controller->rx_bytes == xfer->len &&
29 + (opflags & QUP_OP_MAX_INPUT_DONE_FLAG)) || error)
30 complete(&controller->done);
31
32 return IRQ_HANDLED;
33 --
34 2.7.2
35