Uwe Poeche has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34384 )
Change subject: include/spi-generic: clean up FLASH TIMEOUTs ......................................................................
include/spi-generic: clean up FLASH TIMEOUTs
This patch provides as follow up of patch 983a2ef65c an cleanup of defines for FLASH TIMEOUTs and the following necessary changes in the source files which use these defines.
Change-Id: Ibc4beda2660a83fd5f0ed325b2ee3148c6d96639 Signed-off-by: Uwe Poeche uwe.poeche@siemens.com --- M src/drivers/spi/adesto.c M src/drivers/spi/amic.c M src/drivers/spi/atmel.c M src/drivers/spi/eon.c M src/drivers/spi/gigadevice.c M src/drivers/spi/macronix.c M src/drivers/spi/spansion.c M src/drivers/spi/spi_flash.c M src/drivers/spi/sst.c M src/drivers/spi/stmicro.c M src/drivers/spi/winbond.c M src/include/spi-generic.h M src/southbridge/intel/common/spi.c 13 files changed, 29 insertions(+), 18 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/34384/1
diff --git a/src/drivers/spi/adesto.c b/src/drivers/spi/adesto.c index 4e1043e..c74fd70 100644 --- a/src/drivers/spi/adesto.c +++ b/src/drivers/spi/adesto.c @@ -181,7 +181,8 @@ 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 b580dc3..6e1234b 100644 --- a/src/drivers/spi/amic.c +++ b/src/drivers/spi/amic.c @@ -155,7 +155,8 @@ 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 58a2862..ac7f0d9 100644 --- a/src/drivers/spi/atmel.c +++ b/src/drivers/spi/atmel.c @@ -137,7 +137,8 @@ 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 f3cf70e..c6fdba1 100644 --- a/src/drivers/spi/eon.c +++ b/src/drivers/spi/eon.c @@ -270,7 +270,8 @@ 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 1ff594a..71433cc 100644 --- a/src/drivers/spi/gigadevice.c +++ b/src/drivers/spi/gigadevice.c @@ -212,7 +212,8 @@ 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 5a97b8f..a41e96f 100644 --- a/src/drivers/spi/macronix.c +++ b/src/drivers/spi/macronix.c @@ -249,7 +249,8 @@ 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 4a241ba..c3a071e 100644 --- a/src/drivers/spi/spansion.c +++ b/src/drivers/spi/spansion.c @@ -264,7 +264,8 @@ 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 a81306e..cfa500e 100644 --- a/src/drivers/spi/spi_flash.c +++ b/src/drivers/spi/spi_flash.c @@ -232,7 +232,8 @@ 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 abe3f2a..429afa0 100644 --- a/src/drivers/spi/sst.c +++ b/src/drivers/spi/sst.c @@ -179,7 +179,7 @@ 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 @@ 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 @@ 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 6625764..98f6e4e 100644 --- a/src/drivers/spi/stmicro.c +++ b/src/drivers/spi/stmicro.c @@ -331,7 +331,8 @@ 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 9e9bb00..3e0a266 100644 --- a/src/drivers/spi/winbond.c +++ b/src/drivers/spi/winbond.c @@ -326,7 +326,8 @@ 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 93704f8..ffd3d2d 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 6fece4f..3244808 100644 --- a/src/southbridge/intel/common/spi.c +++ b/src/southbridge/intel/common/spi.c @@ -726,7 +726,7 @@ 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) {