mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-08-15 09:46:14 -04:00
cfi_mtd: Fix bug in last sector detection
This patch now enabled this cfi-mtd wrapper to correctly detect and erase the last sector in an NOR FLASH device. Signed-off-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
7d6900ebe1
commit
dba6fcf651
@ -43,11 +43,16 @@ static int cfi_mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
|
|||||||
int s_last = -1;
|
int s_last = -1;
|
||||||
int error, sect;
|
int error, sect;
|
||||||
|
|
||||||
for (sect = 0; sect < fi->sector_count - 1; sect++) {
|
for (sect = 0; sect < fi->sector_count; sect++) {
|
||||||
if (a_start == fi->start[sect])
|
if (a_start == fi->start[sect])
|
||||||
s_first = sect;
|
s_first = sect;
|
||||||
|
|
||||||
if (a_end == fi->start[sect + 1]) {
|
if (sect < fi->sector_count - 1) {
|
||||||
|
if (a_end == fi->start[sect + 1]) {
|
||||||
|
s_last = sect;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
s_last = sect;
|
s_last = sect;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user