aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/soc/intel/broadwell/include/soc/spi.h2
-rw-r--r--src/soc/intel/broadwell/spi.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/src/soc/intel/broadwell/include/soc/spi.h b/src/soc/intel/broadwell/include/soc/spi.h
index 55de14e1b4..588af17609 100644
--- a/src/soc/intel/broadwell/include/soc/spi.h
+++ b/src/soc/intel/broadwell/include/soc/spi.h
@@ -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
diff --git a/src/soc/intel/broadwell/spi.c b/src/soc/intel/broadwell/spi.c
index 52a1d76f54..2bcbebac31 100644
--- a/src/soc/intel/broadwell/spi.c
+++ b/src/soc/intel/broadwell/spi.c
@@ -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[] = {