layerscape: add patches-5.4
[openwrt/staging/dedeckeh.git] / target / linux / layerscape / patches-5.4 / 806-dma-0025-MLK-22909-dmaengine-fsl-edma-v3-clear-interrupt-comi.patch
1 From 7021361c27946c60885b3f031ddde342f9a5432f Mon Sep 17 00:00:00 2001
2 From: Robin Gong <yibin.gong@nxp.com>
3 Date: Tue, 5 Nov 2019 21:32:22 +0800
4 Subject: [PATCH] MLK-22909 dmaengine: fsl-edma-v3: clear interrupt coming
5 after channel terminated
6
7 Clear EDMA_CH_INT in case dma done interrupt comes after channel terminated
8 instead of channel free-ed, otherwise, RCU maybe caught because it's
9 ignored without interrupt status cleared as Android team report in Monkey
10 test.
11
12 Signed-off-by: Robin Gong <yibin.gong@nxp.com>
13 Acked-by: Fugang Duan <fugang.duan@nxp.com>
14 (cherry picked from commit ef91ff6ed465cebe2fe6483a480351abba36e237)
15 (cherry picked from commit 56ee55c71c5f3ef254acb4dee581e68f79ef13a5)
16 ---
17 drivers/dma/fsl-edma-v3.c | 8 ++++++--
18 1 file changed, 6 insertions(+), 2 deletions(-)
19
20 --- a/drivers/dma/fsl-edma-v3.c
21 +++ b/drivers/dma/fsl-edma-v3.c
22 @@ -710,8 +710,8 @@ static irqreturn_t fsl_edma3_tx_handler(
23
24 spin_lock(&fsl_chan->vchan.lock);
25
26 - /* Ignore this interrupt since channel has been disabled already */
27 - if (!fsl_chan->edesc)
28 + /* Ignore this interrupt since channel has been freeed with power off */
29 + if (!fsl_chan->edesc && !fsl_chan->tcd_pool)
30 goto irq_handled;
31
32 base_addr = fsl_chan->membase;
33 @@ -722,6 +722,10 @@ static irqreturn_t fsl_edma3_tx_handler(
34
35 writel(1, base_addr + EDMA_CH_INT);
36
37 + /* Ignore this interrupt since channel has been disabled already */
38 + if (!fsl_chan->edesc)
39 + goto irq_handled;
40 +
41 if (!fsl_chan->edesc->iscyclic) {
42 fsl_edma3_get_realcnt(fsl_chan);
43 list_del(&fsl_chan->edesc->vdesc.node);