summaryrefslogtreecommitdiffstats
path: root/82802ab.c
diff options
context:
space:
mode:
authorSean Nelson <audiohacked@gmail.com>2010-03-19 18:47:06 +0000
committerSean Nelson <audiohacked@gmail.com>2010-03-19 18:47:06 +0000
commit9242063c6ca6d0aa3961931c644e47bf21981909 (patch)
treed51077c5234c888ac4d696e94bcc8f5cb0b0b90a /82802ab.c
parent723649bc8f5abd27146ef85d82cb53b6e08e2ac7 (diff)
downloadflashrom-9242063c6ca6d0aa3961931c644e47bf21981909.zip
flashrom-9242063c6ca6d0aa3961931c644e47bf21981909.tar.gz
Rename print_82802ab_status to print_status_82802ab add unlock_82802ab
Strip unlock code from erase_block_82802ab rename erase_82802ab_block to erase_block_80280ab delete sharplhf00l04.o from Makefile delete *_lhf00l04* from chipdrivers.h add unlock_stm50flw0x0x delete wait_stm50flw0x0x delete write_page_stm50flw0x0x convert erase_stm50flw0x0x to erase_chip_stm50flw0x0x delete write_stm50flw0x0x add unlock_82802ab to two Intel chips with TEST_BAD_WRITE change the status of 82802AB, 82802AC, M50FW040, M50FW080 to TEST_OK_PR Corresponding to flashrom svn r948. Signed-off-by: Sean Nelson <audiohacked@gmail.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to '82802ab.c')
-rw-r--r--82802ab.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/82802ab.c b/82802ab.c
index ca08b65..cdc3d73 100644
--- a/82802ab.c
+++ b/82802ab.c
@@ -32,7 +32,7 @@
#include "chipdrivers.h"
// I need that Berkeley bit-map printer
-void print_82802ab_status(uint8_t status)
+void print_status_82802ab(uint8_t status)
{
printf_debug("%s", status & 0x80 ? "Ready:" : "Busy:");
printf_debug("%s", status & 0x40 ? "BE SUSPEND:" : "BE RUN/FINISH:");
@@ -92,18 +92,27 @@ uint8_t wait_82802ab(chipaddr bios)
return status;
}
-int erase_82802ab_block(struct flashchip *flash, unsigned int page, unsigned int pagesize)
+int unlock_82802ab(struct flashchip *flash)
+{
+ int i;
+ //chipaddr wrprotect = flash->virtual_registers + page + 2;
+
+ for (i = 0; i < flash->total_size; i+= flash->page_size)
+ {
+ chip_writeb(0, flash->virtual_registers + i + 2);
+ }
+
+ return 0;
+}
+
+int erase_block_82802ab(struct flashchip *flash, unsigned int page, unsigned int pagesize)
{
chipaddr bios = flash->virtual_memory;
- chipaddr wrprotect = flash->virtual_registers + page + 2;
uint8_t status;
// clear status register
chip_writeb(0x50, bios + page);
- // clear write protect
- chip_writeb(0, wrprotect);
-
// now start it
chip_writeb(0x20, bios + page);
chip_writeb(0xd0, bios + page);
@@ -111,7 +120,7 @@ int erase_82802ab_block(struct flashchip *flash, unsigned int page, unsigned int
// now let's see what the register is
status = wait_82802ab(bios);
- print_82802ab_status(status);
+ print_status_82802ab(status);
if (check_erased_range(flash, page, pagesize)) {
fprintf(stderr, "ERASE FAILED!\n");
@@ -130,7 +139,7 @@ int erase_82802ab(struct flashchip *flash)
printf("total_size is %d; flash->page_size is %d\n",
total_size, flash->page_size);
for (i = 0; i < total_size; i += flash->page_size)
- if (erase_82802ab_block(flash, i, flash->page_size)) {
+ if (erase_block_82802ab(flash, i, flash->page_size)) {
fprintf(stderr, "ERASE FAILED!\n");
return -1;
}
@@ -184,7 +193,7 @@ int write_82802ab(struct flashchip *flash, uint8_t *buf)
}
/* erase block by block and write block by block; this is the most secure way */
- if (erase_82802ab_block(flash, i * page_size, page_size)) {
+ if (erase_block_82802ab(flash, i * page_size, page_size)) {
fprintf(stderr, "ERASE FAILED!\n");
return -1;
}
OpenPOWER on IntegriCloud