From mboxrd@z Thu Jan 1 00:00:00 1970 From: DENX Support System Date: Sat, 1 Apr 2006 00:20:28 +0200 Subject: [DNX#2006040142000651] [U-Boot-Users] [PATCH] CFI: fix timeout calculatio [...] Message-ID: <1143843628.901198.498918816@castor.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello list, inside the automatic U-Boot patch tracking system a new ticket [DNX#2006040142000651] was created: > This patch fixes two problems with the cfi_flash timeout handling: > 1) Correctly handle the cases where CFG_HZ != 1000 (several XScale-based > boards) > 2) Fix the timeout calculation of buffered writes (off by a factor of > 1000) > > Additionally, the patch trivially removes a redundant call of getenv() > > Signed-off-by: Anders Larsen > > --- > > drivers/cfi_flash.c | 11 ++++++++--- > 1 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/cfi_flash.c b/drivers/cfi_flash.c > index a989d34..c7c9983 100644 > --- a/drivers/cfi_flash.c > +++ b/drivers/cfi_flash.c > @@ -360,7 +360,7 @@ #ifdef CFG_FLASH_PROTECTION > else { > char *s = getenv("unlock"); > > - if (((s = getenv("unlock")) != NULL) && (strcmp(s, "yes") == 0)) { > + if ((s != NULL) && (strcmp(s, "yes") == 0)) { > /* > * Only the U-Boot image and it's environment is protected, > * all other sectors are unprotected (unlocked) if flash > @@ -746,6 +746,10 @@ static int flash_status_check (flash_inf > { > ulong start; > > +#if CFG_HZ != 1000 > + tout *= CFG_HZ/1000; > +#endif > + > /* Wait for command completion */ > start = get_timer (0); > while (flash_is_busy (info, sector)) { > @@ -1160,8 +1164,9 @@ #endif > info->buffer_size = (1 << flash_read_ushort (info, 0, > FLASH_OFFSET_BUFFER_SIZE)); > tmp = 1 << flash_read_uchar (info, FLASH_OFFSET_ETOUT); > info->erase_blk_tout = (tmp * (1 << flash_read_uchar (info, > FLASH_OFFSET_EMAX_TOUT))); > - tmp = 1 << flash_read_uchar (info, FLASH_OFFSET_WBTOUT); > - info->buffer_write_tout = (tmp * (1 << flash_read_uchar (info, > FLASH_OFFSET_WBMAX_TOUT))); > + tmp = (1 << flash_read_uchar (info, FLASH_OFFSET_WBTOUT)) * > + (1 << flash_read_uchar (info, FLASH_OFFSET_WBMAX_TOUT)); > + info->buffer_write_tout = tmp / 1000 + (tmp % 1000 ? 1 : 0); /* round > up when converting to ms */ > tmp = (1 << flash_read_uchar (info, FLASH_OFFSET_WTOUT)) * > (1 << flash_read_uchar (info, FLASH_OFFSET_WMAX_TOUT)); > info->write_tout = tmp / 1000 + (tmp % 1000 ? 1 : 0); /* round up > when converting to ms */ > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting > language > that extends applications into web and mobile media. Attend the live > webcast > and join the prime developer group breaking into this new coding > territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 > _______________________________________________ > U-Boot-Users mailing list > U-Boot-Users at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/u-boot-users Your U-Boot support team