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 <furquan@chromium.org>
Reviewed-on: https://review.coreboot.org/19757
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
diff --git a/src/soc/intel/common/block/fast_spi/fast_spi_flash.c b/src/soc/intel/common/block/fast_spi/fast_spi_flash.c
index fc36553..6dac24e 100644
--- a/src/soc/intel/common/block/fast_spi/fast_spi_flash.c
+++ b/src/soc/intel/common/block/fast_spi/fast_spi_flash.c
@@ -273,6 +273,13 @@
return ret;
}
+const struct spi_flash_ops fast_spi_flash_ops = {
+ .read = fast_spi_flash_read,
+ .write = fast_spi_flash_write,
+ .erase = fast_spi_flash_erase,
+ .status = fast_spi_flash_status,
+};
+
/*
* We can't use FDOC and FDOD to read FLCOMP, as previous platforms did.
* For details see:
@@ -307,11 +314,7 @@
* flash->status_cmd = ???
*/
- flash->internal_write = fast_spi_flash_write;
- flash->internal_erase = fast_spi_flash_erase;
- flash->internal_read = fast_spi_flash_read;
- flash->internal_status = fast_spi_flash_status;
-
+ flash->ops = &fast_spi_flash_ops;
return 0;
}