diff options
author | Aaron Durbin <adurbin@chromium.org> | 2017-12-14 14:34:47 -0700 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2017-12-15 23:35:10 +0000 |
commit | 10d65b06aebbd857759c278a18c7e9e0ba70ee6c (patch) | |
tree | e23f541b7fbcdd5548b98d400c6b60c75c97d489 /src/include | |
parent | 02103e34d76c12b46b57143cd11d96758219423d (diff) | |
download | coreboot-10d65b06aebbd857759c278a18c7e9e0ba70ee6c.tar.xz |
drivers/spi/spi_flash: add flash region protection to controller
Provide a spi controller specific protection callback to take
advantage of special spi flash controllers that have internal
protection registers built into the implementation. It's an
optional callback for spi controllers.
BUG=b:69614064
Change-Id: Ie50a6ce3bbda32620a25dd26fda1af944940bf28
Signed-off-by: Aaron Durbn <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/22879
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/spi-generic.h | 4 | ||||
-rw-r--r-- | src/include/spi_flash.h | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/include/spi-generic.h b/src/include/spi-generic.h index 783df0b917..a3298f8376 100644 --- a/src/include/spi-generic.h +++ b/src/include/spi-generic.h @@ -16,6 +16,7 @@ #ifndef _SPI_GENERIC_H_ #define _SPI_GENERIC_H_ +#include <commonlib/region.h> #include <stdint.h> #include <stddef.h> @@ -115,6 +116,7 @@ struct spi_flash; * * flash_probe: Specialized probe function provided by SPI flash * controllers. + * flash_protect: Protect a region of flash using the SPI flash controller. */ struct spi_ctrlr { int (*claim_bus)(const struct spi_slave *slave); @@ -128,6 +130,8 @@ struct spi_ctrlr { bool deduct_cmd_len; int (*flash_probe)(const struct spi_slave *slave, struct spi_flash *flash); + int (*flash_protect)(const struct spi_flash *flash, + const struct region *region); }; /*----------------------------------------------------------------------- diff --git a/src/include/spi_flash.h b/src/include/spi_flash.h index e9ea50c4d2..3a6df9ab1f 100644 --- a/src/include/spi_flash.h +++ b/src/include/spi_flash.h @@ -120,4 +120,9 @@ int chipset_volatile_group_end(const struct spi_flash *flash); * if CONFIG_BOOT_DEVICE_SPI_FLASH is enabled. */ const struct spi_flash *boot_device_spi_flash(void); +/* Protect a region of spi flash using its controller, if available. Returns + * < 0 on error, else 0 on success. */ +int spi_flash_ctrlr_protect_region(const struct spi_flash *flash, + const struct region *region); + #endif /* _SPI_FLASH_H_ */ |