diff options
Diffstat (limited to 'meta-aspeed/recipes-kernel/linux/files/patch-2.6.28.9/0005-mtd-Bug-in-m25p80.c-during-whole-chip-erase.patch')
-rw-r--r-- | meta-aspeed/recipes-kernel/linux/files/patch-2.6.28.9/0005-mtd-Bug-in-m25p80.c-during-whole-chip-erase.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta-aspeed/recipes-kernel/linux/files/patch-2.6.28.9/0005-mtd-Bug-in-m25p80.c-during-whole-chip-erase.patch b/meta-aspeed/recipes-kernel/linux/files/patch-2.6.28.9/0005-mtd-Bug-in-m25p80.c-during-whole-chip-erase.patch new file mode 100644 index 0000000..e8dd925 --- /dev/null +++ b/meta-aspeed/recipes-kernel/linux/files/patch-2.6.28.9/0005-mtd-Bug-in-m25p80.c-during-whole-chip-erase.patch @@ -0,0 +1,53 @@ +From 3f33b0aaac4e208579fe5aa2964857d4e9ba10c5 Mon Sep 17 00:00:00 2001 +From: "Steven A. Falco" <sfalco@harris.com> +Date: Mon, 27 Apr 2009 17:10:10 -0400 +Subject: [PATCH 05/16] mtd: Bug in m25p80.c during whole-chip erase + +There is a logic error in "whole chip erase" for the m25p80 family. If +the whole device is successfully erased, erase_chip() will return 0, and +the code will fall through to the "else" clause, and do sector-by-sector +erase in addition to the whole-chip erase. This patch corrects that. + +Also, the MAX_READY_WAIT_COUNT is insufficient for an m25p16 connected +to a 400 MHz powerpc. Increasing it allows me to successfully program +the device on my board. + +Signed-off-by: Steven A. Falco <sfalco@harris.com> +Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> +--- + drivers/mtd/devices/m25p80.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c +index 8185b1f..dfadef8 100644 +--- a/drivers/mtd/devices/m25p80.c ++++ b/drivers/mtd/devices/m25p80.c +@@ -54,7 +54,7 @@ + #define SR_SRWD 0x80 /* SR write protect */ + + /* Define max times to check status register before we give up. */ +-#define MAX_READY_WAIT_COUNT 100000 ++#define MAX_READY_WAIT_COUNT 1000000 + #define CMD_SIZE 4 + + #ifdef CONFIG_M25PXX_USE_FAST_READ +@@ -246,10 +246,12 @@ static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr) + mutex_lock(&flash->lock); + + /* whole-chip erase? */ +- if (len == flash->mtd.size && erase_chip(flash)) { +- instr->state = MTD_ERASE_FAILED; +- mutex_unlock(&flash->lock); +- return -EIO; ++ if (len == flash->mtd.size) { ++ if (erase_chip(flash)) { ++ instr->state = MTD_ERASE_FAILED; ++ mutex_unlock(&flash->lock); ++ return -EIO; ++ } + + /* REVISIT in some cases we could speed up erasing large regions + * by using OPCODE_SE instead of OPCODE_BE_4K. We may have set up +-- +1.8.1 + |