diff options
author | Ronald Hoogenboom <hoogenboom30@zonnet.nl> | 2008-01-21 23:55:08 +0000 |
---|---|---|
committer | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2008-01-21 23:55:08 +0000 |
commit | d4554c5d73a4f54b441905f01997c4177bbbfd0d (patch) | |
tree | d1adbe16247193646ead8a875cf7368f0a9ad75a | |
parent | 201bde33d0ee8df9038d15e662f345b2051e60be (diff) | |
download | flashrom-d4554c5d73a4f54b441905f01997c4177bbbfd0d.tar.gz flashrom-d4554c5d73a4f54b441905f01997c4177bbbfd0d.tar.bz2 flashrom-d4554c5d73a4f54b441905f01997c4177bbbfd0d.zip |
Omitting the wait for SPI ready when there is no data to be read, e.g
readcnt==0 saves 10 seconds with the unconditional 10us delay, reducing
programming time for SST25VF016B to 40-45 secs.
Corresponding to flashrom svn r183 and coreboot v2 svn r3068.
Signed-off-by: Ronald Hoogenboom <hoogenboom30@zonnet.nl>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
-rw-r--r-- | spi.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -227,12 +227,15 @@ static int it8716f_spi_command(uint16_t port, unsigned int writecnt, unsigned in * We can't use writecnt directly, but have to use a strange encoding. */ outb(((0x4 + (fast_spi ? 1 : 0)) << 4) | ((readcnt & 0x3) << 2) | (writeenc), port); - do { - busy = inb(port) & 0x80; - } while (busy); - for (i = 0; i < readcnt; i++) { - readarr[i] = inb(port + 5 + i); + if (readcnt > 0) { + do { + busy = inb(port) & 0x80; + } while (busy); + + for (i = 0; i < readcnt; i++) { + readarr[i] = inb(port + 5 + i); + } } return 0; |