[U-Boot] [PATCH v2 6/9] spi: spi_flash: Correct flash size calculation

Siva Durga Prasad Paladugu siva.durga.paladugu at xilinx.com
Tue Jul 19 17:48:31 CEST 2016


Dont need to double the size while calculating
the flash size as the sector size calculation already
takes care of doubling the size incase of dual modes

Signed-off-by: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
---
 drivers/mtd/spi/spi_flash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 1be3e56..ef9b877 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -1167,7 +1167,7 @@ int spi_flash_scan(struct spi_flash *flash)
 	}
 	flash->page_size <<= flash->shift;
 	flash->sector_size = params->sector_size << flash->shift;
-	flash->size = flash->sector_size * params->nr_sectors << flash->shift;
+	flash->size = flash->sector_size * params->nr_sectors;
 #ifdef CONFIG_SF_DUAL_FLASH
 	if (flash->dual_flash & SF_DUAL_STACKED_FLASH)
 		flash->size <<= 1;
-- 
2.7.4



More information about the U-Boot mailing list