[U-Boot-Users] PATCH for drivers/cfi_flash.c
Andrew Dyer
amdyer at gmail.com
Sun May 29 00:15:33 CEST 2005
On 5/6/05, Tolunay Orkun <listmember at orkun.us> wrote:
> This patch is prepared against current CVS:
>
> * Patch by Tolunay Orkun, 06 May 2005:
> Fixes for drivers/cfi_flash.c:
> - Fix wrong timeout value usage in flash_status_check()
I tried this part of this patch out and aggravated some problems in
the cfi_flash code.
Several of the timeout parameters in the CFI query structure return units of
microseconds. I use an AMD 29LV160 part. In the CFI parser code these
microsecond values are converted to milliseconds by integer division. For
the 29LV160 this leaves some of the timeout parameters in the info structure
at zero.
Using these zero values, the code in flash_status_check() will sometimes read
busy once, the timer count happens to roll over, get read, and a timeout is
registered if tout is zero.
I can see a few ways to fix this:
1) adjust the info values after the scaling to millisecond values
2) force a one tick delay no matter what in flash_status_check()
3) modify the code to report everything in microseconds and use udelay
4) use set_timer() to make sure there is a full timer tick
Any opinions about the best way to fix this? Or is it fixed in someones patch
already?
===================================================================
> RCS file: /cvsroot/u-boot/u-boot/drivers/cfi_flash.c,v
> retrieving revision 1.17
> diff -p -u -r1.17 cfi_flash.c
> --- drivers/cfi_flash.c 13 Apr 2005 10:02:47 -0000 1.17
> +++ drivers/cfi_flash.c 6 May 2005 07:06:04 -0000
> @@ -676,7 +676,7 @@ static int flash_status_check (flash_inf
> /* Wait for command completion */
> start = get_timer (0);
> while (flash_is_busy (info, sector)) {
> - if (get_timer (start) > info->erase_blk_tout * CFG_HZ) {
> + if (get_timer (start) > tout * CFG_HZ) {
> printf ("Flash %s timeout at address %lx data %lx\n",
> prompt, info->start[sector],
> flash_read_long (info, sector, 0));
--
Hardware, n.:
The parts of a computer system that can be kicked.
More information about the U-Boot
mailing list