[U-Boot-Users] [PATCH] CFI support for Versatile & Integrator/CP boards

Tolunay Orkun
2006-02-28T19:21:04Z

Stefan Roese wrote:

>>- Changes flash_full_status_check() to test for timeout OR failure,
>> rather than timeout AND failure.
>
> I'm not sure here. Please take a look at the patch from Marcus Hall:
>
> http://article.gmane.org/gmane.comp.boot-loaders.u-boot/18530
>
> Could you and others (Marcus, Tolunay) please comment on what patch should be
> applied here. I tend to take the patch from Marcus right now.

I looked at the Stephan's patch to this (which I had included in my
alternative patch as well) as well as Marcus's patch.

Yes, flash_status_check() exists only with ERR_OK or ERR_TIMEOUT. ERR_OK
is really mapping to not busy in that context (yet operation might have
failed).

Marcus's patch checks the extended status register if flush was not busy
with last operation (ERR_OK) and identifies the error of extended status
indicates an error. Stephan's patch does not care about busy status (if
the flash is not busy the real status is in extended status register)
but also redirects the ERR_TIMEOUT case to the if branch which gets
mapped ERR_INVAL (probably not right).

I now think Marcus patch is preferable but it would also be better to
inform on the console regarding timeout case as well. Also since
flash_status_check() did reset the flash for timeout (contrary to its
description) we should not be resetting the flash second time here.

I mean we should have something like the following instead:

case CFI_CMDSET_INTEL_EXTENDED:
case CFI_CMDSET_INTEL_STANDARD:
if ((retcode == ERR_TIMOUT) {
printf ("Flash %s timeout at address %lx\n", prompt,
info->start[sector]);
/* break out, flash_status_check() performed reset already */
break;
}
if (!flash_isequal (info, sector, 0, FLASH_STATUS_DONE)) {
retcode = ERR_INVAL;
printf ("Flash %s error at address %lx\n", prompt,
info->start[sector]);
if (flash_isset (info, sector, 0, FLASH_STATUS_ECLBS |
FLASH_STATUS_PSLBS)) {
puts ("Command Sequence Error.\n");
} else if (flash_isset (info, sector, 0, FLASH_STATUS_ECLBS)) {
puts ("Block Erase Error.\n");
retcode = ERR_NOT_ERASED;
} else if (flash_isset (info, sector, 0, FLASH_STATUS_PSLBS)) {
puts ("Locking Error\n");
}
if (flash_isset (info, sector, 0, FLASH_STATUS_DPS)) {
puts ("Block locked.\n");
retcode = ERR_PROTECTED;
}
if (flash_isset (info, sector, 0, FLASH_STATUS_VPENS))
puts ("Vpp Low Error.\n");
}
flash_write_cmd (info, sector, 0, FLASH_CMD_RESET);
break;

Best regards,
Tolunay