[flashrom] [PATCH] Dediprog SF100 support

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Thu Jan 21 10:26:45 CET 2010


On 19.01.2010 13:14, Stefan Reinauer wrote:
> On 1/19/10 1:08 PM, Carl-Daniel Hailfinger wrote:
>   
>> The file specified by -r will only be filled
>> with contents after the read is complete.
>>   
>>     
> Maybe it shouldn't be created before that, either, then?
>   

Hm. If we read for a few minutes, then we notice that the file can't be
created, users will be very unhappy. An alternative would be to remove
the file if read failed, or create it with a temp name and move it into
place at the end.


>> I see a speedup by a factor of 4 on the horizon, but I will implement
>> that only after I get confirmation that read works correctly (would be
>> pointless otherwise).
>>   
>>     
> Requiring 10 minutes to read the chip is still kind of pointless, so I
> don't know if it's worth the effort if the driver can't be generally fixed.
>   

Thanks to Patrick Georgi and his tireless log generation, I was able to
find out how to get good speed out of the dumb mode of the SF100. Write
now works (very slow, slower than the old read, but definitely fixable),
but read speed should now be roughly half the speed of the windows
driver. At least that's the prognosis. Given that we use control
transfers instead of bulk transfers, we have more overhead, but 100%
control over the SPI commands. The windows driver can't do that. Plus,
we're firmware independent with my approach.

Changelog:
Add write support.
Speed up reads by a factor of 64 by switching block size from 4 to 256.
Add support for 4 byte RDID.

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

Index: flashrom-dediprog_bigchunks/spi.c
===================================================================
--- flashrom-dediprog_bigchunks/spi.c	(Revision 877)
+++ flashrom-dediprog_bigchunks/spi.c	(Arbeitskopie)
@@ -335,6 +335,9 @@
 #if BUSPIRATE_SPI_SUPPORT == 1
 	case SPI_CONTROLLER_BUSPIRATE:
 #endif
+#if DEDIPROG_SUPPORT == 1
+	case SPI_CONTROLLER_DEDIPROG:
+#endif
 		return probe_spi_rdid_generic(flash, 4);
 	default:
 		printf_debug("4b ID not supported on this SPI controller\n");
Index: flashrom-dediprog_bigchunks/dediprog.c
===================================================================
--- flashrom-dediprog_bigchunks/dediprog.c	(Revision 877)
+++ flashrom-dediprog_bigchunks/dediprog.c	(Arbeitskopie)
@@ -145,8 +145,9 @@
 
 int dediprog_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len)
 {
-	/* Maximum read length is 4 bytes for now. */
-	return spi_read_chunked(flash, buf, start, len, 4);
+	msg_pspew("%s, start=0x%x, len=0x%x\n", __func__, start, len);
+	/* Maximum read length is 16 bytes for now. */
+	return spi_read_chunked(flash, buf, start, len, 256);
 }
 
 int dediprog_spi_send_command(unsigned int writecnt, unsigned int readcnt,
@@ -154,14 +155,17 @@
 {
 	int ret;
 
+	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 != 1) && (writecnt != 4))
+	if (writecnt > 7) {
 		msg_perr("Untested writecnt=%i, aborting.\n", writecnt);
-	if (readcnt > 4)
+		return 1;
+	}
+	/* readcnt=513 was tested, but let's keep this sane. */
+	if (readcnt > 256) {
 		msg_perr("Untested readcnt=%i, aborting.\n", readcnt);
-	if ((readcnt == 0) && (writecnt != 1))
-		msg_perr("Untested writecnt=%i, readcnt=%i combination, "
-			 "aborting.\n", writecnt, readcnt);
+		return 1;
+	}
 	
 	ret = usb_control_msg(dediprog_handle, 0x42, 0x1, 0xff, readcnt ? 0x1 : 0x0, (char *)writearr, writecnt, DEFAULT_TIMEOUT);
 	if (ret != writecnt) {


-- 
Developer quote of the year:
"We are juggling too many chainsaws and flaming arrows and tigers."





More information about the flashrom mailing list