From: Siva Durga Prasad Paladugu Date: Mon, 26 May 2014 06:36:29 +0000 (+0530) Subject: sf: Fix the remain_len calculation in Dual stacked X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=633bb11a92b164e5a0e1169bd7de20e3b9484813;p=thirdparty%2Fu-boot.git sf: Fix the remain_len calculation in Dual stacked 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 Signed-off-by: Michal Simek --- diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c index 88e43ba439a..e01ef5606da 100644 --- a/drivers/mtd/spi/sf_ops.c +++ b/drivers/mtd/spi/sf_ops.c @@ -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;