UPSTREAM: mtd: rawnand: denali: fix a race condition when DMA is kicked

Based on Linux commit cf51e4b9c34407bf0c3d9b582b7837e047e1df47

Add the register read-back, commenting why this is necessary.

Change-Id: I37833cf64255f4b3eb955b74c571889435d4f243
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
(cherry picked from commit 9d43649a7740cf715c750929d19661a35144e7d1)
This commit is contained in:
Masahiro Yamada 2018-12-19 20:03:19 +09:00 committed by Kever Yang
parent 3d00936c5e
commit a27f458bd5
1 changed files with 6 additions and 0 deletions

View File

@ -588,6 +588,12 @@ static int denali_dma_xfer(struct denali_nand_info *denali, void *buf,
}
iowrite32(DMA_ENABLE__FLAG, denali->reg + DMA_ENABLE);
/*
* The ->setup_dma() hook kicks DMA by using the data/command
* interface, which belongs to a different AXI port from the
* register interface. Read back the register to avoid a race.
*/
ioread32(denali->reg + DMA_ENABLE);
denali_reset_irq(denali);
denali->setup_dma(denali, dma_addr, page, write);