drivers: spi_flash: Add Fast Read Dual I/O support

The Fast Read Dual Output and Fast Read Dual I/O commands are
practically identical, the only difference being how the read address is
transferred (saving a whooping 2 bytes which is totally irrelevant for
the amounts of data coreboot tends to read). We originally implemented
Fast Read Dual Output since it's the older command and some older
Winbond chips only supported that one... but it seems that some older
Macronix parts for whatever reason chose to only support Fast Read Dual
I/O instead. So in order to make this work for as many parts as
possible, I guess we'll have to implement both. (Also, the Macronix
device ID situation is utter madness with different chips with different
capabilities often having the same ID, so we basically have to make a
best-effort guess to strike a trade-off between fast speeds and best
chance at supporting all chips. If this turns out to be a problem later,
we may have to add Kconfig overrides for this or resort to SFDP parsing,
although that would defeat the whole point of trying to be fast.)

BUG=b:193486682
TEST=Booted CoachZ (with Dual I/O)

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: Ia1a20581f251615127f132eadea367b7b66c4709
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56287
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Julius Werner
2021-07-13 15:57:29 -07:00
committed by Patrick Georgi
parent 825693a3d5
commit df5062215f
6 changed files with 100 additions and 17 deletions

View File

@@ -15,6 +15,7 @@
#define CMD_READ_ARRAY_LEGACY 0xe8
#define CMD_READ_FAST_DUAL_OUTPUT 0x3b
#define CMD_READ_FAST_DUAL_IO 0xbb
#define CMD_READ_STATUS 0x05
#define CMD_WRITE_ENABLE 0x06
@@ -69,8 +70,9 @@ struct spi_flash_part_id {
uint16_t id[2];
/* Log based 2 total number of sectors. */
uint16_t nr_sectors_shift: 4;
uint16_t fast_read_dual_output_support : 1;
uint16_t _reserved_for_flags: 3;
uint16_t fast_read_dual_output_support : 1; /* 1-1-2 read */
uint16_t fast_read_dual_io_support : 1; /* 1-2-2 read */
uint16_t _reserved_for_flags: 2;
/* Block protection. Currently used by Winbond. */
uint16_t protection_granularity_shift : 5;
uint16_t bp_bits : 3;