From 3395eb1a82f01b9b0b5160d384cf80f4a3a5a648 Mon Sep 17 00:00:00 2001 From: "S.J.R. van Schaik" Date: Sat, 24 Jun 2017 17:02:36 +0200 Subject: [PATCH] spi: flash: support the 256-byte wraparound when programming pages --- source/drivers/spi_flash.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/drivers/spi_flash.c b/source/drivers/spi_flash.c index ed75778..bb1f533 100644 --- a/source/drivers/spi_flash.c +++ b/source/drivers/spi_flash.c @@ -130,6 +130,7 @@ static size_t spi_flash_write(struct flash_dev *dev, uint32_t addr, spi_flash_addr(cmd, addr); nbytes = min(len, 32); + nbytes = nbytes - ((addr + nbytes) & 0xff); memmove(cmd + 4, data, nbytes); spi_tx_rx(spi_dev, NULL, 0, cmd, 4 + nbytes);