From 5652e591e10d500b5efc7f54db95640ea2ffe5e0 Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Sat, 25 Aug 2012 21:18:13 +0530 Subject: [PATCH] Xilinx: ARM: sf: stmicro: Update the flash memory size at runtime This patch adds support to update the flash memory size based on the runtime detection of dual qspi flash. So removed the conditional compilation for dual qspi flash. Signed-off-by: Jagannadha Sutradharudu Teki --- drivers/mtd/spi/stmicro.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c index aff37465b9c..31fb42329d0 100644 --- a/drivers/mtd/spi/stmicro.c +++ b/drivers/mtd/spi/stmicro.c @@ -189,13 +189,6 @@ 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; @@ -205,11 +198,13 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode) flash->page_size = params->page_size; flash->sector_size = params->page_size * params->pages_per_sector; - if (flash->addr_width == 3) - flash->size = flash->sector_size * params->nr_sectors; - else if (flash->addr_width == 4) { - printf("Dual Flash\n"); + /* address width is 4 for dual and 3 for single qspi */ + if (flash->spi->is_dual == 1) { + flash->addr_width = 4; flash->size = flash->sector_size * (2 * params->nr_sectors); + } else if (flash->spi->is_dual == 0) { + flash->addr_width = 3; + flash->size = flash->sector_size * params->nr_sectors; } return flash; -- 2.47.3