diff options
author | Wolfgang Denk <wd@denx.de> | 2011-03-31 08:59:32 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2011-03-31 08:59:32 +0200 |
commit | 53ce77eef1090e3f4004398c1d2abb410b63235c (patch) | |
tree | cee5ca1c3948bfdc8769c6658ced66bcd775487e /drivers | |
parent | 7ec830d5804337afe19413c3eaedd16583af9076 (diff) | |
parent | af5673015315d069b7e2d64acbbf8b5f5fcc385d (diff) | |
download | u-boot-imx-53ce77eef1090e3f4004398c1d2abb410b63235c.zip u-boot-imx-53ce77eef1090e3f4004398c1d2abb410b63235c.tar.gz u-boot-imx-53ce77eef1090e3f4004398c1d2abb410b63235c.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.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index dd394a8..0909fe7 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -744,8 +744,12 @@ static void flash_add_byte (flash_info_t * info, cfiword_t * cword, uchar c) static flash_sect_t find_sector (flash_info_t * info, ulong addr) { static flash_sect_t saved_sector = 0; /* previously found sector */ + static flash_info_t *saved_info = 0; /* previously used flash bank */ flash_sect_t sector = saved_sector; + if ((info != saved_info) || (sector >= info->sector_count)) + sector = 0; + while ((info->start[sector] < addr) && (sector < info->sector_count - 1)) sector++; @@ -757,6 +761,7 @@ static flash_sect_t find_sector (flash_info_t * info, ulong addr) sector--; saved_sector = sector; + saved_info = info; return sector; } |