[flashrom] [PATCH] Dediprog SF100 support
Carl-Daniel Hailfinger
c-d.hailfinger.devel.2006 at gmx.net
Tue Jan 19 14:57:17 CET 2010
On 19.01.2010 14:36, Carl-Daniel Hailfinger wrote:
> As interim measure, I can increase read chunk size to 16 (speedup factor
> 4) once we know if read works. Once we know read chunk size 16 works, I
> can test bigger chunk sizes up to 64 (USB protocol limit). That would be
> a factor of 16 faster than the current implementation. Maybe not
> perfect, but it would definitely be usable.
> I need those chunk size tests anyway to implement write support.
>
Tests of this patch are appreciated. Please run in verbose (-V) mode,
but not SPEW mode (-VV) because SPEW will slow reading down. Some
timings for a full read would be nice. If we're lucky, full read is
around 5 minutes, but it should not take substantially longer than 10
minutes.
Mark 4 byte RDID as supported by Dediprog.
Increase read size from 4 bytes to 16 bytes (speedup factor 4).
Really abort if any unhandled command sizes are run.
Add some debugging at SPEW level.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Index: flashrom-dediprog_fixups_debug/spi.c
===================================================================
--- flashrom-dediprog_fixups_debug/spi.c (Revision 870)
+++ flashrom-dediprog_fixups_debug/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_fixups_debug/dediprog.c
===================================================================
--- flashrom-dediprog_fixups_debug/dediprog.c (Revision 870)
+++ flashrom-dediprog_fixups_debug/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, 16);
}
int dediprog_spi_send_command(unsigned int writecnt, unsigned int readcnt,
@@ -154,14 +155,24 @@
{
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 != 1) && (writecnt != 4)) {
msg_perr("Untested writecnt=%i, aborting.\n", writecnt);
- if (readcnt > 4)
+ return 1;
+ }
+ /* readcnt > 16 may work, but 64 is definitely the max due to USB
+ * control URB restrictions.
+ */
+ if (readcnt > 16) {
msg_perr("Untested readcnt=%i, aborting.\n", readcnt);
- if ((readcnt == 0) && (writecnt != 1))
+ return 1;
+ }
+ 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