1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 14:11:15 +02:00

4BA: Allow disabling 4-byte address mode for SPI flash

This allows us to support flash chips in any of the following
configurations, regardless of whether the chip powers up in 3-byte or
4-byte address mode.

- standard commands with extended address register (*_4ba_ereg) or
  direct commands (*_4ba_direct) in 3-byte address mode (.set_4ba =
  spi_exit_4ba_*)
- standard commands (*_4ba) or direct commands (*_4ba_direct) in
  4-byte address mode (.set_4ba = spi_enter_4ba_*)
- direct commands (*_4ba_direct) in either address mode (.set_4ba =
  NULL)

Change-Id: I0b25309d731426940fc50956b744b681ab599e87
Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
Reviewed-on: https://review.coreboot.org/20510
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Ed Swierk
2017-07-03 13:17:18 -07:00
committed by Nico Huber
parent d94d254262
commit cc20a9b08e
3 changed files with 10 additions and 46 deletions

11
flash.h
View File

@ -119,14 +119,7 @@ enum write_granularity {
#define FEATURE_WRSR_EITHER (FEATURE_WRSR_EWSR | FEATURE_WRSR_WREN)
#define FEATURE_OTP (1 << 8)
#define FEATURE_QPI (1 << 9)
/* Feature bits used for 4-bytes addressing mode */
#define FEATURE_4BA_SUPPORT (1 << 10)
#define FEATURE_4BA_ONLY (1 << 11)
#define FEATURE_4BA_EXTENDED_ADDR_REG (1 << 12)
#define FEATURE_4BA_DIRECT_READ (1 << 13)
#define FEATURE_4BA_DIRECT_WRITE (1 << 14)
#define FEATURE_4BA_ALL_ERASERS_DIRECT (1 << 15)
#define FEATURE_4BA_ALL_DIRECT (FEATURE_4BA_DIRECT_READ | FEATURE_4BA_DIRECT_WRITE | FEATURE_4BA_ALL_ERASERS_DIRECT)
#define FEATURE_4BA_SUPPORT (1 << 10)
enum test_state {
OK = 0,
@ -174,7 +167,7 @@ struct flashchip {
/* set of function pointers to use in 4-bytes addressing mode */
struct four_bytes_addr_funcs_set {
int (*enter_4ba) (struct flashctx *flash);
int (*set_4ba) (struct flashctx *flash);
int (*read_nbyte) (struct flashctx *flash, unsigned int addr, uint8_t *bytes, unsigned int len);
int (*program_byte) (struct flashctx *flash, unsigned int addr, const uint8_t databyte);
int (*program_nbyte) (struct flashctx *flash, unsigned int addr, const uint8_t *bytes, unsigned int len);