From 09ffa5b34671220440ce02f2cd92982dae244d16 Mon Sep 17 00:00:00 2001 From: Matt Wood Date: Thu, 9 Aug 2018 15:23:06 -0400 Subject: [PATCH] Fix spi flash driver support for >16MB devices This patch fixes the assumption that 16MB is the upper boundary for read operations. Signed-off-by: Matt Wood --- 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 c6388cbbe59..99909c8c546 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -560,7 +560,7 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset, return ret; bank_sel = flash->bank_curr; #endif - remain_len = ((SPI_FLASH_16MB_BOUN << flash->shift) * + remain_len = ((flash->size << flash->shift) * (bank_sel + 1)) - offset; if (len < remain_len) read_len = len;