summaryrefslogtreecommitdiff
path: root/src/drivers/spi/atmel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/spi/atmel.c')
-rw-r--r--src/drivers/spi/atmel.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/drivers/spi/atmel.c b/src/drivers/spi/atmel.c
index feb1a6d1fd..39cc95e609 100644
--- a/src/drivers/spi/atmel.c
+++ b/src/drivers/spi/atmel.c
@@ -121,9 +121,9 @@ static int atmel_write(const struct spi_flash *flash, u32 offset, size_t len,
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);
@@ -155,7 +155,6 @@ static int atmel_write(const struct spi_flash *flash, u32 offset, size_t len,
goto out;
offset += chunk_len;
- byte_addr = 0;
}
#if CONFIG_DEBUG_SPI_FLASH