include/spi-generic: Append unit to macro names

This patch appends a unit (milliseconds) to time-out macro names for
better understanding the code which is using the macros.

Change-Id: Ibc4beda2660a83fd5f0ed325b2ee3148c6d96639
Signed-off-by: Uwe Poeche <uwe.poeche@siemens.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34384
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Uwe Poeche 2019-07-17 14:27:13 +02:00 committed by Martin Roth
parent 868c8074b5
commit 17362bee85
13 changed files with 29 additions and 18 deletions

View File

@ -181,7 +181,8 @@ static int adesto_write(const struct spi_flash *flash, u32 offset, size_t len,
goto out; 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) if (ret)
goto out; goto out;

View File

@ -155,7 +155,8 @@ static int amic_write(const struct spi_flash *flash, u32 offset, size_t len,
goto out; 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) if (ret)
goto out; goto out;

View File

@ -137,7 +137,8 @@ static int atmel_write(const struct spi_flash *flash, u32 offset, size_t len,
goto out; 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) if (ret)
goto out; goto out;

View File

@ -270,7 +270,8 @@ static int eon_write(const struct spi_flash *flash,
goto out; 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) { if (ret) {
printk(BIOS_WARNING, "SF: EON Page Program timeout\n"); printk(BIOS_WARNING, "SF: EON Page Program timeout\n");
goto out; goto out;

View File

@ -212,7 +212,8 @@ static int gigadevice_write(const struct spi_flash *flash, u32 offset,
goto out; 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) if (ret)
goto out; goto out;

View File

@ -249,7 +249,8 @@ static int macronix_write(const struct spi_flash *flash, u32 offset, size_t len,
break; 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) if (ret)
break; break;

View File

@ -264,7 +264,8 @@ static int spansion_write(const struct spi_flash *flash, u32 offset, size_t len,
break; 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) if (ret)
break; break;

View File

@ -232,7 +232,8 @@ int spi_flash_cmd_erase(const struct spi_flash *flash, u32 offset, size_t len)
if (ret) if (ret)
goto out; 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) if (ret)
goto out; goto out;
} }

View File

@ -179,7 +179,7 @@ sst_byte_write(const struct spi_flash *flash, u32 offset, const void *buf)
if (ret) if (ret)
return 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, 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; 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) if (ret)
break; break;
@ -294,7 +295,8 @@ static int sst_write_ai(const struct spi_flash *flash, u32 offset, size_t len,
break; 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) if (ret)
break; break;

View File

@ -331,7 +331,8 @@ static int stmicro_write(const struct spi_flash *flash,
goto out; 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) if (ret)
goto out; goto out;

View File

@ -326,7 +326,8 @@ static int winbond_write(const struct spi_flash *flash, u32 offset, size_t len,
goto out; 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) if (ret)
goto out; goto out;

View File

@ -20,10 +20,9 @@
* is a problem (and well your system already is broken), so err on the side * 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. * of caution in case we're dealing with slower SPI buses and/or processors.
*/ */
#define CONF_SYS_HZ 100 #define SPI_FLASH_PROG_TIMEOUT_MS 200
#define SPI_FLASH_PROG_TIMEOUT (2 * CONF_SYS_HZ) #define SPI_FLASH_PAGE_ERASE_TIMEOUT_MS 500
#define SPI_FLASH_PAGE_ERASE_TIMEOUT (5 * CONF_SYS_HZ) #define SPI_FLASH_SECTOR_ERASE_TIMEOUT_MS 1000
#define SPI_FLASH_SECTOR_ERASE_TIMEOUT (10 * CONF_SYS_HZ)
#include <commonlib/region.h> #include <commonlib/region.h>
#include <stdint.h> #include <stdint.h>

View File

@ -726,7 +726,7 @@ static int ich_hwseq_erase(const struct spi_flash *flash, u32 offset,
u32 start, end, erase_size; u32 start, end, erase_size;
int ret; int ret;
uint16_t hsfc; 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; erase_size = flash->sector_size;
if (offset % erase_size || len % erase_size) { if (offset % erase_size || len % erase_size) {