summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJens Gehrlein <sew_s@tqs.de>2008-12-16 17:25:54 +0100
committerStefan Roese <sr@denx.de>2009-01-26 10:49:59 +0100
commita7292871a79cc48d98e3a708dd3c3b81580db6ef (patch)
treeee61828505b0d7f7d94efb1b041ded89945fc14a /drivers
parent8f86a3636ef88427f880610638e80991adc41896 (diff)
downloadblackbird-obmc-uboot-a7292871a79cc48d98e3a708dd3c3b81580db6ef.tar.gz
blackbird-obmc-uboot-a7292871a79cc48d98e3a708dd3c3b81580db6ef.zip
CFI: avoid redundant function call in single word programming mode
The function find_sector() doesn't need to be called twice in the case of AMD command set. Tested on TQM5200S-BD with Samsung K8P2815UQB. Signed-off-by: Jens Gehrlein <sew_s@tqs.de> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/cfi_flash.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index e8afe9985c..1bd0e2b99a 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -795,7 +795,8 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest,
{
void *dstaddr;
int flag;
- flash_sect_t sect;
+ flash_sect_t sect = 0;
+ char sect_found = 0;
dstaddr = map_physmem(dest, info->portwidth, MAP_NOCACHE);
@@ -840,6 +841,7 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest,
sect = find_sector(info, dest);
flash_unlock_seq (info, sect);
flash_write_cmd (info, sect, info->addr_unlock1, AMD_CMD_WRITE);
+ sect_found = 1;
break;
}
@@ -864,8 +866,10 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest,
unmap_physmem(dstaddr, info->portwidth);
- return flash_full_status_check (info, find_sector (info, dest),
- info->write_tout, "write");
+ if (!sect_found)
+ sect = find_sector (info, dest);
+
+ return flash_full_status_check (info, sect, info->write_tout, "write");
}
#ifdef CONFIG_SYS_FLASH_USE_BUFFER_WRITE
OpenPOWER on IntegriCloud