summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/spi/adesto.c3
-rw-r--r--src/drivers/spi/amic.c3
-rw-r--r--src/drivers/spi/atmel.c3
-rw-r--r--src/drivers/spi/eon.c3
-rw-r--r--src/drivers/spi/gigadevice.c3
-rw-r--r--src/drivers/spi/macronix.c3
-rw-r--r--src/drivers/spi/spansion.c3
-rw-r--r--src/drivers/spi/spi_flash.c3
-rw-r--r--src/drivers/spi/sst.c8
-rw-r--r--src/drivers/spi/stmicro.c3
-rw-r--r--src/drivers/spi/winbond.c3
-rw-r--r--src/include/spi-generic.h7
-rw-r--r--src/southbridge/intel/common/spi.c2
13 files changed, 29 insertions, 18 deletions
diff --git a/src/drivers/spi/adesto.c b/src/drivers/spi/adesto.c
index 4e1043edb7..c74fd701c9 100644
--- a/src/drivers/spi/adesto.c
+++ b/src/drivers/spi/adesto.c
@@ -181,7 +181,8 @@ static int adesto_write(const struct spi_flash *flash, u32 offset, size_t len,
goto out;
}
- ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+ ret = spi_flash_cmd_wait_ready(flash,
+ SPI_FLASH_PROG_TIMEOUT_MS);
if (ret)
goto out;
diff --git a/src/drivers/spi/amic.c b/src/drivers/spi/amic.c
index b580dc3df0..6e1234baa7 100644
--- a/src/drivers/spi/amic.c
+++ b/src/drivers/spi/amic.c
@@ -155,7 +155,8 @@ static int amic_write(const struct spi_flash *flash, u32 offset, size_t len,
goto out;
}
- ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+ ret = spi_flash_cmd_wait_ready(flash,
+ SPI_FLASH_PROG_TIMEOUT_MS);
if (ret)
goto out;
diff --git a/src/drivers/spi/atmel.c b/src/drivers/spi/atmel.c
index 58a2862eeb..ac7f0d92e7 100644
--- a/src/drivers/spi/atmel.c
+++ b/src/drivers/spi/atmel.c
@@ -137,7 +137,8 @@ static int atmel_write(const struct spi_flash *flash, u32 offset, size_t len,
goto out;
}
- ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+ ret = spi_flash_cmd_wait_ready(flash,
+ SPI_FLASH_PROG_TIMEOUT_MS);
if (ret)
goto out;
diff --git a/src/drivers/spi/eon.c b/src/drivers/spi/eon.c
index f3cf70ef1b..c6fdba17b8 100644
--- a/src/drivers/spi/eon.c
+++ b/src/drivers/spi/eon.c
@@ -270,7 +270,8 @@ static int eon_write(const struct spi_flash *flash,
goto out;
}
- ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+ ret = spi_flash_cmd_wait_ready(flash,
+ SPI_FLASH_PROG_TIMEOUT_MS);
if (ret) {
printk(BIOS_WARNING, "SF: EON Page Program timeout\n");
goto out;
diff --git a/src/drivers/spi/gigadevice.c b/src/drivers/spi/gigadevice.c
index 1ff594a24a..71433cc1ed 100644
--- a/src/drivers/spi/gigadevice.c
+++ b/src/drivers/spi/gigadevice.c
@@ -212,7 +212,8 @@ static int gigadevice_write(const struct spi_flash *flash, u32 offset,
goto out;
}
- ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+ ret = spi_flash_cmd_wait_ready(flash,
+ SPI_FLASH_PROG_TIMEOUT_MS);
if (ret)
goto out;
diff --git a/src/drivers/spi/macronix.c b/src/drivers/spi/macronix.c
index 5a97b8f794..a41e96f671 100644
--- a/src/drivers/spi/macronix.c
+++ b/src/drivers/spi/macronix.c
@@ -249,7 +249,8 @@ static int macronix_write(const struct spi_flash *flash, u32 offset, size_t len,
break;
}
- ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+ ret = spi_flash_cmd_wait_ready(flash,
+ SPI_FLASH_PROG_TIMEOUT_MS);
if (ret)
break;
diff --git a/src/drivers/spi/spansion.c b/src/drivers/spi/spansion.c
index 4a241baf09..c3a071e956 100644
--- a/src/drivers/spi/spansion.c
+++ b/src/drivers/spi/spansion.c
@@ -264,7 +264,8 @@ static int spansion_write(const struct spi_flash *flash, u32 offset, size_t len,
break;
}
- ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+ ret = spi_flash_cmd_wait_ready(flash,
+ SPI_FLASH_PROG_TIMEOUT_MS);
if (ret)
break;
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c
index a81306e386..cfa500e6dd 100644
--- a/src/drivers/spi/spi_flash.c
+++ b/src/drivers/spi/spi_flash.c
@@ -232,7 +232,8 @@ int spi_flash_cmd_erase(const struct spi_flash *flash, u32 offset, size_t len)
if (ret)
goto out;
- ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PAGE_ERASE_TIMEOUT);
+ ret = spi_flash_cmd_wait_ready(flash,
+ SPI_FLASH_PAGE_ERASE_TIMEOUT_MS);
if (ret)
goto out;
}
diff --git a/src/drivers/spi/sst.c b/src/drivers/spi/sst.c
index abe3f2ace6..429afa095d 100644
--- a/src/drivers/spi/sst.c
+++ b/src/drivers/spi/sst.c
@@ -179,7 +179,7 @@ sst_byte_write(const struct spi_flash *flash, u32 offset, const void *buf)
if (ret)
return ret;
- return spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+ return spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT_MS);
}
static int sst_write_256(const struct spi_flash *flash, u32 offset, size_t len,
@@ -239,7 +239,8 @@ static int sst_write_256(const struct spi_flash *flash, u32 offset, size_t len,
break;
}
- ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+ ret = spi_flash_cmd_wait_ready(flash,
+ SPI_FLASH_PROG_TIMEOUT_MS);
if (ret)
break;
@@ -294,7 +295,8 @@ static int sst_write_ai(const struct spi_flash *flash, u32 offset, size_t len,
break;
}
- ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+ ret = spi_flash_cmd_wait_ready(flash,
+ SPI_FLASH_PROG_TIMEOUT_MS);
if (ret)
break;
diff --git a/src/drivers/spi/stmicro.c b/src/drivers/spi/stmicro.c
index 6625764268..98f6e4e5b2 100644
--- a/src/drivers/spi/stmicro.c
+++ b/src/drivers/spi/stmicro.c
@@ -331,7 +331,8 @@ static int stmicro_write(const struct spi_flash *flash,
goto out;
}
- ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+ ret = spi_flash_cmd_wait_ready(flash,
+ SPI_FLASH_PROG_TIMEOUT_MS);
if (ret)
goto out;
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c
index 9e9bb00464..3e0a2669d9 100644
--- a/src/drivers/spi/winbond.c
+++ b/src/drivers/spi/winbond.c
@@ -326,7 +326,8 @@ static int winbond_write(const struct spi_flash *flash, u32 offset, size_t len,
goto out;
}
- ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
+ ret = spi_flash_cmd_wait_ready(flash,
+ SPI_FLASH_PROG_TIMEOUT_MS);
if (ret)
goto out;
diff --git a/src/include/spi-generic.h b/src/include/spi-generic.h
index 93704f81d9..ffd3d2d008 100644
--- a/src/include/spi-generic.h
+++ b/src/include/spi-generic.h
@@ -20,10 +20,9 @@
* is a problem (and well your system already is broken), so err on the side
* of caution in case we're dealing with slower SPI buses and/or processors.
*/
-#define CONF_SYS_HZ 100
-#define SPI_FLASH_PROG_TIMEOUT (2 * CONF_SYS_HZ)
-#define SPI_FLASH_PAGE_ERASE_TIMEOUT (5 * CONF_SYS_HZ)
-#define SPI_FLASH_SECTOR_ERASE_TIMEOUT (10 * CONF_SYS_HZ)
+#define SPI_FLASH_PROG_TIMEOUT_MS 200
+#define SPI_FLASH_PAGE_ERASE_TIMEOUT_MS 500
+#define SPI_FLASH_SECTOR_ERASE_TIMEOUT_MS 1000
#include <commonlib/region.h>
#include <stdint.h>
diff --git a/src/southbridge/intel/common/spi.c b/src/southbridge/intel/common/spi.c
index 6fece4f615..3244808179 100644
--- a/src/southbridge/intel/common/spi.c
+++ b/src/southbridge/intel/common/spi.c
@@ -726,7 +726,7 @@ static int ich_hwseq_erase(const struct spi_flash *flash, u32 offset,
u32 start, end, erase_size;
int ret;
uint16_t hsfc;
- unsigned int timeout = 1000 * SPI_FLASH_SECTOR_ERASE_TIMEOUT;
+ unsigned int timeout = 1000 * SPI_FLASH_SECTOR_ERASE_TIMEOUT_MS;
erase_size = flash->sector_size;
if (offset % erase_size || len % erase_size) {