Commit e7d9377e0440c25805dcc5b0af189a87beb69f5e

Authored by Paul Parsons
Committed by David Woodhouse
1 parent 85e5b2f298

mtd: chips: cfi_cmdset_0002: Match ENABLE_VPP()/DISABLE_VPP() calls

This patch is part of a set which fixes unnecessary flash erase and write errors
resulting from the MTD CFI driver turning off vpp while an erase is in progress.
This patch ensures that only those flash operations which call ENABLE_VPP() can
then call DISABLE_VPP(). Other operations should never call DISABLE_VPP().

Signed-off-by: Paul Parsons <lost.distance@yahoo.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff

drivers/mtd/chips/cfi_cmdset_0002.c
... ... @@ -774,8 +774,6 @@
774 774  
775 775 case FL_READY:
776 776 case FL_STATUS:
777   - /* We should really make set_vpp() count, rather than doing this */
778   - DISABLE_VPP(map);
779 777 break;
780 778 default:
781 779 printk(KERN_ERR "MTD: put_chip() called with oldstate %d!!\n", chip->oldstate);
... ... @@ -1229,6 +1227,7 @@
1229 1227 xip_enable(map, chip, adr);
1230 1228 op_done:
1231 1229 chip->state = FL_READY;
  1230 + DISABLE_VPP(map);
1232 1231 put_chip(map, chip, adr);
1233 1232 mutex_unlock(&chip->mutex);
1234 1233  
... ... @@ -1467,6 +1466,7 @@
1467 1466 ret = -EIO;
1468 1467 op_done:
1469 1468 chip->state = FL_READY;
  1469 + DISABLE_VPP(map);
1470 1470 put_chip(map, chip, adr);
1471 1471 mutex_unlock(&chip->mutex);
1472 1472  
... ... @@ -1868,6 +1868,7 @@
1868 1868  
1869 1869 chip->state = FL_READY;
1870 1870 xip_enable(map, chip, adr);
  1871 + DISABLE_VPP(map);
1871 1872 put_chip(map, chip, adr);
1872 1873 mutex_unlock(&chip->mutex);
1873 1874  
... ... @@ -1958,6 +1959,7 @@
1958 1959 }
1959 1960  
1960 1961 chip->state = FL_READY;
  1962 + DISABLE_VPP(map);
1961 1963 put_chip(map, chip, adr);
1962 1964 mutex_unlock(&chip->mutex);
1963 1965 return ret;