mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-07-24 03:49:43 +09:00
Merge branch 'master' of git://git.denx.de/u-boot-cfi-flash
This commit is contained in:
commit
53ce77eef1
@ -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 find_sector (flash_info_t * info, ulong addr)
|
||||||
{
|
{
|
||||||
static flash_sect_t saved_sector = 0; /* previously found sector */
|
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;
|
flash_sect_t sector = saved_sector;
|
||||||
|
|
||||||
|
if ((info != saved_info) || (sector >= info->sector_count))
|
||||||
|
sector = 0;
|
||||||
|
|
||||||
while ((info->start[sector] < addr)
|
while ((info->start[sector] < addr)
|
||||||
&& (sector < info->sector_count - 1))
|
&& (sector < info->sector_count - 1))
|
||||||
sector++;
|
sector++;
|
||||||
@ -757,6 +761,7 @@ static flash_sect_t find_sector (flash_info_t * info, ulong addr)
|
|||||||
sector--;
|
sector--;
|
||||||
|
|
||||||
saved_sector = sector;
|
saved_sector = sector;
|
||||||
|
saved_info = info;
|
||||||
return sector;
|
return sector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user