Submitter | Carl-Daniel Hailfinger |
---|---|
Date | 2010-01-22 02:44:59 |
Message ID | <4B59112B.1090700@gmx.net> |
Download | mbox | patch |
Permalink | /patch/829/ |
State | Accepted |
Commit | r879 |
Headers | show |
Comments
On 22.01.2010 03:44, Carl-Daniel Hailfinger wrote: > On 21.01.2010 21:50, Stefan Reinauer wrote: > >> On 1/21/10 10:26 AM, Carl-Daniel Hailfinger wrote: >> >> >>> 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@gmx.net> >>> >>> >> Acked-by: Stefan Reinauer <stepan@coresystems.de> >> > > Thanks for the ack, I'll reuse it for the 16 byte variant. It seems that > while Patrick is getting no error messages for 256 byte transfers, they > explode for you. Since Patrick is also seeing corruption with large > transfers, I hope we can use your machine to test the real limits and > actually get error messages from the OS instead of corrupt data. > [...] > > Add write support. > Speed up reads by a factor of 4 by switching block size from 4 to 16. > Add support for 4 byte RDID. > Add USB error decoding via usb_strerror as well. > Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> > Thanks for testing. As stated above I'm reusing your ack. Acked-by: Stefan Reinauer <stepan@coresystems.de> and committed in r879. Regards, Carl-Daniel
On 22.01.2010 03:53, Carl-Daniel Hailfinger wrote: > On 22.01.2010 03:44, Carl-Daniel Hailfinger wrote: > >> Add write support. >> Speed up reads by a factor of 4 by switching block size from 4 to 16. >> Add support for 4 byte RDID. >> > > Add USB error decoding via usb_strerror as well. > > and committed in r879. > Just FYI. What's currently in the tree may be slow, but it should work reliably for reads and writes, and be 4x faster than the old code. I expect 5-10 minutes for read and erase (because erase does a read to verify), and too long (40 minutes, maybe more, maybe less) for write. Write hasn't seen any optimization yet. >16 byte non-opaque transfers still have to be figured out on the new SF100 software/firmware. Does the new software/firmware have any size limitations for user-defined command streams? If not, a USB log of sending "03 00 00 00" and receiving 32 bytes, and a log of the same sequence receiving 64 bytes, both with the new firmware, would be very helpful. Regards, Carl-Daniel
Patch
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); + /* Chosen 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,19 +155,22 @@ { 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 > 5) { msg_perr("Untested writecnt=%i, aborting.\n", writecnt); - if (readcnt > 4) + return 1; + } + /* 16 byte reads should work. */ + if (readcnt > 16) { 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) { - msg_perr("Command Send SPI failed, ret=%i, expected %i!\n", - ret, writecnt); + msg_perr("Send SPI failed, expected %i, got %i %s!\n", + writecnt, ret, usb_strerror()); return 1; } if (!readcnt) @@ -174,8 +178,8 @@ memset(readarr, 0, readcnt); ret = usb_control_msg(dediprog_handle, 0xc2, 0x01, 0xbb8, 0x0000, (char *)readarr, readcnt, DEFAULT_TIMEOUT); if (ret != readcnt) { - msg_perr("Command Receive SPI failed, ret=%i, expected %i!\n", - ret, readcnt); + msg_perr("Receive SPI failed, expected %i, got %i %s!\n", + readcnt, ret, usb_strerror()); return 1; } return 0;