aboutsummaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/mrc_cache/mrc_cache.c4
-rw-r--r--src/drivers/spi/spi_flash.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/src/drivers/mrc_cache/mrc_cache.c b/src/drivers/mrc_cache/mrc_cache.c
index 4dd0dbc434..84bbdb05b3 100644
--- a/src/drivers/mrc_cache/mrc_cache.c
+++ b/src/drivers/mrc_cache/mrc_cache.c
@@ -456,13 +456,15 @@ static int nvm_is_write_protected(void)
/* Apply protection to a range of flash */
static int nvm_protect(const struct region *r)
{
+ const struct spi_flash *flash = boot_device_spi_flash();
+
if (!IS_ENABLED(CONFIG_MRC_SETTINGS_PROTECT))
return 0;
if (!IS_ENABLED(CONFIG_BOOT_DEVICE_SPI_FLASH))
return 0;
- return spi_flash_ctrlr_protect_region(boot_device_spi_flash(), r);
+ return spi_flash_ctrlr_protect_region(flash, r, WRITE_PROTECT);
}
/* Protect mrc region with a Protected Range Register */
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c
index f06de2a11a..204f607889 100644
--- a/src/drivers/spi/spi_flash.c
+++ b/src/drivers/spi/spi_flash.c
@@ -572,7 +572,8 @@ void lb_spi_flash(struct lb_header *header)
int spi_flash_ctrlr_protect_region(const struct spi_flash *flash,
- const struct region *region)
+ const struct region *region,
+ const enum ctrlr_prot_type type)
{
const struct spi_ctrlr *ctrlr;
struct region flash_region = { 0 };
@@ -591,7 +592,7 @@ int spi_flash_ctrlr_protect_region(const struct spi_flash *flash,
return -1;
if (ctrlr->flash_protect)
- return ctrlr->flash_protect(flash, region);
+ return ctrlr->flash_protect(flash, region, type);
return -1;
}