kernel: bump 4.14 to 4.14.125 (FS#2305 FS#2297)
[oweals/openwrt.git] / target / linux / ath79 / patches-4.14 / 403-mtd_fix_cfi_cmdset_0002_status_check.patch
1 --- a/drivers/mtd/chips/cfi_cmdset_0002.c
2 +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
3 @@ -1635,8 +1635,8 @@ static int __xipram do_write_oneword(str
4                         break;
5                 }
6  
7 -               if (chip_ready(map, adr))
8 -                       break;
9 +               if (chip_good(map, adr, datum))
10 +                       goto enable_xip;
11  
12                 /* Latency issues. Drop the lock, wait a while and retry */
13                 UDELAY(map, chip, adr, 1);
14 @@ -1652,6 +1652,8 @@ static int __xipram do_write_oneword(str
15  
16                 ret = -EIO;
17         }
18 +
19 + enable_xip:
20         xip_enable(map, chip, adr);
21   op_done:
22         if (mode == FL_OTP_WRITE)
23 @@ -2230,7 +2232,6 @@ static int cfi_amdstd_panic_write(struct
24         return 0;
25  }
26  
27 -
28  /*
29   * Handle devices with one erase region, that only implement
30   * the chip erase command.
31 @@ -2298,7 +2299,7 @@ static int __xipram do_erase_chip(struct
32                 }
33  
34                 if (chip_good(map, adr, map_word_ff(map)))
35 -                       break;
36 +                       goto op_done;
37  
38                 if (time_after(jiffies, timeo)) {
39                         printk(KERN_WARNING "MTD %s(): software timeout\n",
40 @@ -2322,6 +2323,7 @@ static int __xipram do_erase_chip(struct
41                 }
42         }
43  
44 + op_done:
45         chip->state = FL_READY;
46         xip_enable(map, chip, adr);
47         DISABLE_VPP(map);
48 @@ -2395,7 +2397,7 @@ static int __xipram do_erase_oneblock(st
49  
50                 if (chip_good(map, adr, map_word_ff(map))) {
51                         xip_enable(map, chip, adr);
52 -                       break;
53 +                       goto op_done;
54                 }
55  
56                 if (time_after(jiffies, timeo)) {
57 @@ -2421,6 +2423,7 @@ static int __xipram do_erase_oneblock(st
58                 }
59         }
60  
61 + op_done:
62         chip->state = FL_READY;
63         DISABLE_VPP(map);
64         put_chip(map, chip, adr);