403-mtd_fix_cfi_cmdset_0002_status_check.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. --- a/drivers/mtd/chips/cfi_cmdset_0002.c
  2. +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
  3. @@ -1632,8 +1632,8 @@ static int __xipram do_write_oneword(str
  4. break;
  5. }
  6. - if (chip_ready(map, adr))
  7. - break;
  8. + if (chip_good(map, adr, datum))
  9. + goto enable_xip;
  10. /* Latency issues. Drop the lock, wait a while and retry */
  11. UDELAY(map, chip, adr, 1);
  12. @@ -1649,6 +1649,8 @@ static int __xipram do_write_oneword(str
  13. ret = -EIO;
  14. }
  15. +
  16. + enable_xip:
  17. xip_enable(map, chip, adr);
  18. op_done:
  19. if (mode == FL_OTP_WRITE)
  20. @@ -2227,7 +2229,6 @@ static int cfi_amdstd_panic_write(struct
  21. return 0;
  22. }
  23. -
  24. /*
  25. * Handle devices with one erase region, that only implement
  26. * the chip erase command.
  27. @@ -2291,8 +2292,8 @@ static int __xipram do_erase_chip(struct
  28. chip->erase_suspended = 0;
  29. }
  30. - if (chip_ready(map, adr))
  31. - break;
  32. + if (chip_good(map, adr, map_word_ff(map)))
  33. + goto op_done;
  34. if (time_after(jiffies, timeo)) {
  35. printk(KERN_WARNING "MTD %s(): software timeout\n",
  36. @@ -2312,6 +2313,7 @@ static int __xipram do_erase_chip(struct
  37. ret = -EIO;
  38. }
  39. + op_done:
  40. chip->state = FL_READY;
  41. xip_enable(map, chip, adr);
  42. DISABLE_VPP(map);
  43. @@ -2380,9 +2382,9 @@ static int __xipram do_erase_oneblock(st
  44. chip->erase_suspended = 0;
  45. }
  46. - if (chip_ready(map, adr)) {
  47. + if (chip_good(map, adr, map_word_ff(map))) {
  48. xip_enable(map, chip, adr);
  49. - break;
  50. + goto op_done;
  51. }
  52. if (time_after(jiffies, timeo)) {
  53. @@ -2404,6 +2406,7 @@ static int __xipram do_erase_oneblock(st
  54. ret = -EIO;
  55. }
  56. + op_done:
  57. chip->state = FL_READY;
  58. DISABLE_VPP(map);
  59. put_chip(map, chip, adr);