summaryrefslogtreecommitdiff
path: root/src/drivers/spi/spi_flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/spi/spi_flash.c')
-rw-r--r--src/drivers/spi/spi_flash.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c
index f2610a181d..2406a90e52 100644
--- a/src/drivers/spi/spi_flash.c
+++ b/src/drivers/spi/spi_flash.c
@@ -663,6 +663,14 @@ void lb_spi_flash(struct lb_header *header)
flash->sector_size = 64 * KiB;
flash->erase_cmd = CMD_BLOCK_ERASE;
}
+
+ if (!CONFIG(BOOT_DEVICE_MEMORY_MAPPED)) {
+ flash->mmap_count = 0;
+ } else {
+ struct flash_mmap_window *table = (struct flash_mmap_window *)(flash + 1);
+ flash->mmap_count = spi_flash_get_mmap_windows(table);
+ flash->size += flash->mmap_count * sizeof(*table);
+ }
}
int spi_flash_ctrlr_protect_region(const struct spi_flash *flash,