Some chips such as the ENE KB9012 internal flash require a write granularity of
128 bytes.

Signed-off-by: Paul Kocialkowski <[email protected]>
---
 flash.h    | 1 +
 flashrom.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/flash.h b/flash.h
index 2c2839f..24861ba 100644
--- a/flash.h
+++ b/flash.h
@@ -85,6 +85,7 @@ enum write_granularity {
        write_gran_1bit,        /* Each bit can be cleared individually. */
        write_gran_1byte,       /* A byte can be written once. Further writes 
to an already written byte cause
                                 * its contents to be either undefined or to 
stay unchanged. */
+       write_gran_128bytes,    /* If less than 128 bytes are written, the 
unwritten bytes are undefined. */
        write_gran_264bytes,    /* If less than 264 bytes are written, the 
unwritten bytes are undefined. */
        write_gran_512bytes,    /* If less than 512 bytes are written, the 
unwritten bytes are undefined. */
        write_gran_528bytes,    /* If less than 528 bytes are written, the 
unwritten bytes are undefined. */
diff --git a/flashrom.c b/flashrom.c
index d51a44c..c9c7e31 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -781,6 +781,9 @@ int need_erase(const uint8_t *have, const uint8_t *want, 
unsigned int len, enum
                                break;
                        }
                break;
+       case write_gran_128bytes:
+               result = need_erase_gran_bytes(have, want, len, 128);
+               break;
        case write_gran_256bytes:
                result = need_erase_gran_bytes(have, want, len, 256);
                break;
@@ -847,6 +850,9 @@ static unsigned int get_next_write(const uint8_t *have, 
const uint8_t *want, uns
        case write_gran_1byte_implicit_erase:
                stride = 1;
                break;
+       case write_gran_128bytes:
+               stride = 128;
+               break;
        case write_gran_256bytes:
                stride = 256;
                break;
-- 
1.9.1


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

Reply via email to