summaryrefslogtreecommitdiffstats
path: root/flash.h
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2017-11-10 21:10:20 +0100
committerNico Huber <nico.h@gmx.de>2018-01-02 20:15:30 +0000
commitfe34d2af28bd81aaa1e23ba38febaa98ec4bb90c (patch)
tree53bda4d3445a94505455ffb12a96da602ba97af6 /flash.h
parent1cf407b4f8d56035816efaf936a40553441eca46 (diff)
downloadflashrom-fe34d2af28bd81aaa1e23ba38febaa98ec4bb90c.tar.gz
flashrom-fe34d2af28bd81aaa1e23ba38febaa98ec4bb90c.tar.bz2
flashrom-fe34d2af28bd81aaa1e23ba38febaa98ec4bb90c.zip
spi25: Revise decision when to enter/exit 4BA mode
Instead of arbitrarily deciding whether to enter 4BA mode in the flash chip's declaration, advertise that entering 4BA mode is supported and only enter it if the SPI master supports 4-byte addresses. If not, exit 4BA mode (the chip might be in 4BA mode after reset). If we can't assure the state of 4BA mode, we bail out to simplify the code (we'd have to ensure that we don't run any instructions that can usually be switched to 4BA mode otherwise). Two new feature flags are introduced: * FEATURE_4BA_ENTER: Can enter/exit 4BA mode with instructions 0xb7/0xe9 w/o WREN. * FEATURE_4BA_ENTER_WREN Can enter/exit 4BA mode with instructions 0xb7/0xe9 after WREN. FEATURE_4BA_SUPPORT is dropped, it's completely implicit now. Also, draw the with/without WREN distinction into the enter/exit functions to reduce code redundancy. Change-Id: I877fe817f801fc54bd0ee2ce4e3ead324cbb3673 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/22422 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Diffstat (limited to 'flash.h')
-rw-r--r--flash.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/flash.h b/flash.h
index a14c30299..6e86c3545 100644
--- a/flash.h
+++ b/flash.h
@@ -119,11 +119,12 @@ enum write_granularity {
#define FEATURE_WRSR_EITHER (FEATURE_WRSR_EWSR | FEATURE_WRSR_WREN)
#define FEATURE_OTP (1 << 8)
#define FEATURE_QPI (1 << 9)
-#define FEATURE_4BA_SUPPORT (1 << 10)
-#define FEATURE_4BA_EXT_ADDR (1 << 11) /**< Regular 3-byte operations can be used by writing the most
+#define FEATURE_4BA_ENTER (1 << 10) /**< Can enter/exit 4BA mode with instructions 0xb7/0xe9 w/o WREN */
+#define FEATURE_4BA_ENTER_WREN (1 << 11) /**< Can enter/exit 4BA mode with instructions 0xb7/0xe9 after WREN */
+#define FEATURE_4BA_EXT_ADDR (1 << 12) /**< Regular 3-byte operations can be used by writing the most
significant address byte into an extended address register. */
-#define FEATURE_4BA_READ (1 << 12) /**< Native 4BA read instruction (0x13) is supported. */
-#define FEATURE_4BA_WRITE (1 << 13) /**< Native 4BA byte program (0x12) is supported. */
+#define FEATURE_4BA_READ (1 << 13) /**< Native 4BA read instruction (0x13) is supported. */
+#define FEATURE_4BA_WRITE (1 << 14) /**< Native 4BA byte program (0x12) is supported. */
enum test_state {
OK = 0,
@@ -205,7 +206,6 @@ struct flashchip {
int (*unlock) (struct flashctx *flash);
int (*write) (struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
int (*read) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
- int (*set_4ba) (struct flashctx *flash);
struct voltage {
uint16_t min;
uint16_t max;