Use spi_nbyte_program in ichspi.c. This shortens the code a lot and makes it more readable.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-ichspi_nbyte_program/ichspi.c =================================================================== --- flashrom-ichspi_nbyte_program/ichspi.c (Revision 594) +++ flashrom-ichspi_nbyte_program/ichspi.c (Arbeitskopie) @@ -617,30 +617,17 @@ { int page_size = flash->page_size; uint32_t remaining = page_size; - int a; + int towrite;
printf_debug("ich_spi_write_page: offset=%d, number=%d, buf=%p\n", offset, page_size, bytes);
- for (a = 0; a < page_size; a += maxdata) { - if (remaining < maxdata) { - if (run_opcode - (curopcodes->opcode[0], - offset + (page_size - remaining), remaining, - &bytes[page_size - remaining]) != 0) { - printf_debug("Error writing"); - return 1; - } - remaining = 0; - } else { - if (run_opcode - (curopcodes->opcode[0], - offset + (page_size - remaining), maxdata, - &bytes[page_size - remaining]) != 0) { - printf_debug("Error writing"); - return 1; - } - remaining -= maxdata; + 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; } }
On 15.06.2009 17:46, ron minnich wrote:
Acked-by: Ronald G. Minnich rminnich@gmail.com
Thanks, committed in r600.
Regards, Carl-Daniel
On 15.06.2009 16:50, Carl-Daniel Hailfinger wrote:
Use spi_nbyte_program in ichspi.c. This shortens the code a lot and makes it more readable.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Testers for ICH SPI please?
Regards, Carl-Daniel