summaryrefslogtreecommitdiff
path: root/src/drivers/spi/winbond.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/spi/winbond.c')
-rw-r--r--src/drivers/spi/winbond.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c
index 9694f8aee4..77064ea52c 100644
--- a/src/drivers/spi/winbond.c
+++ b/src/drivers/spi/winbond.c
@@ -184,6 +184,17 @@ out:
return ret;
}
+static const struct spi_flash_ops spi_flash_ops = {
+ .write = winbond_write,
+ .erase = spi_flash_cmd_erase,
+ .status = spi_flash_cmd_status,
+#if IS_ENABLED(CONFIG_SPI_FLASH_NO_FAST_READ)
+ .read = spi_flash_cmd_read_slow,
+#else
+ .read = spi_flash_cmd_read_fast,
+#endif
+};
+
int spi_flash_probe_winbond(const struct spi_slave *spi, u8 *idcode,
struct spi_flash *flash)
{
@@ -212,14 +223,7 @@ int spi_flash_probe_winbond(const struct spi_slave *spi, u8 *idcode,
flash->erase_cmd = CMD_W25_SE;
flash->status_cmd = CMD_W25_RDSR;
- flash->internal_write = winbond_write;
- flash->internal_erase = spi_flash_cmd_erase;
- flash->internal_status = spi_flash_cmd_status;
-#if CONFIG_SPI_FLASH_NO_FAST_READ
- flash->internal_read = spi_flash_cmd_read_slow;
-#else
- flash->internal_read = spi_flash_cmd_read_fast;
-#endif
+ flash->ops = &spi_flash_ops;
return 0;
}