From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vipin KUMAR Date: Tue, 04 May 2010 09:13:42 +0530 Subject: [U-Boot] [PATCH v2 03/17] SPEAr : SMI erase and write timeouts increased In-Reply-To: <4BDE0BE2.2070904@bumblecow.com> References: <1272250610-15439-1-git-send-email-vipin.kumar@st.com> <1272250610-15439-2-git-send-email-vipin.kumar@st.com> <1272250610-15439-3-git-send-email-vipin.kumar@st.com> <1272250610-15439-4-git-send-email-vipin.kumar@st.com> <4BDE0BE2.2070904@bumblecow.com> Message-ID: <4BDF97EE.6020302@st.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 5/3/2010 5:03 AM, Tom Rix wrote: > Vipin KUMAR wrote: >> SMI driver fails because of low timeout values. Increasing the erase >> and write >> timeouts to 3 seconds >> >> Signed-off-by: Vipin Kumar >> --- >> arch/arm/include/asm/arch-spear/spr_smi.h | 6 +++--- >> drivers/mtd/spr_smi.c | 8 ++++---- >> 2 files changed, 7 insertions(+), 7 deletions(-) >> >> diff --git a/arch/arm/include/asm/arch-spear/spr_smi.h >> b/arch/arm/include/asm/arch-spear/spr_smi.h >> index 06df745..e2e5e8f 100644 >> --- a/arch/arm/include/asm/arch-spear/spr_smi.h >> +++ b/arch/arm/include/asm/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) >> > > Restore the comments for xfer and write timeouts OK >> #endif >> diff --git a/drivers/mtd/spr_smi.c b/drivers/mtd/spr_smi.c >> index 9a70a19..189ee6d 100644 >> --- 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--); >> } >> > > Earlier (Jan 11), I recommended that if there is timeout, that this is a > failure > The status of the failure must be passed up. > > smi_write_enable checks the timeout > smi_read_id, smi_read_sr does not > Mistake. It should have been done already. Please find these changes in v3 patch > Why was the logic for the loops changed? > If you want to change the logic, you should also change > smi_wait_till_ready to be consistent. OK. Please find the changes in v3 > Tom > >> /* >> @@ -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; > >