]> git.sur5r.net Git - u-boot/commitdiff
cfi: fix the incomplete erased status check in buffer write
authorTao Hou <hotforest@gmail.com>
Thu, 15 Mar 2012 15:33:58 +0000 (23:33 +0800)
committerStefan Roese <sr@denx.de>
Wed, 21 Mar 2012 15:25:33 +0000 (16:25 +0100)
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>
drivers/mtd/cfi_flash.c

index 722c3fc7bdd17a2ef0e1eb3db30678979046f048..35294bc8c53ff37ffb059ac66765c733d71eacef 100644 (file)
@@ -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)) ==