summaryrefslogtreecommitdiffstats
path: root/jedec.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-01-09 03:15:50 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-01-09 03:15:50 +0000
commitf9e9a695145d428c0bb73037125e46d4a73735a1 (patch)
treeb1fd1a430202e2818df3bd4ff6168ded03d625c5 /jedec.c
parentc1419d755b507781b889dd96b461443fe6a44276 (diff)
downloadflashrom-f9e9a695145d428c0bb73037125e46d4a73735a1.zip
flashrom-f9e9a695145d428c0bb73037125e46d4a73735a1.tar.gz
Use address mask in probe_jedec
This allows us to have one common probe_jedec function instead of half a dozen wrappers. The trick here is to have FEATURE_ADDR_FULL==0 and thus default to unmasked addresses. That way, we only have to annotate chips which need small address masks. Corresponding to flashrom svn r840. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Sean Nelson <audiohacked@gmail.com>
Diffstat (limited to 'jedec.c')
-rw-r--r--jedec.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/jedec.c b/jedec.c
index 3a21539..055fbc3 100644
--- a/jedec.c
+++ b/jedec.c
@@ -373,6 +373,19 @@ retry:
return failed;
}
+int getaddrmask(struct flashchip *flash)
+{
+ switch (flash->feature_bits & FEATURE_ADDR_MASK) {
+ case FEATURE_ADDR_FULL:
+ return MASK_FULL;
+ break;
+ default:
+ fprintf(stderr, "%s called with unknown mask\n", __func__);
+ return 0;
+ break;
+ }
+}
+
int write_jedec(struct flashchip *flash, uint8_t *buf)
{
int i, failed = 0;
@@ -438,7 +451,10 @@ int erase_chip_block_jedec(struct flashchip *flash, unsigned int addr,
int probe_jedec(struct flashchip *flash)
{
- return probe_jedec_common(flash, MASK_FULL, 1);
+ int mask;
+
+ mask = getaddrmask(flash);
+ return probe_jedec_common(flash, mask, 1);
}
int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int size)
OpenPOWER on IntegriCloud