summaryrefslogtreecommitdiffstats
path: root/s25f.c
diff options
context:
space:
mode:
Diffstat (limited to 's25f.c')
-rw-r--r--s25f.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/s25f.c b/s25f.c
index 0bd4a7cbe..82ca61069 100644
--- a/s25f.c
+++ b/s25f.c
@@ -133,9 +133,14 @@ static int s25fs_software_reset(struct flashctx *flash)
static int s25f_poll_status(const struct flashctx *flash)
{
- uint8_t tmp = spi_read_status_register(flash);
+ while (true) {
+ uint8_t tmp;
+ if (spi_read_register(flash, STATUS1, &tmp))
+ return -1;
+
+ if ((tmp & SPI_SR_WIP) == 0)
+ break;
- while (tmp & SPI_SR_WIP) {
/*
* The WIP bit on S25F chips remains set to 1 if erase or
* programming errors occur, so we must check for those
@@ -156,7 +161,6 @@ static int s25f_poll_status(const struct flashctx *flash)
}
programmer_delay(1000 * 10);
- tmp = spi_read_status_register(flash);
}
return 0;