From 97394684877b5a33474b21a01432ddadd630bffd Mon Sep 17 00:00:00 2001 From: Siva Durga Prasad Paladugu Date: Thu, 29 Oct 2015 12:00:16 +0530 Subject: [PATCH] sf: probe: Handle flash size properly incase of dual parallel Handle flash size properly incase of dual parallel The flash size has to be divided by 2 while checking the flash size to enter 4byte mode and for bank selection during init. Signed-off-by: Siva Durga Prasad Paladugu Signed-off-by: Michal Simek --- drivers/mtd/spi/sf_probe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index bf84cebd71a..b66cc45ae9b 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -213,7 +213,7 @@ static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode, * and make sure the chip (> 16MiB) in default 3-byte address mode, * in case of warm bootup, the chip was set to 4-byte mode in kernel. */ - if (flash->size > SPI_FLASH_16MB_BOUN) { + if ((flash->size >> flash->shift) > SPI_FLASH_16MB_BOUN) { if (flash->spi->bytemode == SPI_4BYTE_MODE) { if (spi_flash_cmd_4B_addr_switch(flash, true, idcode[0]) < 0) @@ -367,7 +367,7 @@ static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode, /* Configure the BAR - discover bank cmds and read current bank */ #ifdef CONFIG_SPI_FLASH_BAR u8 curr_bank = 0; - if (flash->size > SPI_FLASH_16MB_BOUN) { + if ((flash->size >> flash->shift) > SPI_FLASH_16MB_BOUN) { int ret; flash->bank_read_cmd = (idcode[0] == 0x01) ? -- 2.47.3