Make sure we delay writing the next byte long enough in SPI byte

programming.
Minor formatting changes.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Harald Gutmann <harald.gutmann@gmx.net>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3069 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Carl-Daniel Hailfinger 2008-01-22 14:37:31 +00:00
parent 21efd9ffe2
commit 468413a337
1 changed files with 19 additions and 22 deletions

View File

@ -519,12 +519,8 @@ int it8716f_over512k_spi_chip_write(struct flashchip *flash, uint8_t *buf)
for (i = 0; i < total_size; i++) {
generic_spi_write_enable();
spi_byte_program(i, buf[i]);
/* FIXME: We really should read the status register and delay
* accordingly.
*/
//while (generic_spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
while (generic_spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
myusec_delay(10);
//if (i%1024==0) fputc('b',stderr);
}
/* resume normal ops... */
outb(0x20, it8716f_flashport);
@ -556,7 +552,8 @@ int generic_spi_chip_read(struct flashchip *flash, uint8_t *buf)
if (total_size > 512 * 1024) {
for (i = 0; i < total_size; i += 3) {
int toread = 3;
if (total_size-i < toread) toread=total_size-i;
if (total_size - i < toread)
toread = total_size - i;
spi_3byte_read(i, buf + i, toread);
}
} else {