summaryrefslogtreecommitdiff
path: root/src/drivers/spi/macronix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/spi/macronix.c')
-rw-r--r--src/drivers/spi/macronix.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/drivers/spi/macronix.c b/src/drivers/spi/macronix.c
index 0e3d028b9c..6d143efe2d 100644
--- a/src/drivers/spi/macronix.c
+++ b/src/drivers/spi/macronix.c
@@ -160,9 +160,9 @@ static int macronix_write(const struct spi_flash *flash, u32 offset, size_t len,
u8 cmd[4];
page_size = mcx->params->page_size;
- byte_addr = offset % page_size;
for (actual = 0; actual < len; actual += chunk_len) {
+ byte_addr = offset % page_size;
chunk_len = min(len - actual, page_size - byte_addr);
chunk_len = spi_crop_chunk(sizeof(cmd), chunk_len);
@@ -194,7 +194,6 @@ static int macronix_write(const struct spi_flash *flash, u32 offset, size_t len,
break;
offset += chunk_len;
- byte_addr = 0;
}
#if CONFIG_DEBUG_SPI_FLASH