]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
altera_qspi: fix erase and write error code
authorThomas Chou <thomas@wytron.com.tw>
Tue, 1 Dec 2015 08:18:20 +0000 (16:18 +0800)
committerThomas Chou <thomas@wytron.com.tw>
Sun, 6 Dec 2015 03:31:29 +0000 (11:31 +0800)
Fix erase and write error code, which should be "protected".

From the "Embedded Peripherals IP User Guide" of Altera,

The "Illegal write" flag indicates that a write instruction is
targeting a protected sector on the flash memory. This bit is
set to indicate that the IP has cancelled a write instruction.

The "Illegal erase" flag indicates that an erase instruction has
been set to a protected sector on the flash memory. This bit is
set to indicate that the IP has cancelled the erase instruction.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>
Reviewed-by: Marek Vasut <marex@denx.de>
drivers/mtd/altera_qspi.c

index 61a6a5ed9d4b06cbc143ceb7f95687dd711170b3..617bf5d72de36b8f8353c8791e3d16ce9da1b917 100644 (file)
@@ -85,7 +85,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
        instr.len = mtd->erasesize * (s_last + 1 - s_first);
        ret = mtd_erase(mtd, &instr);
        if (ret)
-               return ERR_NOT_ERASED;
+               return ERR_PROTECTED;
 
        return 0;
 }
@@ -102,7 +102,7 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 
        ret = mtd_write(mtd, to, cnt, &retlen, src);
        if (ret)
-               return ERR_NOT_ERASED;
+               return ERR_PROTECTED;
 
        return 0;
 }