Every SPI programmer driver had its own completely different chip write implementation, and all of them were insufficiently commented. Create spi_write_chunked as a copy of spi_read_chunked and convert all SPI programmers to use it. No functional changes except: - Bus Pirate uses 12 Byte writes instead of 8 Byte writes - SB600 uses 5 Byte writes instead of 1 Byte writes
Should work. Not for 0.9.1, but since I had that thing on my disk anyway, I figured I'd post it to the list in case someone wants to experiment with partial writes. Tests appreciated.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-partial_write_spi/spi25.c =================================================================== --- flashrom-partial_write_spi/spi25.c (Revision 982) +++ flashrom-partial_write_spi/spi25.c (Arbeitskopie) @@ -1,7 +1,7 @@ /* * This file is part of the flashrom project. * - * Copyright (C) 2007, 2008, 2009 Carl-Daniel Hailfinger + * Copyright (C) 2007, 2008, 2009, 2010 Carl-Daniel Hailfinger * Copyright (C) 2008 coresystems GmbH * * This program is free software; you can redistribute it and/or modify @@ -874,7 +874,7 @@ }
/* - * Read a complete flash chip. + * Read a part of the flash chip. * Each page is read separately in chunks with a maximum size of chunksize. */ int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize) @@ -913,6 +913,52 @@ }
/* + * Write a part of the flash chip. + * Each page is written separately in chunks with a maximum size of chunksize. + */ +int spi_write_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize) +{ + int rc = 0; + int i, j, starthere, lenhere; + /* FIXME: page_size is the wrong variable. We need max_writechunk_size + * in struct flashchip to do this properly. All chips using + * spi_chip_write_256 have page_size set to max_writechunk_size, so + * we're OK for now. + */ + int page_size = flash->page_size; + int towrite; + + /* Warning: This loop has a very unusual condition and body. + * The loop needs to go through each page with at least one affected + * byte. The lowest page number is (start / page_size) since that + * division rounds down. The highest page number we want is the page + * where the last byte of the range lives. That last byte has the + * address (start + len - 1), thus the highest page number is + * (start + len - 1) / page_size. Since we want to include that last + * page as well, the loop condition uses <=. + */ + for (i = start / page_size; i <= (start + len - 1) / page_size; i++) { + /* Byte position of the first byte in the range in this page. */ + /* starthere is an offset to the base address of the chip. */ + starthere = max(start, i * page_size); + /* Length of bytes in the range in this page. */ + lenhere = min(start + len, (i + 1) * page_size) - starthere; + for (j = 0; j < lenhere; j += chunksize) { + towrite = min(chunksize, lenhere - j); + rc = spi_nbyte_program(starthere + j, buf + starthere - start + j, towrite); + if (rc) + break; + while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) + programmer_delay(10); + } + if (rc) + break; + } + + return rc; +} + +/* * Program chip using byte programming. (SLOW!) * This is for chips which can only handle one byte writes * and for chips where memory mapped programming is impossible Index: flashrom-partial_write_spi/buspirate_spi.c =================================================================== --- flashrom-partial_write_spi/buspirate_spi.c (Revision 982) +++ flashrom-partial_write_spi/buspirate_spi.c (Arbeitskopie) @@ -1,7 +1,7 @@ /* * This file is part of the flashrom project. * - * Copyright (C) 2009 Carl-Daniel Hailfinger + * Copyright (C) 2009, 2010 Carl-Daniel Hailfinger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -319,7 +319,6 @@ int buspirate_spi_write_256(struct flashchip *flash, uint8_t *buf) { int total_size = 1024 * flash->total_size; - int i;
spi_disable_blockprotect(); /* Erase first. */ @@ -330,25 +329,5 @@ } msg_pinfo("done.\n");
- /* FIXME: We could do 12 byte writes, but then we'd have to make sure - * not to cross a 256 byte page boundary. This problem only applies to - * writes, reads can cross page boundaries just fine. - */ - for (i = 0; i < total_size; i += 8) { - int l, r; - if (i + 8 <= total_size) - l = 8; - else - l = total_size - i; - - if ((r = spi_nbyte_program(i, &buf[i], l))) { - msg_perr("%s: write fail %d\n", __func__, r); - return 1; - } - - while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) - /* loop */; - } - - return 0; + return spi_write_chunked(flash, buf, 0, total_size, 12); } Index: flashrom-partial_write_spi/bitbang_spi.c =================================================================== --- flashrom-partial_write_spi/bitbang_spi.c (Revision 982) +++ flashrom-partial_write_spi/bitbang_spi.c (Arbeitskopie) @@ -1,7 +1,7 @@ /* * This file is part of the flashrom project. * - * Copyright (C) 2009 Carl-Daniel Hailfinger + * Copyright (C) 2009, 2010 Carl-Daniel Hailfinger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -142,24 +142,7 @@ int bitbang_spi_write_256(struct flashchip *flash, uint8_t *buf) { int total_size = 1024 * flash->total_size; - int i;
msg_pdbg("total_size is %d\n", total_size); - for (i = 0; i < total_size; i += 256) { - int l, r; - if (i + 256 <= total_size) - l = 256; - else - l = total_size - i; - - if ((r = spi_nbyte_program(i, &buf[i], l))) { - msg_perr("%s: write fail %d\n", __func__, r); - return 1; - } - - while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) - /* loop */; - } - - return 0; + return spi_write_chunked(flash, buf, 0, total_size, 256); } Index: flashrom-partial_write_spi/ft2232_spi.c =================================================================== --- flashrom-partial_write_spi/ft2232_spi.c (Revision 982) +++ flashrom-partial_write_spi/ft2232_spi.c (Arbeitskopie) @@ -2,7 +2,7 @@ * This file is part of the flashrom project. * * Copyright (C) 2009 Paul Fox pgf@laptop.org - * Copyright (C) 2009 Carl-Daniel Hailfinger + * Copyright (C) 2009, 2010 Carl-Daniel Hailfinger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -288,7 +288,6 @@ int ft2232_spi_write_256(struct flashchip *flash, uint8_t *buf) { int total_size = 1024 * flash->total_size; - int i;
spi_disable_blockprotect(); /* Erase first. */ @@ -299,23 +298,7 @@ } msg_pinfo("done.\n"); msg_pdbg("total_size is %d\n", total_size); - for (i = 0; i < total_size; i += 256) { - int l, r; - if (i + 256 <= total_size) - l = 256; - else - l = total_size - i; - - if ((r = spi_nbyte_program(i, &buf[i], l))) { - msg_perr("%s: write fail %d\n", __func__, r); - return 1; - } - - while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) - /* loop */; - } - - return 0; + return spi_write_chunked(flash, buf, 0, total_size, 256); }
#endif Index: flashrom-partial_write_spi/sb600spi.c =================================================================== --- flashrom-partial_write_spi/sb600spi.c (Revision 982) +++ flashrom-partial_write_spi/sb600spi.c (Arbeitskopie) @@ -4,6 +4,7 @@ * Copyright (C) 2008 Wang Qingpei Qingpei.Wang@amd.com * Copyright (C) 2008 Joe Bao Zheng.Bao@amd.com * Copyright (C) 2008 Advanced Micro Devices, Inc. + * Copyright (C) 2009, 2010 Carl-Daniel Hailfinger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,7 +50,6 @@ /* FIXME: SB600 can write 5 bytes per transaction. */ int sb600_spi_write_1(struct flashchip *flash, uint8_t *buf) { - int i; int total_size = flash->total_size * 1024; int result = 0;
@@ -63,19 +63,7 @@ msg_pinfo("done.\n");
msg_pinfo("Programming flash"); - for (i = 0; i < total_size; i++, buf++) { - result = spi_nbyte_program(i, buf, 1); - if (result) { - msg_perr("Write error!\n"); - return result; - } - - /* wait program complete. */ - if (i % 0x8000 == 0) - msg_pspew("."); - while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) - ; - } + result = spi_write_chunked(flash, buf, 0, total_size, 5); msg_pinfo(" done.\n"); return result; } Index: flashrom-partial_write_spi/ichspi.c =================================================================== --- flashrom-partial_write_spi/ichspi.c (Revision 982) +++ flashrom-partial_write_spi/ichspi.c (Arbeitskopie) @@ -5,7 +5,7 @@ * Copyright (C) 2008 Claus Gindhart claus.gindhart@kontron.com * Copyright (C) 2008 Dominik Geyer dominik.geyer@kontron.com * Copyright (C) 2008 coresystems GmbH info@coresystems.de - * Copyright (C) 2009 Carl-Daniel Hailfinger + * Copyright (C) 2009, 2010 Carl-Daniel Hailfinger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -160,8 +160,6 @@ static int program_opcodes(OPCODES * op); static int run_opcode(OPCODE op, uint32_t offset, uint8_t datalength, uint8_t * data); -static int ich_spi_write_page(struct flashchip *flash, uint8_t * bytes, - int offset, int maxdata);
/* for pairing opcodes with their required preop */ struct preop_opcode_pair { @@ -645,28 +643,6 @@ return -1; }
-static int ich_spi_write_page(struct flashchip *flash, uint8_t * bytes, - int offset, int maxdata) -{ - int page_size = flash->page_size; - uint32_t remaining = page_size; - int towrite; - - msg_comm_debug("ich_spi_write_page: offset=%d, number=%d, buf=%p\n", - offset, page_size, bytes); - - for (; remaining > 0; remaining -= towrite) { - towrite = min(remaining, maxdata); - if (spi_nbyte_program(offset + (page_size - remaining), - &bytes[page_size - remaining], towrite)) { - printf_debug("Error writing"); - return 1; - } - } - - return 0; -} - int ich_spi_read(struct flashchip *flash, uint8_t * buf, int start, int len) { int maxdata = 64; @@ -679,12 +655,14 @@
int ich_spi_write_256(struct flashchip *flash, uint8_t * buf) { - int i, j, rc = 0; + int i, ret = 0; int total_size = flash->total_size * 1024; - int page_size = flash->page_size; int erase_size = 64 * 1024; int maxdata = 64;
+ if (spi_controller == SPI_CONTROLLER_VIA) + maxdata = 16; + spi_disable_blockprotect(); /* Erase first */ printf("Erasing flash before programming... "); @@ -696,19 +674,15 @@
printf("Programming page: \n"); for (i = 0; i < total_size / erase_size; i++) { - if (spi_controller == SPI_CONTROLLER_VIA) - maxdata = 16; - - for (j = 0; j < erase_size / page_size; j++) { - ich_spi_write_page(flash, - (void *)(buf + (i * erase_size) + (j * page_size)), - (i * erase_size) + (j * page_size), maxdata); - } + ret = spi_write_chunked(flash, buf + (i * erase_size), + i * erase_size, erase_size, maxdata); + if (ret) + break; }
printf("\n");
- return rc; + return ret; }
int ich_spi_send_command(unsigned int writecnt, unsigned int readcnt, Index: flashrom-partial_write_spi/chipdrivers.h =================================================================== --- flashrom-partial_write_spi/chipdrivers.h (Revision 982) +++ flashrom-partial_write_spi/chipdrivers.h (Arbeitskopie) @@ -51,6 +51,7 @@ int spi_nbyte_program(int addr, uint8_t *bytes, int len); int spi_nbyte_read(int addr, uint8_t *bytes, int len); int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize); +int spi_write_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize); int spi_aai_write(struct flashchip *flash, uint8_t *buf);
/* 82802ab.c */
Am Donnerstag, den 25.03.2010, 03:10 +0100 schrieb Carl-Daniel Hailfinger:
- /* Warning: This loop has a very unusual condition and body.
* The loop needs to go through each page with at least one affected
* byte. The lowest page number is (start / page_size) since that
* division rounds down. The highest page number we want is the page
* where the last byte of the range lives. That last byte has the
* address (start + len - 1), thus the highest page number is
* (start + len - 1) / page_size. Since we want to include that last
* page as well, the loop condition uses <=.
*/
- for (i = start / page_size; i <= (start + len - 1) / page_size; i++) {
/* Byte position of the first byte in the range in this page. */
/* starthere is an offset to the base address of the chip. */
starthere = max(start, i * page_size);
/* Length of bytes in the range in this page. */
lenhere = min(start + len, (i + 1) * page_size) - starthere;
for (j = 0; j < lenhere; j += chunksize) {
towrite = min(chunksize, lenhere - j);
rc = spi_nbyte_program(starthere + j, buf + starthere - start + j, towrite);
if (rc)
break;
while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
programmer_delay(10);
}
if (rc)
break;
- }
i would write this as (carful, untested):
startofs = start % pagesize; /* offset relative to page begin */ /* iterate over all pages to write */ for(pageaddr = start - startofs; pageaddr < start + len; pageaddr += page_size) { endofs = min(pagesize, start + len - pageaddr); /* iterate over chunks in this page */ for(j = startofs; j < endofs; j += chunksize) { towrite = min(chunksize, endofs - j); rc = spi_nbyte_program(pageaddr + j, buf, towrite); buf += towrite; if (rc) goto leave_page_loop; /* Copy/paste wait here */ } startofs = 0; /* all pages but the first need to be programmed from the beginning */ } leave_page_loop:
Your logic seem right, too, so this is a matter of taste. I think my version needs less explanation, that's why I would prefer it that way.
We should aim to remove all the foo_spi_write_n functions and put the max write size into the spi controller structure. This probably means to write one entry for Intel (64) and one for VIA (16). Currently, some of the write functions do erase, others don't. Some of the write functions do unprotect, others don't. But that's for a later patch.
Regards, Michael Karcher
Am Donnerstag, den 25.03.2010, 10:46 +0100 schrieb Michael Karcher:
Your logic seem right, too, so this is a matter of taste. I think my version needs less explanation, that's why I would prefer it that way.
I forgot:
Acked-by: Michael Karcher flashrom@mkarcher.dialup.fu-berlin.de
Regards, Michael Karcher
On 25.03.2010 10:46, Michael Karcher wrote:
Am Donnerstag, den 25.03.2010, 03:10 +0100 schrieb Carl-Daniel Hailfinger:
- /* Warning: This loop has a very unusual condition and body.
* The loop needs to go through each page with at least one affected
* byte. The lowest page number is (start / page_size) since that
* division rounds down. The highest page number we want is the page
* where the last byte of the range lives. That last byte has the
* address (start + len - 1), thus the highest page number is
* (start + len - 1) / page_size. Since we want to include that last
* page as well, the loop condition uses <=.
*/
- for (i = start / page_size; i <= (start + len - 1) / page_size; i++) {
/* Byte position of the first byte in the range in this page. */
/* starthere is an offset to the base address of the chip. */
starthere = max(start, i * page_size);
/* Length of bytes in the range in this page. */
lenhere = min(start + len, (i + 1) * page_size) - starthere;
for (j = 0; j < lenhere; j += chunksize) {
towrite = min(chunksize, lenhere - j);
rc = spi_nbyte_program(starthere + j, buf + starthere - start + j, towrite);
if (rc)
break;
while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
programmer_delay(10);
}
if (rc)
break;
- }
i would write this as (carful, untested):
startofs = start % pagesize; /* offset relative to page begin */ /* iterate over all pages to write */ for(pageaddr = start - startofs; pageaddr < start + len; pageaddr += page_size) { endofs = min(pagesize, start + len - pageaddr); /* iterate over chunks in this page */ for(j = startofs; j < endofs; j += chunksize) { towrite = min(chunksize, endofs - j); rc = spi_nbyte_program(pageaddr + j, buf, towrite); buf += towrite; if (rc) goto leave_page_loop; /* Copy/paste wait here */ } startofs = 0; /* all pages but the first need to be programmed from the beginning */ }
leave_page_loop:
I prefer your logic over mine, but my logic has been tested by David Hendricks, and that's why I committed mine.
If you could send your code as patch for spi_read_chunked and spi_write_chunked, I'd be really happy.
Your logic seem right, too, so this is a matter of taste. I think my version needs less explanation, that's why I would prefer it that way.
Fully agreed. We want your logic.
We should aim to remove all the foo_spi_write_n functions and put the max write size into the spi controller structure. This probably means to write one entry for Intel (64) and one for VIA (16). Currently, some of the write functions do erase, others don't. Some of the write functions do unprotect, others don't. But that's for a later patch.
Will send that patch in a few minutes.
Regards, Carl-Daniel
Hi Michael,
On 22.05.2010 01:38, Carl-Daniel Hailfinger wrote:
On 25.03.2010 10:46, Michael Karcher wrote:
Am Donnerstag, den 25.03.2010, 03:10 +0100 schrieb Carl-Daniel Hailfinger:
- /* Warning: This loop has a very unusual condition and body.
* The loop needs to go through each page with at least one affected
* byte. The lowest page number is (start / page_size) since that
* division rounds down. The highest page number we want is the page
* where the last byte of the range lives. That last byte has the
* address (start + len - 1), thus the highest page number is
* (start + len - 1) / page_size. Since we want to include that last
* page as well, the loop condition uses <=.
*/
- for (i = start / page_size; i <= (start + len - 1) / page_size; i++) {
/* Byte position of the first byte in the range in this page. */
/* starthere is an offset to the base address of the chip. */
starthere = max(start, i * page_size);
/* Length of bytes in the range in this page. */
lenhere = min(start + len, (i + 1) * page_size) - starthere;
for (j = 0; j < lenhere; j += chunksize) {
towrite = min(chunksize, lenhere - j);
rc = spi_nbyte_program(starthere + j, buf + starthere - start + j, towrite);
if (rc)
break;
while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP)
programmer_delay(10);
}
if (rc)
break;
- }
i would write this as (carful, untested):
startofs = start % pagesize; /* offset relative to page begin */ /* iterate over all pages to write */ for(pageaddr = start - startofs; pageaddr < start + len; pageaddr += page_size) { endofs = min(pagesize, start + len - pageaddr); /* iterate over chunks in this page */ for(j = startofs; j < endofs; j += chunksize) { towrite = min(chunksize, endofs - j); rc = spi_nbyte_program(pageaddr + j, buf, towrite); buf += towrite; if (rc) goto leave_page_loop; /* Copy/paste wait here */ } startofs = 0; /* all pages but the first need to be programmed from the beginning */ }
leave_page_loop:
If you could send your code as patch for spi_read_chunked and spi_write_chunked, I'd be really happy.
Your logic seem right, too, so this is a matter of taste. I think my version needs less explanation, that's why I would prefer it that way.
Fully agreed. We want your logic.
Could you send your logic as a patch which changes spi_read_chunked and spi_write_chunked?
Thanks!
Regards, Carl-Daniel
Read function tested for chunk size 62 and with start offset 3, works as expected.
Signed-off-by: Michael Karcher flashrom@mkarcher.dialup.fu-berlin.de --- spi25.c | 80 +++++++++++++++++++++++++------------------------------------- 1 files changed, 32 insertions(+), 48 deletions(-)
diff --git a/spi25.c b/spi25.c index 51be397..260dd1c 100644 --- a/spi25.c +++ b/spi25.c @@ -879,35 +879,27 @@ int spi_nbyte_read(int address, uint8_t *bytes, int len) int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize) { int rc = 0; - int i, j, starthere, lenhere; + int ofs, startofs, endofs; /* offsets relative to page begin */ int page_size = flash->page_size; - int toread; - - /* Warning: This loop has a very unusual condition and body. - * The loop needs to go through each page with at least one affected - * byte. The lowest page number is (start / page_size) since that - * division rounds down. The highest page number we want is the page - * where the last byte of the range lives. That last byte has the - * address (start + len - 1), thus the highest page number is - * (start + len - 1) / page_size. Since we want to include that last - * page as well, the loop condition uses <=. - */ - for (i = start / page_size; i <= (start + len - 1) / page_size; i++) { - /* Byte position of the first byte in the range in this page. */ - /* starthere is an offset to the base address of the chip. */ - starthere = max(start, i * page_size); - /* Length of bytes in the range in this page. */ - lenhere = min(start + len, (i + 1) * page_size) - starthere; - for (j = 0; j < lenhere; j += chunksize) { - toread = min(chunksize, lenhere - j); - rc = spi_nbyte_read(starthere + j, buf + starthere - start + j, toread); + int pageaddr, toread; + + startofs = start % page_size; + /* iterate over all affected pages */ + for (pageaddr = start - startofs; pageaddr < start + len; + pageaddr += page_size) { + endofs = min(page_size, start + len - pageaddr); + /* iterate over all chunks in the current page */ + for (ofs = startofs; ofs < endofs; ofs += chunksize) { + toread = min(chunksize, endofs - ofs); + rc = spi_nbyte_read(pageaddr + ofs, buf, toread); + buf += toread; if (rc) - break; + goto leave_page_loop; } - if (rc) - break; + startofs = 0; /* all further pages processed from start */ }
+leave_page_loop: return rc; }
@@ -918,42 +910,34 @@ int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int spi_write_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize) { int rc = 0; - int i, j, starthere, lenhere; + int ofs, startofs, endofs; /* offsets relative to page begin */ /* FIXME: page_size is the wrong variable. We need max_writechunk_size * in struct flashchip to do this properly. All chips using * spi_chip_write_256 have page_size set to max_writechunk_size, so * we're OK for now. */ int page_size = flash->page_size; - int towrite; - - /* Warning: This loop has a very unusual condition and body. - * The loop needs to go through each page with at least one affected - * byte. The lowest page number is (start / page_size) since that - * division rounds down. The highest page number we want is the page - * where the last byte of the range lives. That last byte has the - * address (start + len - 1), thus the highest page number is - * (start + len - 1) / page_size. Since we want to include that last - * page as well, the loop condition uses <=. - */ - for (i = start / page_size; i <= (start + len - 1) / page_size; i++) { - /* Byte position of the first byte in the range in this page. */ - /* starthere is an offset to the base address of the chip. */ - starthere = max(start, i * page_size); - /* Length of bytes in the range in this page. */ - lenhere = min(start + len, (i + 1) * page_size) - starthere; - for (j = 0; j < lenhere; j += chunksize) { - towrite = min(chunksize, lenhere - j); - rc = spi_nbyte_program(starthere + j, buf + starthere - start + j, towrite); + int pageaddr, towrite; + + startofs = start % page_size; + /* iterate over all affected pages */ + for (pageaddr = start - startofs; pageaddr < start + len; + pageaddr += page_size) { + endofs = min(page_size, start + len - pageaddr); + /* iterate over all chunks in the current page */ + for (ofs = startofs; ofs < endofs; ofs += chunksize) { + towrite = min(chunksize, endofs - ofs); + rc = spi_nbyte_program(pageaddr + ofs, buf, towrite); + buf += towrite; if (rc) - break; + goto leave_page_loop; while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) programmer_delay(10); } - if (rc) - break; + startofs = 0; /* all further pages processed from start */ }
+leave_page_loop: return rc; }
On Wed, Mar 24, 2010 at 7:10 PM, Carl-Daniel Hailfinger < c-d.hailfinger.devel.2006@gmx.net> wrote:
Every SPI programmer driver had its own completely different chip write implementation, and all of them were insufficiently commented. Create spi_write_chunked as a copy of spi_read_chunked and convert all SPI programmers to use it. No functional changes except:
- Bus Pirate uses 12 Byte writes instead of 8 Byte writes
- SB600 uses 5 Byte writes instead of 1 Byte writes
Should work. Not for 0.9.1, but since I had that thing on my disk anyway, I figured I'd post it to the list in case someone wants to experiment with partial writes. Tests appreciated.
Looks like a step in the right direction to me, I'd love to see it post 0.9.2. I even had a chance to test it on Intel and VIA SPI controllers, and it seemed not to break anything :-)
Acked-by: David Hendricks dhendrix@google.com
On 02.04.2010 23:57, David Hendricks wrote:
On Wed, Mar 24, 2010 at 7:10 PM, Carl-Daniel Hailfinger < c-d.hailfinger.devel.2006@gmx.net> wrote:
Every SPI programmer driver had its own completely different chip write implementation, and all of them were insufficiently commented. Create spi_write_chunked as a copy of spi_read_chunked and convert all SPI programmers to use it. No functional changes except:
- Bus Pirate uses 12 Byte writes instead of 8 Byte writes
- SB600 uses 5 Byte writes instead of 1 Byte writes
Looks like a step in the right direction to me, I'd love to see it post 0.9.2. I even had a chance to test it on Intel and VIA SPI controllers, and it seemed not to break anything :-)
Acked-by: David Hendricks dhendrix@google.com
Nice, thanks for the review.
Regards, Carl-Daniel
On 03.04.2010 00:10, Carl-Daniel Hailfinger wrote:
On 02.04.2010 23:57, David Hendricks wrote:
On Wed, Mar 24, 2010 at 7:10 PM, Carl-Daniel Hailfinger < c-d.hailfinger.devel.2006@gmx.net> wrote:
Every SPI programmer driver had its own completely different chip write implementation, and all of them were insufficiently commented. Create spi_write_chunked as a copy of spi_read_chunked and convert all SPI programmers to use it. No functional changes except:
- Bus Pirate uses 12 Byte writes instead of 8 Byte writes
- SB600 uses 5 Byte writes instead of 1 Byte writes
Looks like a step in the right direction to me, I'd love to see it post 0.9.2. I even had a chance to test it on Intel and VIA SPI controllers, and it seemed not to break anything :-)
Acked-by: David Hendricks dhendrix@google.com
Nice, thanks for the review.
Thanks, committed in r1005.
Regards, Carl-Daniel