Skip to content

Commit 551b307

Browse files
author
Charanya Venkatraman
committed
OpenWRT: 403-mtd_fix_cfi_cmdset_0002_status_check.patch
Change-Id: I7805885a6fa7340441b685261527f0542a76c69b
1 parent b61ed0d commit 551b307

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

drivers/mtd/chips/cfi_cmdset_0002.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,8 +1632,8 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip,
16321632
break;
16331633
}
16341634

1635-
if (chip_ready(map, adr))
1636-
break;
1635+
if (chip_good(map, adr, datum))
1636+
goto enable_xip;
16371637

16381638
/* Latency issues. Drop the lock, wait a while and retry */
16391639
UDELAY(map, chip, adr, 1);
@@ -1649,6 +1649,8 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip,
16491649

16501650
ret = -EIO;
16511651
}
1652+
1653+
enable_xip:
16521654
xip_enable(map, chip, adr);
16531655
op_done:
16541656
if (mode == FL_OTP_WRITE)
@@ -2227,7 +2229,6 @@ static int cfi_amdstd_panic_write(struct mtd_info *mtd, loff_t to, size_t len,
22272229
return 0;
22282230
}
22292231

2230-
22312232
/*
22322233
* Handle devices with one erase region, that only implement
22332234
* the chip erase command.
@@ -2291,8 +2292,8 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip)
22912292
chip->erase_suspended = 0;
22922293
}
22932294

2294-
if (chip_ready(map, adr))
2295-
break;
2295+
if (chip_good(map, adr, map_word_ff(map)))
2296+
goto op_done;
22962297

22972298
if (time_after(jiffies, timeo)) {
22982299
printk(KERN_WARNING "MTD %s(): software timeout\n",
@@ -2312,6 +2313,7 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip)
23122313
ret = -EIO;
23132314
}
23142315

2316+
op_done:
23152317
chip->state = FL_READY;
23162318
xip_enable(map, chip, adr);
23172319
DISABLE_VPP(map);
@@ -2380,9 +2382,9 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,
23802382
chip->erase_suspended = 0;
23812383
}
23822384

2383-
if (chip_ready(map, adr)) {
2385+
if (chip_good(map, adr, map_word_ff(map))) {
23842386
xip_enable(map, chip, adr);
2385-
break;
2387+
goto op_done;
23862388
}
23872389

23882390
if (time_after(jiffies, timeo)) {
@@ -2404,6 +2406,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,
24042406
ret = -EIO;
24052407
}
24062408

2409+
op_done:
24072410
chip->state = FL_READY;
24082411
DISABLE_VPP(map);
24092412
put_chip(map, chip, adr);

0 commit comments

Comments
 (0)