Message ID | 20190319165023.18828-1-alexander.sverdlin@nokia.com |
---|---|
State | Changes Requested |
Delegated to: | Ambarus Tudor |
Headers | show |
Series | [v3] spi-nor: intel-spi: Avoid crossing 4K address boundary on read/write | expand |
Hi, [This is an automated email] This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: all The bot has tested the following trees: v5.0.3, v4.19.30, v4.14.107, v4.9.164, v4.4.176, v3.18.136. v5.0.3: Build OK! v4.19.30: Build OK! v4.14.107: Build OK! v4.9.164: Failed to apply! Possible dependencies: 8afda8b26d01 ("spi-nor: Add support for Intel SPI serial flash controller") v4.4.176: Failed to apply! Possible dependencies: 8afda8b26d01 ("spi-nor: Add support for Intel SPI serial flash controller") v3.18.136: Failed to apply! Possible dependencies: 8afda8b26d01 ("spi-nor: Add support for Intel SPI serial flash controller") f617b9587c16 ("mtd: spi-nor: add driver for NXP SPI Flash Interface (SPIFI)") How should we proceed with this patch? -- Thanks, Sasha
diff --git a/drivers/mtd/spi-nor/intel-spi.c b/drivers/mtd/spi-nor/intel-spi.c index af0a220..d60cbf2 100644 --- a/drivers/mtd/spi-nor/intel-spi.c +++ b/drivers/mtd/spi-nor/intel-spi.c @@ -632,6 +632,10 @@ static ssize_t intel_spi_read(struct spi_nor *nor, loff_t from, size_t len, while (len > 0) { block_size = min_t(size_t, len, INTEL_SPI_FIFO_SZ); + /* Read cannot cross 4K boundary */ + block_size = min_t(loff_t, from + block_size, + round_up(from + 1, SZ_4K)) - from; + writel(from, ispi->base + FADDR); val = readl(ispi->base + HSFSTS_CTL); @@ -685,6 +689,10 @@ static ssize_t intel_spi_write(struct spi_nor *nor, loff_t to, size_t len, while (len > 0) { block_size = min_t(size_t, len, INTEL_SPI_FIFO_SZ); + /* Write cannot cross 4K boundary */ + block_size = min_t(loff_t, to + block_size, + round_up(to + 1, SZ_4K)) - to; + writel(to, ispi->base + FADDR); val = readl(ispi->base + HSFSTS_CTL);