From d47f7326e529aa41a525862931cfd37180238016 Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Mon, 13 Aug 2012 12:10:58 +0530 Subject: [PATCH] Xilinx: ARM: sf: stmicro: Add support to program using dual qspi This patch enables programming of stmicro flash devices using dual qspi. stmicro flash driver is updated to detect the size of the flash based on the board header macro. Signed-off-by: Jagannadha Sutradharudu Teki --- drivers/mtd/spi/stmicro.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c index 3b8bed23299..2b86dd5f8fd 100644 --- a/drivers/mtd/spi/stmicro.c +++ b/drivers/mtd/spi/stmicro.c @@ -181,6 +181,13 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode) return NULL; } + /* address width is 4 for dual and 3 for single qspi */ +#ifdef CONFIG_XILINX_PSS_QSPI_USE_DUAL_FLASH + flash->addr_width = 4; +#else + flash->addr_width = 3; +#endif + flash->spi = spi; flash->name = params->name; @@ -189,7 +196,13 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode) flash->read = spi_flash_cmd_read_fast; flash->page_size = params->page_size; flash->sector_size = params->page_size * params->pages_per_sector; - flash->size = flash->sector_size * params->nr_sectors; + + if (flash->addr_width == 3) + flash->size = flash->sector_size * params->nr_sectors; + else if (flash->addr_width == 4) { + printf("Dual Flash\n"); + flash->size = flash->sector_size * (2 * params->nr_sectors); + } return flash; } -- 2.47.3