]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
sf: Fix the remain_len calculation in Dual stacked
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Mon, 26 May 2014 06:36:29 +0000 (12:06 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 9 Sep 2014 12:42:18 +0000 (14:42 +0200)
The bank_sel should be increased by total banks in first
chip, if accessing the second chip in Dual stacked mode.
This fixes the wrong remain_len calculation if two 16MB
chips connected in Dual stacked and accessing the second
chip.

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

index 88e43ba439a6eb59af16335714c38ca43e75c7e0..e01ef5606da630246a35c702d0af2dae0213e55b 100644 (file)
@@ -421,6 +421,9 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
                bank_sel = spi_flash_bank(flash, bank_addr);
                if (bank_sel < 0)
                        return ret;
+               if ((flash->dual_flash == SF_DUAL_STACKED_FLASH) &&
+                   (flash->spi->flags & SPI_XFER_U_PAGE))
+                       bank_sel += (flash->size >> 1)/SPI_FLASH_16MB_BOUN;
 #endif
                remain_len = ((SPI_FLASH_16MB_BOUN << flash->shift) *
                                (bank_sel + 1)) - offset;