]> git.sur5r.net Git - u-boot/commitdiff
st_smi: Move status register read before modifying ctrl register
authorShiraz Hashim <shiraz.hashim@st.com>
Mon, 7 May 2012 07:30:24 +0000 (13:00 +0530)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sat, 7 Jul 2012 12:07:39 +0000 (14:07 +0200)
Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
Signed-off-by: Stefan Roese <sr@denx.de>
drivers/mtd/st_smi.c

index 088c7c7b7c5c0f52c40fac863852b05e3eb02522..8c276036af78d714dcf59a6db470d63c79aef5bd 100644 (file)
@@ -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;
 }
 
 /*