diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2013-04-01 19:34:53 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2013-04-01 19:34:53 +0000 |
commit | 02437458a603c112e503abc63ad32b09cfbc23f3 (patch) | |
tree | 5d6795f391efd74229f1b88de4639157fbec5563 /flash.h | |
parent | 52b6e9dc546d1c0958e03634eff47c71f460f8ac (diff) | |
download | flashrom-02437458a603c112e503abc63ad32b09cfbc23f3.tar.gz flashrom-02437458a603c112e503abc63ad32b09cfbc23f3.tar.bz2 flashrom-02437458a603c112e503abc63ad32b09cfbc23f3.zip |
Refine granularity handling in preparation of AT45DB series support
This adds a number of new granularitie and refines the handling of
n-byte granularities by extracting the respective code into a helper
function which reduces the pain of the above significantly.
Corresponding to flashrom svn r1666.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'flash.h')
-rw-r--r-- | flash.h | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -59,18 +59,22 @@ enum chipbustype { }; /* - * The following write granularities are known: - * - 1 bit: Each bit can be cleared individually. - * - 1 byte: A byte can be written once. Further writes to an already written byte cause its contents to be - * either undefined or to stay unchanged. - * - 128 bytes: If less than 128 bytes are written, the rest will be erased. Each write to a 128-byte region - * will trigger an automatic erase before anything is written. Very uncommon behaviour. - * - 256 bytes: If less than 256 bytes are written, the contents of the unwritten bytes are undefined. + * The following enum defines possible write granularities of flash chips. These tend to reflect the properties + * of the actual hardware not necesserily the write function(s) defined by the respective struct flashchip. + * The latter might (and should) be more precisely specified, e.g. they might bail out early if their execution + * would result in undefined chip contents. */ enum write_granularity { - write_gran_256bytes = 0, /* We assume 256 byte granularity by default. */ - write_gran_1bit, - write_gran_1byte, + /* We assume 256 byte granularity by default. */ + write_gran_256bytes = 0,/* If less than 256 bytes are written, the unwritten bytes are undefined. */ + 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_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. */ + write_gran_1024bytes, /* If less than 1024 bytes are written, the unwritten bytes are undefined. */ + write_gran_1056bytes, /* If less than 1056 bytes are written, the unwritten bytes are undefined. */ }; /* |