mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 14:33:18 +02:00
spi25_statusreg: make register read/write functions generic
This patch adds new spi_{read,write}_register() functions that take the source/destination register as an argument. Currently they can only access SR1, support for other registers will be added in another patch. Since we're refactoring things, this commit also makes spi_read_register() return an error code, making it possible to identify error conditions that spi_read_status_register() concealed. This also removes the initial 100ms delay between writing a register and the first attempt to check the chip's status. An initial delay was added to avoid needing to read the status register multiple times, but that is unlikely to cause problems on modern flash chips. BUG=b:195381327,b:153800563 BRANCH=none TEST=flashrom -{r,w,E} TEST=flashrom --wp-{enable,disable,range,list,status} at end of patch series Change-Id: I0a3951bbf993f2d8d830143b29d3ce16cc6901d7 Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/58475 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
This commit is contained in:

committed by
Anastasia Klimchuk

parent
4571361d0e
commit
a0319804a0
7
flash.h
7
flash.h
@ -166,6 +166,13 @@ struct flashrom_flashctx;
|
||||
#define flashctx flashrom_flashctx /* TODO: Agree on a name and convert all occurences. */
|
||||
typedef int (erasefunc_t)(struct flashctx *flash, unsigned int addr, unsigned int blocklen);
|
||||
|
||||
enum flash_reg {
|
||||
INVALID_REG = 0,
|
||||
STATUS1,
|
||||
STATUS2,
|
||||
MAX_REGISTERS
|
||||
};
|
||||
|
||||
struct flashchip {
|
||||
const char *vendor;
|
||||
const char *name;
|
||||
|
Reference in New Issue
Block a user