110-pxa3xxx_nand-handle-PIO-delays.patch 1.0 KB

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