From 9ee638b850757012424dc4228e2c8a977feef17d Mon Sep 17 00:00:00 2001 From: Siva Durga Prasad Paladugu Date: Wed, 2 Mar 2016 11:04:33 +0530 Subject: [PATCH] spi: spi_flash: Restrict max read length to 16MiB Restrict max read length to 16MiB for a single read command. The max read length would be 32MiB incase of dual parallel. This is workaround for read failures if read length is greater than 16MiB in single and 32MiB in dual parallel connection. Signed-off-by: Siva Durga Prasad Paladugu Signed-off-by: Michal Simek --- drivers/mtd/spi/spi_flash.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 975ec6e9fa5..92fec9aa44f 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -626,7 +626,10 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset, else read_len = remain_len; } else { - read_len = len; + if (len > (SPI_FLASH_16MB_BOUN << flash->shift)) + read_len = SPI_FLASH_16MB_BOUN << flash->shift; + else + read_len = len; } if (flash->spi->bytemode == SPI_4BYTE_MODE) -- 2.47.3