diff options
author | Julius Werner <jwerner@chromium.org> | 2019-06-05 16:34:01 -0700 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2019-06-10 18:02:00 +0000 |
commit | 1b7f99bd6b52e3fd03653dca80af3faf6e7e8852 (patch) | |
tree | 988e6860b7a4deac4fd424b8b0f294633acf12e2 /src/drivers/spi/sst.c | |
parent | 381c35c7f901608277f00477e04977bf938b0b59 (diff) | |
download | coreboot-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/sst.c')
-rw-r--r-- | src/drivers/spi/sst.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/drivers/spi/sst.c b/src/drivers/spi/sst.c index e4ea7805dd..abe3f2ace6 100644 --- a/src/drivers/spi/sst.c +++ b/src/drivers/spi/sst.c @@ -55,14 +55,12 @@ static const struct spi_flash_ops spi_flash_ops_write_ai = { .write = sst_write_ai, .erase = spi_flash_cmd_erase, .status = spi_flash_cmd_status, - .read = spi_flash_cmd_read_fast, }; static const struct spi_flash_ops spi_flash_ops_write_256 = { .write = sst_write_256, .erase = spi_flash_cmd_erase, .status = spi_flash_cmd_status, - .read = spi_flash_cmd_read_fast, }; #define SST_SECTOR_SIZE (4 * 1024) |