From f9f50936446e8e441238ecfe12ce0fc9e04d491a Mon Sep 17 00:00:00 2001 From: Rizwan Qureshi Date: Mon, 31 Dec 2018 15:19:16 +0530 Subject: drivers/spi: Add controller protection type Some SPI controllers support both READ and WRITE protection add a variable to the protect API for the callers to specify the kind of protection they want (Read/Write/Both). Also, update the callers and protect API implementation. BUG=None BRANCH=None TEST=test that the mrc cache is protected as expected on soraka. Also tried if the read protection is applied correctly. Change-Id: I093884c4768b08a378f21242ac82e430ac013d15 Signed-off-by: Rizwan Qureshi Reviewed-on: https://review.coreboot.org/c/30559 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- src/drivers/spi/spi_flash.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/drivers/spi/spi_flash.c') 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; } -- cgit v1.2.3