Author: hailfinger
Date: 2008-01-22 00:55:08 +0100 (Tue, 22 Jan 2008)
New Revision: 3068

Modified:
   trunk/util/flashrom/spi.c
Log:
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 <[EMAIL PROTECTED]>
Acked-by: Carl-Daniel Hailfinger <[EMAIL PROTECTED]>


Modified: trunk/util/flashrom/spi.c
===================================================================
--- trunk/util/flashrom/spi.c   2008-01-21 15:24:22 UTC (rev 3067)
+++ trunk/util/flashrom/spi.c   2008-01-21 23:55:08 UTC (rev 3068)
@@ -227,12 +227,15 @@
         * 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;


-- 
coreboot mailing list
coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to