summaryrefslogtreecommitdiff
path: root/src/drivers/spi/adesto.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2019-06-05 16:34:01 -0700
committerJulius Werner <jwerner@chromium.org>2019-06-10 18:02:00 +0000
commit1b7f99bd6b52e3fd03653dca80af3faf6e7e8852 (patch)
tree988e6860b7a4deac4fd424b8b0f294633acf12e2 /src/drivers/spi/adesto.c
parent381c35c7f901608277f00477e04977bf938b0b59 (diff)
downloadcoreboot-1b7f99bd6b52e3fd03653dca80af3faf6e7e8852.tar.xz
spi_flash: Make .read() callback optional
All SPI flash chip drivers currently in coreboot use the generic read functions (spi_flash_cmd_read_fast()/_slow()) as their read callback. The only use case for specialized read callbacks we have left is with specialized flash controllers like Intel fast_spi (which sort of impersonate the flash chip driver by implementing their own probe function). This patch unifies the behavior for all normal flash drivers by making the read callback optional and letting them all fall back to a default read implementation that handles normal fast/slow reading. Most of the drivers used to install the respective callback after checking CONFIG_SPI_FLASH_NO_FAST_READ, but some hardcoded either slow or fast writes. I have found no indications for why this is and spot-checked datasheets for affected vendors to make sure they all support both commands, so I assume this is just some old inaccuracy rather than important differences that need preserving. (Please yell if you disagree.) Also take the opportunity to refactor some of the common spi_flash.c code a bit because I felt there are too many nested functions that don't really do enough on their own, and centralizing stuff a bit should make it easier to follow the code flow. (Some of this is in preparation for the next patch.) Change-Id: I2096a3ce619767b41b1b0c0c2b8e95b2bd90a419 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/33282 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/drivers/spi/adesto.c')
-rw-r--r--src/drivers/spi/adesto.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/src/drivers/spi/adesto.c b/src/drivers/spi/adesto.c
index a805609c5e..4e1043edb7 100644
--- a/src/drivers/spi/adesto.c
+++ b/src/drivers/spi/adesto.c
@@ -201,11 +201,6 @@ out:
static const struct spi_flash_ops spi_flash_ops = {
.write = adesto_write,
.erase = spi_flash_cmd_erase,
-#if CONFIG(SPI_FLASH_NO_FAST_READ)
- .read = spi_flash_cmd_read_slow,
-#else
- .read = spi_flash_cmd_read_fast,
-#endif
};
int spi_flash_probe_adesto(const struct spi_slave *spi, u8 *idcode,