[coreboot] SST25VF016B (2MB) flash on m57sli (IT8716F).

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Sat Jan 19 01:18:11 CET 2008


On 19.01.2008 01:08, Carl-Daniel Hailfinger wrote:
> On 19.01.2008 00:17, Ronald Hoogenboom wrote:
>   
>> On Fri, 2008-01-18 at 23:31 +0100, Carl-Daniel Hailfinger wrote:
>>   
>>     
>>> Thanks for reworking the code! I have factored out some common status
>>> registers to duplicate less code and hope the code still works. Could
>>> you please review it and tell me what you think?
>>>
>>>     
>>>       
>> Fine by me, works like a charm, the way I meant it to work ;-).
>>   
>>     
>
> Thanks, checked in and added you as copyright holder. Revision 3061.
>   

What about the following patch on top of it?

Make sure we delay writing the next byte long enough in SPI byte
programming. This could even result in a speedup.
Print a "b" for every kByte written to flash.
Minor formatting changes.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Index: spi.c
===================================================================
--- spi.c	(Revision 3061)
+++ spi.c	(Arbeitskopie)
@@ -516,12 +516,10 @@
 	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);
+		if (i % 1024 == 0)
+			printf("b");
 	}
 	/* resume normal ops... */
 	outb(0x20, it8716f_flashport);
@@ -553,7 +551,8 @@
 	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 {


Regards,
Carl-Daniel





More information about the coreboot mailing list