soc/intel/broadwell: implement spi_flash_ctrlr_protect_region()

Implement the spi controller flash_protect() callback. No need to
have a global spi_flash_protect() once implemented.

BUG=b:69614064

Change-Id: I83f4310d8f78ba64727ba75eb75708d0cbaa7d53
Signed-off-by: Aaron Durbn <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/22882
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Aaron Durbin 2017-12-14 15:39:34 -07:00
parent 2b96f421e6
commit c3339ce9e3
2 changed files with 5 additions and 4 deletions

View File

@ -101,6 +101,4 @@
#define SPIBAR_SSFC_DATA (1 << 14)
#define SPIBAR_SSFC_GO (1 << 1)
int spi_flash_protect(u32 start, u32 size);
#endif

View File

@ -612,9 +612,11 @@ static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout,
}
/* Use first empty Protected Range Register to cover region of flash */
int spi_flash_protect(u32 start, u32 size)
static int spi_flash_protect(const struct spi_flash *flash,
const struct region *region)
{
u32 end = start + size - 1;
u32 start = region_offset(region);
u32 end = start + region_sz(region) - 1;
u32 reg;
int prr;
@ -652,6 +654,7 @@ static const struct spi_ctrlr spi_ctrlr = {
.xfer = spi_ctrlr_xfer,
.xfer_vector = spi_xfer_two_vectors,
.max_xfer_size = member_size(ich9_spi_regs, fdata),
.flash_protect = spi_flash_protect,
};
const struct spi_ctrlr_buses spi_ctrlr_bus_map[] = {