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