summaryrefslogtreecommitdiff
path: root/src/drivers/spi
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/spi')
-rw-r--r--src/drivers/spi/boot_device_rw_nommap.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/drivers/spi/boot_device_rw_nommap.c b/src/drivers/spi/boot_device_rw_nommap.c
index ba11d05d99..58efc87fe9 100644
--- a/src/drivers/spi/boot_device_rw_nommap.c
+++ b/src/drivers/spi/boot_device_rw_nommap.c
@@ -96,9 +96,17 @@ int boot_device_wp_region(const struct region_device *rd,
if (type == MEDIA_WP) {
if (spi_flash_is_write_protected(boot_dev,
region_device_region(rd)) != 1) {
+ enum spi_flash_status_reg_lockdown lock =
+ SPI_WRITE_PROTECTION_REBOOT;
+ if (CONFIG(BOOTMEDIA_SPI_LOCK_REBOOT))
+ lock = SPI_WRITE_PROTECTION_REBOOT;
+ else if (CONFIG(BOOTMEDIA_SPI_LOCK_PIN))
+ lock = SPI_WRITE_PROTECTION_PIN;
+ else if (CONFIG(BOOTMEDIA_SPI_LOCK_PERMANENT))
+ lock = SPI_WRITE_PROTECTION_PERMANENT;
+
return spi_flash_set_write_protected(boot_dev,
- region_device_region(rd),
- SPI_WRITE_PROTECTION_REBOOT);
+ region_device_region(rd), lock);
}
/* Already write protected */