]> 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>
Tue, 9 Sep 2014 12:42:07 +0000 (14:42 +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 ef91b924d7d69f75cb123b8e5a9385c090013d5a..022867eeb70113d3e66071393c77faf99f968a41 100644 (file)
@@ -98,10 +98,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 2db53c74c88efa794eeacab10220d49d56bd0a31..4de50106fceaba6b525fd5c2b1a8008192dbe8b3 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;