[U-Boot] Bug of NOR Flash CFI Driver

Robert Ding solomandy at yahoo.cn
Fri Jan 13 16:57:21 CET 2012


Dear Wolfgang Denk:
I found a bug on NOR Flash CFI drivers during my development. In the file of cfi_flash.c, the function of flash_write_cfibuffer() maybe have a problem.
The process of NOR Flash write buffer program mode in u-boot code is:
flash_unlock_seq(info,0);
flash_write_cmd(info, sector, offset, AMD_CMD_WRITE_TO_BUFFER);
cnt = len >> shift;
flash_write_cmd(info, sector, offset, cnt - 1);
case FLASH_CFI_16BIT:
while (cnt-- > 0) {
flash_write16(flash_read16(src), dst);
src += 2, dst += 2;
}
break;
To which the address of src point is a RAM address, the code is OK. But if it points to a address of the same NOR Flash, the code will cause some problems, which
cannot read the correct data from the NOR Flash.
I check out the datasheet of some Manufacturer of NOR Flash, in which, it describes that if the users want to read the data from the NOR Flash in program process,
it must suspend the program, then read data, and resume to program.
So the function of flash_read16(src) need to be moved to the front of the function flash_unlock_seq(info,0) or add the operation of suspend program and resume program.
Linux CFI drivers use the first process.
I tested the u-boot cfi flash drivers on Manufacturer of Spansion and Numonyx(Micron) which both use the AMD command set. I cannot understand why the Spasion NOR Flash can work well, maybe its hardware is stronger, but the Numonyx(Micron) does have the problem.
I hope u-boot to fix this bug in the new version.
I am looking forward to your reply.
Best regards:
Robert Ding


More information about the U-Boot mailing list