[U-Boot-Users] bug in cfi_flash error detection

Tolunay Orkun listmember at orkun.us
Mon Oct 17 20:23:30 CEST 2005


Martin Krause wrote:
> Hi all,
> 
> Here a brief description of what the patch tries to fix:
> 
> - Timeout calculation in flash_status_check():
>   The function calculates seconds instead of miliseconds. 
>   And on some boards the range of ulong is exceeded in the
>   calculation (because CFG_HZ is very big on some boards).
> 
> - In flash_status_check() a bogus error message is printed
>   (secotor number is always 0 and the printed data value is
>   not from the address where the error occours).
> 
> - flash_status_check() uses always the erase block timeout,
>   regardles if eraseing flash or writing flash.
> 
> - If the write timeout of the flash device is below 1 ms
>   it is erroneously calculated to zero.

Some of the issues you are fixing are also fixed my earlier patch in the 
pipeline (from July). See my patch below for items 1,3,4 in your list.

http://sourceforge.net/mailarchive/message.php?msg_id=12234135

I think, in flash_status_check() your patch timeout check is not 
correct. get_timer() returns in msec as well as tout is in msecs. So, 
they are directly comparable without involving CFG_HZ.

I think the full status check needs to be applied to sector 0 
irrespective of what sector you are operating with because this is where 
the flash status register resides. I think some flash ignore the sector 
address while others require sector 0. I would be careful in changing 
this without verifying for a wide range of flash chips. Yes, the sector 
number will be wrong in error if you activate debug outputs but it is 
only cosmetic as far as I can see. Also, finding the sector number each 
time from address is a time consuming search that will slow the flash 
write operation unnecessarily. I am more willing to take the wrong 
sector number in debug output (if enabled) than slowed down status check 
which is used in a number of places.

Best regards,
Tolunay





More information about the U-Boot mailing list