public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Vipin KUMAR <vipin.kumar@st.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] SPEAr : SMI erase and write timeouts increased
Date: Mon, 29 Mar 2010 09:28:09 +0530	[thread overview]
Message-ID: <4BB02551.9010503@st.com> (raw)
In-Reply-To: <4BAFCF76.8060105@windriver.com>

On 3/29/2010 3:21 AM, Tom wrote:
> Vipin KUMAR wrote:
>> SMI driver fails because of low timeout values. Increasing the erase
>> and write
>> timeouts to 3 seconds
> 
> This is a huge timeout change.
> 2ms to 3000ms.
> If something goes wrong, it will seem like the board is hung.
> Is this ok?
> 

2ms timeout itself was a mistake. 3 sec is OK. Offcourse, 3 secs are
required only when something goes wrong

>>
>> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
>> ---
>>  drivers/mtd/spr_smi.c                |    8 ++++----
>>  include/asm-arm/arch-spear/spr_smi.h |    6 +++---
>>  2 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/mtd/spr_smi.c b/drivers/mtd/spr_smi.c
>> index 9a70a19..189ee6d 100755
>> --- a/drivers/mtd/spr_smi.c
>> +++ b/drivers/mtd/spr_smi.c
>> @@ -60,11 +60,11 @@ static struct flash_dev flash_ids[] = {
>>   */
>>  static void smi_wait_xfer_finish(int timeout)
>>  {
>> -    while (timeout--) {
>> +    do {
>>          if (readl(&smicntl->smi_sr) & TFF)
>>              break;
>>          udelay(1000);
>> -    }
>> +    } while (timeout--);
> 
> This changes the function to wait at least 1ms even if timeout == 0.
> Why was the original logic changed?
> 

Earlier a value of 2 was reading the status register only once. This I
felt is more appropriate since the status register is read every ms and
at least once.

>>  }
>>  
>>  /*
>> @@ -215,11 +215,11 @@ static int smi_write_enable(int bank)
>>      /* Restore the CTRL REG1 state */
>>      writel(ctrlreg1, &smicntl->smi_cr1);
>>  
>> -    while (timeout--) {
>> +    do {
>>          if (smi_read_sr(bank) & (1 << (bank + WM_SHIFT)))
>>              break;
>>          udelay(1000);
>> -    }
>> +    } while (timeout--);
>>  
>>      if (timeout)
>>          return 0;
>> diff --git a/include/asm-arm/arch-spear/spr_smi.h
>> b/include/asm-arm/arch-spear/spr_smi.h
>> index 06df745..e2e5e8f 100755
>> --- a/include/asm-arm/arch-spear/spr_smi.h
>> +++ b/include/asm-arm/arch-spear/spr_smi.h
>> @@ -108,8 +108,8 @@ struct flash_dev {
>>      ushort sector_count;
>>  };
>>  
>> -#define SFLASH_PAGE_SIZE    0x100    /* flash page size */
>> -#define XFER_FINISH_TOUT    2    /* xfer finish timeout */
>> -#define WMODE_TOUT        2    /* write enable timeout */
>> +#define SFLASH_PAGE_SIZE    0x100        /* flash page size */
>> +#define XFER_FINISH_TOUT    (3 * CONFIG_SYS_HZ)
>> +#define WMODE_TOUT        (3 * CONFIG_SYS_HZ)
>>  
>>  #endif
> 
> Tom
> 

  reply	other threads:[~2010-03-29  3:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23  8:30 [U-Boot] [PATCH 0/4] SPEAr : Network support and misc changes Vipin KUMAR
2010-03-23  8:30 ` [U-Boot] [PATCH 1/4] SPEAr : SMI erase and write timeouts increased Vipin KUMAR
2010-03-23  8:30   ` [U-Boot] [PATCH 2/4] SPEAr : Placing ethaddr write and read within CONFIG_CMD_NET Vipin KUMAR
2010-03-23  8:30     ` [U-Boot] [PATCH 3/4] SPEAr : Network driver support added Vipin KUMAR
2010-03-23  8:30       ` [U-Boot] [PATCH 4/4] SPEAr : macb driver support added for spear310 and spear320 Vipin KUMAR
2010-03-28 22:40         ` Tom
2010-03-29  4:05           ` Vipin KUMAR
2010-03-23 17:39       ` [U-Boot] [PATCH 3/4] SPEAr : Network driver support added Ben Warren
2010-03-25  4:48         ` Vipin KUMAR
2010-03-25  5:43           ` Ben Warren
2010-03-28 22:38     ` [U-Boot] [PATCH 2/4] SPEAr : Placing ethaddr write and read within CONFIG_CMD_NET Tom
2010-03-29  3:58       ` Vipin KUMAR
2010-03-28 21:51   ` [U-Boot] [PATCH 1/4] SPEAr : SMI erase and write timeouts increased Tom
2010-03-29  3:58     ` Vipin KUMAR [this message]
2010-03-29 12:37       ` Tom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BB02551.9010503@st.com \
    --to=vipin.kumar@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox