diff options
author | Paul Parsons <lost.distance@yahoo.com> | 2012-03-07 09:10:33 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-03-26 19:50:36 -0400 |
commit | 85e5b2f2986310f2f75069c360669f6ce8e2ceb9 (patch) | |
tree | 88a6319d5f5ac32b3d4fedea623626c0da127a5f /drivers/mtd | |
parent | 0c78e93b44f39d4e5dfd4ebfc529cd74ac2a9bbb (diff) |
mtd: chips: cfi_cmdset_0001: 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>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index 920b474a5613..bfee5b3a9217 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -1017,8 +1017,6 @@ static void put_chip(struct map_info *map, struct flchip *chip, unsigned long ad | |||
1017 | case FL_READY: | 1017 | case FL_READY: |
1018 | case FL_STATUS: | 1018 | case FL_STATUS: |
1019 | case FL_JEDEC_QUERY: | 1019 | case FL_JEDEC_QUERY: |
1020 | /* We should really make set_vpp() count, rather than doing this */ | ||
1021 | DISABLE_VPP(map); | ||
1022 | break; | 1020 | break; |
1023 | default: | 1021 | default: |
1024 | printk(KERN_ERR "%s: put_chip() called with oldstate %d!!\n", map->name, chip->oldstate); | 1022 | printk(KERN_ERR "%s: put_chip() called with oldstate %d!!\n", map->name, chip->oldstate); |
@@ -1552,7 +1550,8 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip, | |||
1552 | } | 1550 | } |
1553 | 1551 | ||
1554 | xip_enable(map, chip, adr); | 1552 | xip_enable(map, chip, adr); |
1555 | out: put_chip(map, chip, adr); | 1553 | out: DISABLE_VPP(map); |
1554 | put_chip(map, chip, adr); | ||
1556 | mutex_unlock(&chip->mutex); | 1555 | mutex_unlock(&chip->mutex); |
1557 | return ret; | 1556 | return ret; |
1558 | } | 1557 | } |
@@ -1791,7 +1790,8 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |||
1791 | } | 1790 | } |
1792 | 1791 | ||
1793 | xip_enable(map, chip, cmd_adr); | 1792 | xip_enable(map, chip, cmd_adr); |
1794 | out: put_chip(map, chip, cmd_adr); | 1793 | out: DISABLE_VPP(map); |
1794 | put_chip(map, chip, cmd_adr); | ||
1795 | mutex_unlock(&chip->mutex); | 1795 | mutex_unlock(&chip->mutex); |
1796 | return ret; | 1796 | return ret; |
1797 | } | 1797 | } |
@@ -1928,6 +1928,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, | |||
1928 | ret = -EIO; | 1928 | ret = -EIO; |
1929 | } else if (chipstatus & 0x20 && retries--) { | 1929 | } else if (chipstatus & 0x20 && retries--) { |
1930 | printk(KERN_DEBUG "block erase failed at 0x%08lx: status 0x%lx. Retrying...\n", adr, chipstatus); | 1930 | printk(KERN_DEBUG "block erase failed at 0x%08lx: status 0x%lx. Retrying...\n", adr, chipstatus); |
1931 | DISABLE_VPP(map); | ||
1931 | put_chip(map, chip, adr); | 1932 | put_chip(map, chip, adr); |
1932 | mutex_unlock(&chip->mutex); | 1933 | mutex_unlock(&chip->mutex); |
1933 | goto retry; | 1934 | goto retry; |
@@ -1940,7 +1941,8 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, | |||
1940 | } | 1941 | } |
1941 | 1942 | ||
1942 | xip_enable(map, chip, adr); | 1943 | xip_enable(map, chip, adr); |
1943 | out: put_chip(map, chip, adr); | 1944 | out: DISABLE_VPP(map); |
1945 | put_chip(map, chip, adr); | ||
1944 | mutex_unlock(&chip->mutex); | 1946 | mutex_unlock(&chip->mutex); |
1945 | return ret; | 1947 | return ret; |
1946 | } | 1948 | } |
@@ -2082,7 +2084,8 @@ static int __xipram do_xxlock_oneblock(struct map_info *map, struct flchip *chip | |||
2082 | } | 2084 | } |
2083 | 2085 | ||
2084 | xip_enable(map, chip, adr); | 2086 | xip_enable(map, chip, adr); |
2085 | out: put_chip(map, chip, adr); | 2087 | out: DISABLE_VPP(map); |
2088 | put_chip(map, chip, adr); | ||
2086 | mutex_unlock(&chip->mutex); | 2089 | mutex_unlock(&chip->mutex); |
2087 | return ret; | 2090 | return ret; |
2088 | } | 2091 | } |