summaryrefslogtreecommitdiff
path: root/src/drivers/spi/winbond.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/spi/winbond.c')
-rw-r--r--src/drivers/spi/winbond.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c
index 52c7b61245..eb0868ec7a 100644
--- a/src/drivers/spi/winbond.c
+++ b/src/drivers/spi/winbond.c
@@ -122,7 +122,7 @@ static int winbond_write(struct spi_flash *flash,
int ret;
u8 cmd[4];
- page_size = min(1 << stm->params->l2_page_size, CONTROLLER_PAGE_LIMIT);
+ page_size = 1 << stm->params->l2_page_size;
byte_addr = offset % page_size;
flash->spi->rw = SPI_WRITE_FLAG;
@@ -134,6 +134,7 @@ static int winbond_write(struct spi_flash *flash,
for (actual = 0; actual < len; actual += chunk_len) {
chunk_len = min(len - actual, page_size - byte_addr);
+ chunk_len = min(chunk_len, CONTROLLER_PAGE_LIMIT);
cmd[0] = CMD_W25_PP;
cmd[1] = (offset >> 16) & 0xff;