diff options
author | Nikolai Artemiev <nartemiev@google.com> | 2021-10-28 16:18:28 +1100 |
---|---|---|
committer | Edward O'Callaghan <quasisec@chromium.org> | 2022-04-05 02:26:09 +0000 |
commit | 005d32b7b781c355f22d04ceb532c4fa4656801a (patch) | |
tree | c6dbbcfc944b256fca7208bd93beb4a2838123d2 /spi25.c | |
parent | e5389d1b8fa18932a7aa3be5fee094c5023d1251 (diff) | |
download | flashrom-005d32b7b781c355f22d04ceb532c4fa4656801a.tar.gz flashrom-005d32b7b781c355f22d04ceb532c4fa4656801a.tar.bz2 flashrom-005d32b7b781c355f22d04ceb532c4fa4656801a.zip |
spi25_statusreg: delete spi_read_status_register()
Delete the spi_read_status_register() function because the generic
spi_read_register() function can be used instead.
This patch also converts all call sites over to spi_read_register().
A side effect is that error codes are now properly propagated and
checked.
BUG=b:195381327,b:153800563
BRANCH=none
TEST=flashrom -{r,w,E}
TEST=Tested with a W25Q128.W flash on a kasumi (AMD) dut.
Read SR1/SR2 with --wp-status and activated various WP ranges
that toggled bits in both SR1 and SR2.
Change-Id: I146b4b5439872e66c5d33e156451a729d248c7da
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/59529
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Diffstat (limited to 'spi25.c')
-rw-r--r-- | spi25.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -304,12 +304,17 @@ int probe_spi_at25f(struct flashctx *flash) static int spi_poll_wip(struct flashctx *const flash, const unsigned int poll_delay) { - /* FIXME: We can't tell if spi_read_status_register() failed. */ /* FIXME: We don't time out. */ - while (spi_read_status_register(flash) & SPI_SR_WIP) + while (true) { + uint8_t status; + int ret = spi_read_register(flash, STATUS1, &status); + if (ret) + return ret; + if (!(status & SPI_SR_WIP)) + return 0; + programmer_delay(poll_delay); - /* FIXME: Check the status register for errors. */ - return 0; + } } /** |