diff options
author | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2014-08-08 08:33:01 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2014-08-08 08:33:01 +0000 |
commit | a8cf3620a42ca5927253822a813e3fbae1d6e7bf (patch) | |
tree | 64ff1e62b06ee89492c914e11c86b54ddf126b0c /en29lv640b.c | |
parent | 6697f71ade7b6428c7be6051c02dbb9768900e04 (diff) | |
download | flashrom-a8cf3620a42ca5927253822a813e3fbae1d6e7bf.tar.gz flashrom-a8cf3620a42ca5927253822a813e3fbae1d6e7bf.tar.bz2 flashrom-a8cf3620a42ca5927253822a813e3fbae1d6e7bf.zip |
Unify non-shifted and shifted JEDEC access
Some Parallel bus chips have a 16-bit mode and an 8-bit mode. They use
normal JEDEC addresses for 16-bit mode and shifted addresses (by 1 bit)
for 8-bit mode. Some programmers can access them in 16-bit mode, but on
all flashrom-supported programmers so far, we access them in 8-bit mode.
This means we have to shift the addresses but apart from the addresses
we can share the code.
This patch makes this possible by checking the chip's FEATURE_ADDR_SHIFTED
flag in common JEDEC functions and applying the right addresses respectively.
Corresponding to flashrom svn r1840.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
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 'en29lv640b.c')
-rw-r--r-- | en29lv640b.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/en29lv640b.c b/en29lv640b.c index a274f62b9..3a5f61129 100644 --- a/en29lv640b.c +++ b/en29lv640b.c @@ -85,51 +85,3 @@ int probe_en29lv640b(struct flashctx *flash) return 0; } - -static int erase_chip_shifted_jedec(struct flashctx *flash) -{ - chipaddr bios = flash->virtual_memory; - - chip_writeb(flash, 0xAA, bios + 0xAAA); - chip_writeb(flash, 0x55, bios + 0x555); - chip_writeb(flash, 0x80, bios + 0xAAA); - - chip_writeb(flash, 0xAA, bios + 0xAAA); - chip_writeb(flash, 0x55, bios + 0x555); - chip_writeb(flash, 0x10, bios + 0xAAA); - - programmer_delay(10); - toggle_ready_jedec(flash, bios); - - /* FIXME: Check the status register for errors. */ - return 0; -} - -int erase_block_shifted_jedec(struct flashctx *flash, unsigned int start, unsigned int len) -{ - chipaddr bios = flash->virtual_memory; - chipaddr dst = bios + start; - - chip_writeb(flash, 0xAA, bios + 0xAAA); - chip_writeb(flash, 0x55, bios + 0x555); - chip_writeb(flash, 0x80, bios + 0xAAA); - - chip_writeb(flash, 0xAA, bios + 0xAAA); - chip_writeb(flash, 0x55, bios + 0x555); - chip_writeb(flash, 0x30, dst); - - programmer_delay(10); - toggle_ready_jedec(flash, bios); - - /* FIXME: Check the status register for errors. */ - return 0; -} - -int erase_chip_block_shifted_jedec(struct flashctx *flash, unsigned int address, unsigned int blocklen) -{ - if ((address != 0) || (blocklen != flash->chip->total_size * 1024)) { - msg_cerr("%s called with incorrect arguments\n", __func__); - return -1; - } - return erase_chip_shifted_jedec(flash); -} |