Dave Frodin (dave.frodin@se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5973
-gerrit
commit 582f05bae1f61330c6909608bcfb405b9e015951 Author: Dave Frodin dave.frodin@se-eng.com Date: Wed Jun 11 12:53:47 2014 -0600
drivers/spi: Reduce the per loop delay of spi_flash_cmd_poll_bit()
At the end of some SPI operations the SPI device needs to be polled to determine if it is done with the operation. For SPI data writes the predicted time of that operation could be less than 10us. The per loop delay of 500us is adding too much delay. This change increases the number of loops to poll the device by a factor of 100 and decreases the per loop delay to 5us.
Change-Id: Ia8b00879135f926c402bbd9d08953c77a2dcc84e Signed-off-by: Dave Frodin dave.frodin@se-eng.com --- src/drivers/spi/spi_flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/drivers/spi/spi_flash.c b/src/drivers/spi/spi_flash.c index 33588d5..d3a6b66 100644 --- a/src/drivers/spi/spi_flash.c +++ b/src/drivers/spi/spi_flash.c @@ -110,7 +110,7 @@ int spi_flash_cmd_poll_bit(struct spi_flash *flash, unsigned long timeout, int ret; u8 status;
- timebase = timeout; + timebase = timeout * 100; do { ret = spi_flash_cmd_read(spi, &cmd, 1, &status, 1); if (ret) @@ -119,7 +119,7 @@ int spi_flash_cmd_poll_bit(struct spi_flash *flash, unsigned long timeout, if ((status & poll_bit) == 0) break;
- udelay(500); + udelay(5); } while (timebase--);
if ((status & poll_bit) == 0)