summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2008-10-13 14:18:38 +0200
committerWolfgang Denk <wd@denx.de>2008-10-13 14:18:38 +0200
commitb3ed233198c5ac54aa83dd51f05fcb44ee75f42b (patch)
tree15890102135f69969ba2d8710c84b1cf3805ce87 /drivers
parent392438406041415fe64ab8748ec5ab5ad01d1cf7 (diff)
parent0d01f66d235118515b5086b88f82498bc0695d6a (diff)
downloadu-boot-imx-b3ed233198c5ac54aa83dd51f05fcb44ee75f42b.zip
u-boot-imx-b3ed233198c5ac54aa83dd51f05fcb44ee75f42b.tar.gz
u-boot-imx-b3ed233198c5ac54aa83dd51f05fcb44ee75f42b.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-cfi-flash
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/cfi_flash.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 72d063a..7bfdc43 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -681,7 +681,7 @@ static int flash_full_status_check (flash_info_t * info, flash_sect_t sector,
case CFI_CMDSET_INTEL_PROG_REGIONS:
case CFI_CMDSET_INTEL_EXTENDED:
case CFI_CMDSET_INTEL_STANDARD:
- if ((retcode == ERR_OK)
+ if ((retcode != ERR_OK)
&& !flash_isequal (info, sector, 0, FLASH_STATUS_DONE)) {
retcode = ERR_INVAL;
printf ("Flash %s error at address %lx\n", prompt,
@@ -777,6 +777,7 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest,
{
void *dstaddr;
int flag;
+ flash_sect_t sect;
dstaddr = map_physmem(dest, info->portwidth, MAP_NOCACHE);
@@ -818,8 +819,9 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest,
#ifdef CONFIG_FLASH_CFI_LEGACY
case CFI_CMDSET_AMD_LEGACY:
#endif
- flash_unlock_seq (info, 0);
- flash_write_cmd (info, 0, info->addr_unlock1, AMD_CMD_WRITE);
+ sect = find_sector(info, dest);
+ flash_unlock_seq (info, sect);
+ flash_write_cmd (info, sect, info->addr_unlock1, AMD_CMD_WRITE);
break;
}