]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
sf: Correct bank select incase of dual stacked
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Fri, 25 Apr 2014 11:38:01 +0000 (17:08 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 30 Apr 2014 08:53:16 +0000 (10:53 +0200)
Correct the bank selection issue incase of Dual stacked mode.
This fix corrects the wrong bank selection if banks are accessed
as below.
1. Access the bank2 in upper flash.
2. Access the bank1 in lower flash.
3. Now access the bank1 in upper flash.
But here in the step3, the present code was accessing the bank2 in
upper flash not bank1. This was because the code thinks the bank1
was already selected as part of step2 but it was not taking care of
upper or lower flash.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/mtd/spi/sf_ops.c
include/spi_flash.h

index 1f1bb3606590319e43110923ca09711a16a5c721..36c427767ef851b676023a9dcb2ebc05fa0e138b 100644 (file)
@@ -97,10 +97,22 @@ static int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel)
 {
        u8 cmd;
        int ret;
+       u8 upage_curr;
 
-       if (flash->bank_curr == bank_sel) {
-               debug("SF: not require to enable bank%d\n", bank_sel);
-               return 0;
+       upage_curr = flash->spi->flags & SPI_XFER_U_PAGE;
+
+       if (flash->dual_flash != SF_DUAL_STACKED_FLASH) {
+               if (flash->bank_curr == bank_sel) {
+                       debug("SF: not require to enable bank%d\n", bank_sel);
+                       return 0;
+               }
+       } else if (flash->upage_prev == upage_curr) {
+               if (flash->bank_curr == bank_sel) {
+                       debug("SF: not require to enable bank%d\n", bank_sel);
+                       return 0;
+               }
+       } else {
+               flash->upage_prev = upage_curr;
        }
 
        cmd = flash->bank_write_cmd;
index f79f0eacca03b66d6604e1dfe9e3afd4f38bb250..361df365002b18a43d1e91d0ba640e2ed35e2c2e 100644 (file)
@@ -108,6 +108,7 @@ struct spi_flash {
        u8 bank_read_cmd;
        u8 bank_write_cmd;
        u8 bank_curr;
+       u8 upage_prev;
 #endif
        u8 poll_cmd;
        u8 erase_cmd;