mvebu: add a patch to deal with excessive latencies/delays during flash PIO command...
[openwrt/openwrt.git] / target / linux / mvebu / patches-4.4 / 110-pxa3xxx_nand-handle-PIO-delays.patch
1 Handle delays/excessive latency during flash command processing with PIO.
2
3 Signed-off-by: Felix Fietkau <nbd@nbd.name>
4
5 --- a/drivers/mtd/nand/pxa3xx_nand.c
6 +++ b/drivers/mtd/nand/pxa3xx_nand.c
7 @@ -227,6 +227,7 @@ struct pxa3xx_nand_info {
8 int use_dma; /* use DMA ? */
9 int use_spare; /* use spare ? */
10 int need_wait;
11 + int pio_progress;
12
13 /* Amount of real data per full chunk */
14 unsigned int chunk_size;
15 @@ -769,6 +770,7 @@ static irqreturn_t pxa3xx_nand_irq_threa
16 {
17 struct pxa3xx_nand_info *info = data;
18
19 + info->pio_progress = 1;
20 handle_data_pio(info);
21
22 info->state = STATE_CMD_DONE;
23 @@ -1175,8 +1177,13 @@ static void nand_cmdfunc(struct mtd_info
24 info->need_wait = 1;
25 pxa3xx_nand_start(info);
26
27 +retry:
28 + info->pio_progress = 0;
29 if (!wait_for_completion_timeout(&info->cmd_complete,
30 CHIP_DELAY_TIMEOUT)) {
31 + if (info->pio_progress)
32 + goto retry;
33 +
34 dev_err(&info->pdev->dev, "Wait time out!!!\n");
35 /* Stop State Machine for next command cycle */
36 pxa3xx_nand_stop(info);