Submitter | Carl-Daniel Hailfinger |
---|---|
Date | 2010-01-19 13:57:17 |
Message ID | <4B55BA3D.6040303@gmx.net> |
Download | mbox | patch |
Permalink | /patch/816/ |
State | Superseded |
Headers | show |
Comments
On 1/19/10 2:57 PM, Carl-Daniel Hailfinger wrote: > 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. > It assumes that an ID of 00 00 is a "generic SPI chip". Instead it means there is no chip connected. ./flashrom -pdediprog flashrom v0.9.1-r878 Calibrating delay loop... OK. Found chip "Generic unknown SPI chip (RDID)" (0 KB, SPI) at physical address 0x0. === This flash part has status NOT WORKING for operations: PROBE READ ERASE WRITE Please email a report to flashrom@flashrom.org if any of the above operations work correctly for you with this flash part. Please include the flashrom output with the additional -V option for all operations you tested (-V, -rV, -wV, -EV), and mention which mainboard or programmer you tested. Thanks for your help! === No operations were specified.
Patch
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) {