summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVipin Kumar <vipin.kumar@st.com>2012-05-07 13:00:25 +0530
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-07-07 14:07:39 +0200
commita5ad7ccd74de244f91d75fb3879eaa1929304e89 (patch)
tree7a6de91a175f462344ccf7fb0569178391368269 /drivers
parenta59c7b37b908639f9daa7fe50d4646b3947e2d62 (diff)
downloadu-boot-imx-a5ad7ccd74de244f91d75fb3879eaa1929304e89.zip
u-boot-imx-a5ad7ccd74de244f91d75fb3879eaa1929304e89.tar.gz
u-boot-imx-a5ad7ccd74de244f91d75fb3879eaa1929304e89.tar.bz2
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 <vipin.kumar@st.com> Signed-off-by: Amit Virdi <amit.virdi@st.com> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/st_smi.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index 8c27603..38f22b7 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 */