[coreboot-gerrit] New patch to review for coreboot: 403d858 drivers/spi: Reduce the per loop delay of spi_flash_cmd_poll_bit()

Dave Frodin (dave.frodin@se-eng.com) gerrit at coreboot.org
Wed Jun 11 21:28:57 CEST 2014


Dave Frodin (dave.frodin at se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5973

-gerrit

commit 403d858b052a37451f399c995cd22a66afa14e16
Author: Dave Frodin <dave.frodin at 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 would be ~9us. The per loop
    delay was 500us which was adding too much delay. This change
    increases the number of loops to poll the device by a factor of 500
    and decreases the per loop delay to 1us.
    
    Change-Id: Ia8b00879135f926c402bbd9d08953c77a2dcc84e
    Signed-off-by: Dave Frodin <dave.frodin at 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..eaf32c2 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 * 500;
 	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(1);
 	} while (timebase--);
 
 	if ((status & poll_bit) == 0)



More information about the coreboot-gerrit mailing list