summaryrefslogtreecommitdiff
path: root/src/drivers/spi
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/spi')
-rw-r--r--src/drivers/spi/spi_flash.c9
-rw-r--r--src/drivers/spi/winbond.c8
2 files changed, 10 insertions, 7 deletions
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c
index 8f3a829e15..312f2f0817 100644
--- a/src/drivers/spi/spi_flash.c
+++ b/src/drivers/spi/spi_flash.c
@@ -520,13 +520,13 @@ int spi_flash_is_write_protected(const struct spi_flash *flash,
if (!region_is_subregion(&flash_region, region))
return -1;
- if (!flash->ops->get_write_protection) {
+ if (!flash->prot_ops) {
printk(BIOS_WARNING, "SPI: Write-protection gathering not "
"implemented for this vendor.\n");
return -1;
}
- return flash->ops->get_write_protection(flash, region);
+ return flash->prot_ops->get_write(flash, region);
}
int spi_flash_set_write_protected(const struct spi_flash *flash,
@@ -545,14 +545,13 @@ int spi_flash_set_write_protected(const struct spi_flash *flash,
if (!region_is_subregion(&flash_region, region))
return -1;
- if (!flash->ops->set_write_protection) {
+ if (!flash->prot_ops) {
printk(BIOS_WARNING, "SPI: Setting write-protection is not "
"implemented for this vendor.\n");
return -1;
}
- ret = flash->ops->set_write_protection(flash, region, non_volatile,
- mode);
+ ret = flash->prot_ops->set_write(flash, region, non_volatile, mode);
if (ret == 0 && mode != SPI_WRITE_PROTECTION_PRESERVE) {
printk(BIOS_INFO, "SPI: SREG lock-down was set to ");
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c
index 68cf1a3860..27aaae8440 100644
--- a/src/drivers/spi/winbond.c
+++ b/src/drivers/spi/winbond.c
@@ -615,8 +615,11 @@ static const struct spi_flash_ops spi_flash_ops = {
.write = spi_flash_cmd_write_page_program,
.erase = spi_flash_cmd_erase,
.status = spi_flash_cmd_status,
- .get_write_protection = winbond_get_write_protection,
- .set_write_protection = winbond_set_write_protection,
+};
+
+static const struct spi_flash_protection_ops spi_flash_protection_ops = {
+ .get_write = winbond_get_write_protection,
+ .set_write = winbond_set_write_protection,
};
int spi_flash_probe_winbond(const struct spi_slave *spi, u8 *idcode,
@@ -655,6 +658,7 @@ int spi_flash_probe_winbond(const struct spi_slave *spi, u8 *idcode,
flash->flags.dual_spi = params->dual_spi;
flash->ops = &spi_flash_ops;
+ flash->prot_ops = &spi_flash_protection_ops;
flash->driver_private = params;
return 0;