]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sf: Read back and check once spansion quad bit set
authorJagan Teki <jteki@openedev.com>
Tue, 15 Dec 2015 06:58:39 +0000 (12:28 +0530)
committerJagan Teki <jteki@openedev.com>
Wed, 13 Jan 2016 13:17:26 +0000 (18:47 +0530)
One spansion quad bit set using CR, it's good to
read back and check the written bit and also if
it's already been set check for the bit and return.

Cc: Vignesh R <vigneshr@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Tested-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
drivers/mtd/spi/spi_flash.c

index d9124c5fc572f134bf8c1bd2b5d1b8982a710bb7..b7c0da46a251cb06494fa7d133456dd5e0a2ba62 100644 (file)
@@ -862,12 +862,18 @@ static int spansion_quad_enable(struct spi_flash *flash)
        if (ret < 0)
                return ret;
 
-       if (qeb_status & STATUS_QEB_WINSPAN) {
-               debug("SF: winspan: QEB is already set\n");
-       } else {
-               ret = write_cr(flash, STATUS_QEB_WINSPAN);
-               if (ret < 0)
-                       return ret;
+       if (qeb_status & STATUS_QEB_WINSPAN)
+               return 0;
+
+       ret = write_cr(flash, STATUS_QEB_WINSPAN);
+       if (ret < 0)
+               return ret;
+
+       /* read CR and check it */
+       ret = read_cr(flash, &qeb_status);
+       if (!(ret >= 0 && (qeb_status & STATUS_QEB_WINSPAN))) {
+               printf("SF: Spansion CR Quad bit not clear\n");
+               return -EINVAL;
        }
 
        return ret;