cfi-flash: Fix problem in flash_toggle(), busy was not detected reliably

This patch simplifies flash_toggle() (AMD commandset), which is used to
detect if a FLASH device is still busy with erase/program operations. On
800MHz Canyonlands/Glacier boards (460EX/GT) the current implementation
did not detect the busy state reliably, resulting in non erased sectors
etc. This patch now simplifies this function by "just" comparing the
complete data-word instead of ANDing it with the command-word (0x40)
before the compatison. It is done the same way in the Linux implementation
chip_ready() in cfi_cmdset_0002.c.

Signed-off-by: Stefan Roese <sr@denx.de>
This commit is contained in:
Stefan Roese 2008-06-16 10:40:02 +02:00
parent a94f22f08f
commit fb8c061ea0
1 changed files with 4 additions and 8 deletions

View File

@ -581,20 +581,16 @@ static int flash_toggle (flash_info_t * info, flash_sect_t sect,
flash_make_cmd (info, cmd, &cword); flash_make_cmd (info, cmd, &cword);
switch (info->portwidth) { switch (info->portwidth) {
case FLASH_CFI_8BIT: case FLASH_CFI_8BIT:
retval = ((flash_read8(addr) & cword.c) != retval = flash_read8(addr) != flash_read8(addr);
(flash_read8(addr) & cword.c));
break; break;
case FLASH_CFI_16BIT: case FLASH_CFI_16BIT:
retval = ((flash_read16(addr) & cword.w) != retval = flash_read16(addr) != flash_read16(addr);
(flash_read16(addr) & cword.w));
break; break;
case FLASH_CFI_32BIT: case FLASH_CFI_32BIT:
retval = ((flash_read32(addr) & cword.l) != retval = flash_read32(addr) != flash_read32(addr);
(flash_read32(addr) & cword.l));
break; break;
case FLASH_CFI_64BIT: case FLASH_CFI_64BIT:
retval = ((flash_read64(addr) & cword.ll) != retval = flash_read64(addr) != flash_read64(addr);
(flash_read64(addr) & cword.ll));
break; break;
default: default:
retval = 0; retval = 0;