From: Vipin Kumar Date: Mon, 7 May 2012 07:30:25 +0000 (+0530) Subject: st_smi: Fix smi read status X-Git-Tag: v2012.07-rc1~11^2~46 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a5ad7ccd74de244f91d75fb3879eaa1929304e89;p=oweals%2Fu-boot.git st_smi: Fix smi read status smi_read_sr fails sometimes because of TFF not getting set within assumed time. This condition may arise because of, for example, smi memory being in a erase mode. This fix is to enable reading the status register until timeout. Signed-off-by: Vipin Kumar Signed-off-by: Amit Virdi Signed-off-by: Stefan Roese --- diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c index 8c276036af..38f22b736e 100644 --- a/drivers/mtd/st_smi.c +++ b/drivers/mtd/st_smi.c @@ -188,9 +188,7 @@ static int smi_wait_till_ready(int bank, int timeout) but potentially three seconds (!) after page erase. */ do { sr = smi_read_sr(bank); - if (sr < 0) - continue; /* try until timeout */ - else if (!(sr & WIP_BIT)) + if ((sr >= 0) && (!(sr & WIP_BIT))) return 0; /* Try again after 1m-sec */ @@ -231,9 +229,7 @@ static int smi_write_enable(int bank) do { sr = smi_read_sr(bank); - if (sr < 0) - break; - else if (sr & (1 << (bank + WM_SHIFT))) + if ((sr >= 0) && (sr & (1 << (bank + WM_SHIFT)))) return 0; /* Try again after 1m-sec */