Message ID | 1448960876-22615-2-git-send-email-thomas@wytron.com.tw |
---|---|
State | Accepted, archived |
Delegated to: | Thomas Chou |
Headers | show |
On Tuesday, December 01, 2015 at 10:07:56 AM, Thomas Chou wrote: > 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> Reviewed-by: Marek Vasut <marex@denx.de> Best regards, Marek Vasut
On 2015年12月01日 17:07, Thomas Chou wrote: > 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> > --- > v2 > add description as suggested by Marek. > > drivers/mtd/altera_qspi.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Applied to u-boot-nios.
diff --git a/drivers/mtd/altera_qspi.c b/drivers/mtd/altera_qspi.c index 61a6a5e..617bf5d 100644 --- a/drivers/mtd/altera_qspi.c +++ b/drivers/mtd/altera_qspi.c @@ -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; }
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> --- v2 add description as suggested by Marek. drivers/mtd/altera_qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)