From e2fc5e25f2d1cab86edac352d1a91f55c15c9f0a Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Wed, 17 May 2017 17:26:01 -0700 Subject: drivers/spi/spi_flash: Move flash ops to spi_flash_ops structure Define a new spi_flash_ops structure, move all spi flash operations to this structure and add a pointer to this structure in struct spi_flash. BUG=b:38330715 Change-Id: I550cc4556fc4b63ebc174a7e2fde42251fe56052 Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/19757 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/drivers/spi/eon.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/drivers/spi/eon.c') diff --git a/src/drivers/spi/eon.c b/src/drivers/spi/eon.c index ece9810e2d..a072e4e223 100644 --- a/src/drivers/spi/eon.c +++ b/src/drivers/spi/eon.c @@ -126,6 +126,13 @@ out: return ret; } +static const struct spi_flash_ops spi_flash_ops = { + .write = eon_write, + .erase = spi_flash_cmd_erase, + .status = spi_flash_cmd_status, + .read = spi_flash_cmd_read_fast, +}; + int spi_flash_probe_eon(const struct spi_slave *spi, u8 *idcode, struct spi_flash *flash) { @@ -153,10 +160,7 @@ int spi_flash_probe_eon(const struct spi_slave *spi, u8 *idcode, flash->erase_cmd = CMD_EN25_SE; flash->status_cmd = CMD_EN25_RDSR; - flash->internal_write = eon_write; - flash->internal_erase = spi_flash_cmd_erase; - flash->internal_status = spi_flash_cmd_status; - flash->internal_read = spi_flash_cmd_read_fast; + flash->ops = &spi_flash_ops; return 0; } -- cgit v1.2.3