[U-Boot] [PATCH 5/5] sf: Add bank selection support for dual stacked access
Jagannadha Sutradharudu Teki
jagannadha.sutradharudu-teki at xilinx.com
Mon Jul 29 17:23:43 CEST 2013
For upper memory, bank selection on dual stacked access
needs to subtract the calculated banks from the number of
banks available on a single memory.
Signed-off-by: Jagannadha Sutradharudu Teki <jaganna at xilinx.com>
---
drivers/mtd/spi/spi_flash.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index f7443fa..58d5899 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -190,6 +190,9 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len)
u8 bank_sel;
bank_sel = erase_addr / SPI_FLASH_16MB_BOUN;
+ if ((is_dual == SPI_FLASH_CONN_DUALSTACKED) &&
+ (flash->spi->u_page == 1))
+ bank_sel -= ((flash->size / 2) / SPI_FLASH_16MB_BOUN);
ret = spi_flash_cmd_bankaddr_write(flash, bank_sel);
if (ret) {
@@ -242,6 +245,9 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset,
u8 bank_sel;
bank_sel = write_addr / SPI_FLASH_16MB_BOUN;
+ if ((is_dual == SPI_FLASH_CONN_DUALSTACKED) &&
+ (flash->spi->u_page == 1))
+ bank_sel -= ((flash->size / 2) / SPI_FLASH_16MB_BOUN);
ret = spi_flash_cmd_bankaddr_write(flash, bank_sel);
if (ret) {
@@ -330,12 +336,19 @@ int spi_flash_cmd_read_fast(struct spi_flash *flash, u32 offset,
}
#ifdef CONFIG_SPI_FLASH_BAR
bank_sel = read_addr / SPI_FLASH_16MB_BOUN;
+ if ((is_dual == SPI_FLASH_CONN_DUALSTACKED) &&
+ (flash->spi->u_page == 1))
+ bank_sel -= ((flash->size / 2) / SPI_FLASH_16MB_BOUN);
ret = spi_flash_cmd_bankaddr_write(flash, bank_sel);
if (ret) {
debug("SF: fail to set bank%d\n", bank_sel);
return ret;
}
+
+ if ((is_dual == SPI_FLASH_CONN_DUALSTACKED) &&
+ (flash->spi->u_page == 1))
+ bank_sel += ((flash->size / 2) / SPI_FLASH_16MB_BOUN);
#endif
remain_len = (bank_boun * (bank_sel + 1) - read_addr);
if (len < remain_len)
--
1.8.3
More information about the U-Boot
mailing list