1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-06-30 21:52:36 +02:00

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>
This commit is contained in:
Stefan Tauner
2013-04-01 19:34:53 +00:00
parent 52b6e9dc54
commit 02437458a6
2 changed files with 63 additions and 25 deletions

24
flash.h
View File

@ -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. */
};
/*