summaryrefslogtreecommitdiffstats
path: root/src/drivers/spi/winbond.c
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2020-01-11 14:03:27 -0700
committerAaron Durbin <adurbin@chromium.org>2020-01-16 15:21:08 +0000
commitf584f19efc58ba3c80a462024ae680320b17b9ce (patch)
tree69b4419e008e40d2442d11e28af48b28cc535472 /src/drivers/spi/winbond.c
parentcb01aa586f45277043d36500d9694d750ed33190 (diff)
downloadcoreboot-f584f19efc58ba3c80a462024ae680320b17b9ce.tar.gz
coreboot-f584f19efc58ba3c80a462024ae680320b17b9ce.tar.bz2
coreboot-f584f19efc58ba3c80a462024ae680320b17b9ce.zip
drivers/spi/spi_flash: separate out protection ops
Put the write protection into its own object. This allows for easier future reuse of objects in future consolidation patches. It's also possible to eliminate the code implmementing these in the future if the platform doesn't require it. For now leave current behavior as-is. The names of the callbacks were shortened as they are now in the spi_flash_protection_ops object which is a new field in the spi_flash object. Change-Id: I2fec4e4430709fcf3e08a55dd36583211c035c08 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38376 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/drivers/spi/winbond.c')
-rw-r--r--src/drivers/spi/winbond.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c
index 68cf1a3860ee..27aaae84408e 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;