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.

Signed-off-by: Ronald Hoogenboom <hoogenboom30@zonnet.nl>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3068 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Ronald Hoogenboom 2008-01-21 23:55:08 +00:00 committed by Carl-Daniel Hailfinger
parent 679c62c083
commit 21efd9ffe2
1 changed files with 8 additions and 5 deletions

View File

@ -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. * 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); 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++) { if (readcnt > 0) {
readarr[i] = inb(port + 5 + i); do {
busy = inb(port) & 0x80;
} while (busy);
for (i = 0; i < readcnt; i++) {
readarr[i] = inb(port + 5 + i);
}
} }
return 0; return 0;