[U-Boot] [PATCH V1 RESEND 06/12] st_smi: Move status register read before modifying ctrl register

Amit Virdi amit.virdi at st.com
Mon May 7 09:30:24 CEST 2012


From: Shiraz Hashim <shiraz.hashim at st.com>

Signed-off-by: Shiraz Hashim <shiraz.hashim at st.com>
Signed-off-by: Amit Virdi <amit.virdi at st.com>
---
 drivers/mtd/st_smi.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index 7b4c6f3..eb902b2 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -148,7 +148,7 @@ static ulong flash_get_size(ulong base, int banknum)
  */
 static int smi_read_sr(int bank)
 {
-	u32 ctrlreg1;
+	u32 ctrlreg1, val;
 
 	/* store the CTRL REG1 state */
 	ctrlreg1 = readl(&smicntl->smi_cr1);
@@ -163,10 +163,12 @@ static int smi_read_sr(int bank)
 	if (smi_wait_xfer_finish(XFER_FINISH_TOUT))
 		return -1;
 
+	val = readl(&smicntl->smi_sr);
+
 	/* Restore the CTRL REG1 state */
 	writel(ctrlreg1, &smicntl->smi_cr1);
 
-	return readl(&smicntl->smi_sr);
+	return val;
 }
 
 /*
-- 
1.7.2.2



More information about the U-Boot mailing list