summaryrefslogtreecommitdiff
path: root/src/drivers/spi/gigadevice.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/spi/gigadevice.c')
-rw-r--r--src/drivers/spi/gigadevice.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/drivers/spi/gigadevice.c b/src/drivers/spi/gigadevice.c
index 84d19a6073..ed3d8bf074 100644
--- a/src/drivers/spi/gigadevice.c
+++ b/src/drivers/spi/gigadevice.c
@@ -132,9 +132,9 @@ static int gigadevice_write(const struct spi_flash *flash, u32 offset,
u8 cmd[4];
page_size = 1 << stm->params->l2_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);
@@ -169,7 +169,6 @@ static int gigadevice_write(const struct spi_flash *flash, u32 offset,
goto out;
offset += chunk_len;
- byte_addr = 0;
}
#if CONFIG_DEBUG_SPI_FLASH