From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Date: Sun, 28 Mar 2010 16:51:50 -0500 Subject: [U-Boot] [PATCH 1/4] SPEAr : SMI erase and write timeouts increased In-Reply-To: <1269333012-17821-2-git-send-email-vipin.kumar@st.com> References: <1269333012-17821-1-git-send-email-vipin.kumar@st.com> <1269333012-17821-2-git-send-email-vipin.kumar@st.com> Message-ID: <4BAFCF76.8060105@windriver.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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? > > Signed-off-by: Vipin Kumar > --- > 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? > } > > /* > @@ -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