Looks good overall in preparing write functions for partial-write capability, e.g. taking a range and length rather than assuming 0 to total_size. I patched this in and it appears to be non-harmful on my NM10 setup, at least.
Note: There was one compilation issue ("it87spi.c:289: error: ‘it8716f_spi_page_program’ defined but not used") in the lines below due to the #ifdef.
+#ifdef TODO
+#warning This function needs to be converted to partial write
} else {
+ int i;
spi_disable_blockprotect();
- /* Erase first */
- msg_pinfo("Erasing flash before programming... ");
- if (erase_flash(flash)) {
- msg_perr("ERASE FAILED!\n");
- return -1;
- }
- msg_pinfo("done.\n");
- for (i = 0; i < total_size / 256; i++) {
+
+ /* FIXME: Handle chips which have max writechunk size >1 and
<256. */
+ for (i = 0; i < flash->total_size * 1024 / 256; i++) {
it8716f_spi_page_program(flash, i, buf);
}
}
+#endif
I'd like to see this go in once the compilation issue is addressed so further progress can be made w.r.t. partial writes.