Author: stefanct
Date: Mon Mar  4 00:49:48 2013
New Revision: 1651
URL: http://flashrom.org/trac/flashrom/changeset/1651

Log:
Make write granularity a chip attribute.

Signed-off-by: Stefan Tauner <[email protected]>
Acked-by: Carl-Daniel Hailfinger <[email protected]>

Modified:
   trunk/flash.h
   trunk/flashrom.c

Modified: trunk/flash.h
==============================================================================
--- trunk/flash.h       Fri Feb 22 16:58:45 2013        (r1650)
+++ trunk/flash.h       Mon Mar  4 00:49:48 2013        (r1651)
@@ -68,9 +68,9 @@
  * - 256 bytes: If less than 256 bytes are written, the contents of the 
unwritten bytes are undefined.
  */
 enum write_granularity {
+       write_gran_256bytes = 0, /* We assume 256 byte granularity by default. 
*/
        write_gran_1bit,
        write_gran_1byte,
-       write_gran_256bytes,
 };
 
 /*
@@ -162,6 +162,7 @@
                uint16_t min;
                uint16_t max;
        } voltage;
+       enum write_granularity gran;
 };
 
 struct flashctx {

Modified: trunk/flashrom.c
==============================================================================
--- trunk/flashrom.c    Fri Feb 22 16:58:45 2013        (r1650)
+++ trunk/flashrom.c    Mon Mar  4 00:49:48 2013        (r1651)
@@ -1273,7 +1273,7 @@
 {
        unsigned int starthere = 0, lenhere = 0;
        int ret = 0, skip = 1, writecount = 0;
-       enum write_granularity gran = write_gran_256bytes; /* FIXME */
+       enum write_granularity gran = flash->chip->gran;
 
        /* curcontents and newcontents are opaque to walk_eraseregions, and
         * need to be adjusted here to keep the impression of proper abstraction
@@ -1281,7 +1281,6 @@
        curcontents += start;
        newcontents += start;
        msg_cdbg(":");
-       /* FIXME: Assume 256 byte granularity for now to play it safe. */
        if (need_erase(curcontents, newcontents, len, gran)) {
                msg_cdbg("E");
                ret = erasefn(flash, start, len);

_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to