[flashrom] [PATCH 1/4] Make write granularity a chip attribute.

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Sun Mar 3 23:57:10 CET 2013


Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
---
 flash.h    |    3 ++-
 flashrom.c |    3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/flash.h b/flash.h
index a479286..7dd9d9f 100644
--- a/flash.h
+++ b/flash.h
@@ -68,9 +68,9 @@ enum chipbustype {
  * - 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 on default. */
 	write_gran_1bit,
 	write_gran_1byte,
-	write_gran_256bytes,
 };
 
 /*
@@ -162,6 +162,7 @@ struct flashchip {
 		uint16_t min;
 		uint16_t max;
 	} voltage;
+	enum write_granularity gran;
 };
 
 struct flashctx {
diff --git a/flashrom.c b/flashrom.c
index e1be398..225b6f0 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1273,7 +1273,7 @@ static int erase_and_write_block_helper(struct flashctx *flash,
 {
 	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 @@ static int erase_and_write_block_helper(struct flashctx *flash,
 	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);
-- 
Kind regards, Stefan Tauner





More information about the flashrom mailing list