110-pxa3xxx_revert_irq_thread.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. Revert "mtd: pxa3xx-nand: handle PIO in threaded interrupt"
  2. This reverts commit 24542257a3b987025d4b998ec2d15e556c98ad3f
  3. This upstream change has been causing spurious timeouts on accesses
  4. to the NAND flash if something else on the system is causing
  5. significant latency.
  6. Nothing guarantees that the thread will run in time, so the
  7. usual timeout is unreliable.
  8. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  9. --- a/drivers/mtd/nand/pxa3xx_nand.c
  10. +++ b/drivers/mtd/nand/pxa3xx_nand.c
  11. @@ -765,24 +765,11 @@ static void start_data_dma(struct pxa3xx
  12. __func__, direction, info->dma_cookie, info->sg.length);
  13. }
  14. -static irqreturn_t pxa3xx_nand_irq_thread(int irq, void *data)
  15. -{
  16. - struct pxa3xx_nand_info *info = data;
  17. -
  18. - handle_data_pio(info);
  19. -
  20. - info->state = STATE_CMD_DONE;
  21. - nand_writel(info, NDSR, NDSR_WRDREQ | NDSR_RDDREQ);
  22. -
  23. - return IRQ_HANDLED;
  24. -}
  25. -
  26. static irqreturn_t pxa3xx_nand_irq(int irq, void *devid)
  27. {
  28. struct pxa3xx_nand_info *info = devid;
  29. unsigned int status, is_completed = 0, is_ready = 0;
  30. unsigned int ready, cmd_done;
  31. - irqreturn_t ret = IRQ_HANDLED;
  32. if (info->cs == 0) {
  33. ready = NDSR_FLASH_RDY;
  34. @@ -824,8 +811,7 @@ static irqreturn_t pxa3xx_nand_irq(int i
  35. } else {
  36. info->state = (status & NDSR_RDDREQ) ?
  37. STATE_PIO_READING : STATE_PIO_WRITING;
  38. - ret = IRQ_WAKE_THREAD;
  39. - goto NORMAL_IRQ_EXIT;
  40. + handle_data_pio(info);
  41. }
  42. }
  43. if (status & cmd_done) {
  44. @@ -870,7 +856,7 @@ static irqreturn_t pxa3xx_nand_irq(int i
  45. if (is_ready)
  46. complete(&info->dev_ready);
  47. NORMAL_IRQ_EXIT:
  48. - return ret;
  49. + return IRQ_HANDLED;
  50. }
  51. static inline int is_buf_blank(uint8_t *buf, size_t len)
  52. @@ -1849,9 +1835,7 @@ static int alloc_nand_resource(struct pl
  53. /* initialize all interrupts to be disabled */
  54. disable_int(info, NDSR_MASK);
  55. - ret = request_threaded_irq(irq, pxa3xx_nand_irq,
  56. - pxa3xx_nand_irq_thread, IRQF_ONESHOT,
  57. - pdev->name, info);
  58. + ret = request_irq(irq, pxa3xx_nand_irq, 0, pdev->name, info);
  59. if (ret < 0) {
  60. dev_err(&pdev->dev, "failed to request IRQ\n");
  61. goto fail_free_buf;