summaryrefslogtreecommitdiff
path: root/drivers/mtd/cfi_flash.c
diff options
context:
space:
mode:
authorTao Hou <hotforest@gmail.com>2012-03-15 23:33:58 +0800
committerStefan Roese <sr@denx.de>2012-03-21 16:25:33 +0100
commit85c344e5f98408c0bcf988a6c6fca68c1f3c2015 (patch)
tree680bde6c373aa08a83bfbc19143f65772ac06036 /drivers/mtd/cfi_flash.c
parentdbb87bbd8eff11cf974caa2b5cc397aea444bc5a (diff)
downloadu-boot-imx-85c344e5f98408c0bcf988a6c6fca68c1f3c2015.zip
u-boot-imx-85c344e5f98408c0bcf988a6c6fca68c1f3c2015.tar.gz
u-boot-imx-85c344e5f98408c0bcf988a6c6fca68c1f3c2015.tar.bz2
cfi: fix the incomplete erased status check in buffer write
Without the fix, flash_write_cfibuffer will terminate the erased status check once an all-0xFF word has been found instead of continuing the erased status check utill the first non-0xFF word. Signed-off-by: Tao Hou <hotforest@gmail.com> Cc: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/mtd/cfi_flash.c')
-rw-r--r--drivers/mtd/cfi_flash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 722c3fc..35294bc 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -873,7 +873,7 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp,
void *src = cp;
void *dst = (void *)dest;
void *dst2 = dst;
- int flag = 0;
+ int flag = 1;
uint offset = 0;
unsigned int shift;
uchar write_cmd;
@@ -898,7 +898,7 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp,
cnt = len >> shift;
- while ((cnt-- > 0) && (flag == 0)) {
+ while ((cnt-- > 0) && (flag == 1)) {
switch (info->portwidth) {
case FLASH_CFI_8BIT:
flag = ((flash_read8(dst2) & flash_read8(src)) ==