[flashrom] [PATCH] Faster Dediprog writes

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Tue Nov 23 00:54:19 CET 2010


On 18.11.2010 16:37, Richard Smith wrote:
> On Wed, Nov 17, 2010 at 11:53 PM, Carl-Daniel Hailfinger
> <c-d.hailfinger.devel.2006 at gmx.net> wrote:
>   
>> Please note that the write speedup only applies to chips which have SPI
>> page write (i.e. chips using spi_chip_write_256).
>>
>> Tests appreciated.
>>
>> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
>>     
>
> I had to tweak the   if (writecnt > 5) {} clause to allow for the
> larger size but other than that this Works For Me. It drops the
> program time on my 128k part to 30 seconds.  Thats quite a bit better
> than the 20 minutes it used to take.
>
> I also verified that chunk sizes larger than 12 fail but I didn't try
> any values between 1 and 12.
>   

Thanks for testing! New patch follows. If I get an ack, I'll commit.

Add chunked write ability to the Dediprog SF100 driver.

Please note that the write speedup only applies to chips which have SPI
page write (i.e. chips using spi_chip_write_256).

This is a quick fix for write speed until I get around to implementing
full bulk SPI write support.

Tests appreciated.

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

Index: flashrom-dediprog_write_chunked/dediprog.c
===================================================================
--- flashrom-dediprog_write_chunked/dediprog.c	(Revision 1234)
+++ flashrom-dediprog_write_chunked/dediprog.c	(Arbeitskopie)
@@ -238,6 +238,12 @@
 	return 0;
 }
 
+int dediprog_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len)
+{
+	/* No idea about the real limit. Maybe 12, maybe more, maybe less. */
+	return spi_write_chunked(flash, buf, start, len, 12);
+}
+
 int dediprog_spi_send_command(unsigned int writecnt, unsigned int readcnt,
 			const unsigned char *writearr, unsigned char *readarr)
 {
@@ -245,7 +251,7 @@
 
 	msg_pspew("%s, writecnt=%i, readcnt=%i\n", __func__, writecnt, readcnt);
 	/* Paranoid, but I don't want to be blamed if anything explodes. */
-	if (writecnt > 5) {
+	if (writecnt > 16) {
 		msg_perr("Untested writecnt=%i, aborting.\n", writecnt);
 		return 1;
 	}
Index: flashrom-dediprog_write_chunked/spi.c
===================================================================
--- flashrom-dediprog_write_chunked/spi.c	(Revision 1234)
+++ flashrom-dediprog_write_chunked/spi.c	(Arbeitskopie)
@@ -124,7 +124,7 @@
 		.command = dediprog_spi_send_command,
 		.multicommand = default_spi_send_multicommand,
 		.read = dediprog_spi_read,
-		.write_256 = spi_chip_write_1,
+		.write_256 = dediprog_spi_write_256,
 	},
 #endif
 
Index: flashrom-dediprog_write_chunked/programmer.h
===================================================================
--- flashrom-dediprog_write_chunked/programmer.h	(Revision 1234)
+++ flashrom-dediprog_write_chunked/programmer.h	(Arbeitskopie)
@@ -472,6 +472,7 @@
 int dediprog_shutdown(void);
 int dediprog_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
 int dediprog_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
+int dediprog_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
 
 /* flashrom.c */
 struct decode_sizes {


-- 
http://www.hailfinger.org/





More information about the flashrom mailing list