Remove remaining JEDEC chipdrivers, but move lock-related functions to chiplocks.c
Fix whitespace for ST_M29W512B.

SVN RM: (maybe not now; as a note)
 w39v040c.c - only function in use left is printlock_w39v040c
w39v080fa.c - function names state *_winbond_fwhub but this is JEDEC; only functions used are lock related
 pm49fl00x.c - finally converted to JEDEC
 sst_fwhub.c - contrary to function/file names this is JEDEC

Signed-off-by: Sean Nelson <[email protected]>

diff --git a/Makefile b/Makefile
index d5132a7..3d985cb 100644
--- a/Makefile
+++ b/Makefile
@@ -31,29 +31,29 @@ EXPORTDIR ?= .
 OS_ARCH        = $(shell uname)
 ifneq ($(OS_ARCH), SunOS)
 STRIP_ARGS = -s
 endif
 ifeq ($(OS_ARCH), Darwin)
 CPPFLAGS += -I/opt/local/include -I/usr/local/include
 LDFLAGS += -framework IOKit -framework DirectIO -L/opt/local/lib 
-L/usr/local/lib
 endif
 ifeq ($(OS_ARCH), FreeBSD)
 CPPFLAGS += -I/usr/local/include
 LDFLAGS += -L/usr/local/lib
 endif
 
-CHIP_OBJS = jedec.o stm50flw0x0x.o w39v040c.o w39v080fa.o sharplhf00l04.o 
w29ee011.o \
-       sst28sf040.o m29f400bt.o 82802ab.o pm49fl00x.o \
-       sst49lfxxxc.o sst_fwhub.o flashchips.o spi.o
+CHIP_OBJS = jedec.o stm50flw0x0x.o sharplhf00l04.o w29ee011.o \
+       sst28sf040.o m29f400bt.o 82802ab.o \
+       sst49lfxxxc.o flashchips.o spi.o chiplocks.c
 
 LIB_OBJS = layout.o
 
 CLI_OBJS = flashrom.o cli_classic.o cli_output.o print.o
 
 PROGRAMMER_OBJS = udelay.o programmer.o
 
 all: pciutils features dep $(PROGRAM)
 
 # Set the flashrom version string from the highest revision number
 # of the checked out flashrom files.
 # Note to packagers: Any tree exported with "make export" or "make tarball"
 # will not require subversion. The downloadable snapshots are already exported.
diff --git a/chipdrivers.h b/chipdrivers.h
index 059100e..e1faeb1 100644
--- a/chipdrivers.h
+++ b/chipdrivers.h
@@ -50,97 +50,79 @@ int spi_disable_blockprotect(void);
 int spi_byte_program(int addr, uint8_t databyte);
 int spi_nbyte_program(int addr, uint8_t *bytes, int len);
 int spi_nbyte_read(int addr, uint8_t *bytes, int len);
 int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int 
len, int chunksize);
 int spi_aai_write(struct flashchip *flash, uint8_t *buf);
 
 /* 82802ab.c */
 uint8_t wait_82802ab(chipaddr bios);
 int probe_82802ab(struct flashchip *flash);
 int erase_82802ab(struct flashchip *flash);
 int erase_82802ab_block(struct flashchip *flash, unsigned int page, unsigned 
int pagesize);
 int write_82802ab(struct flashchip *flash, uint8_t *buf);
 
+/* chiplocks.c */
+int printlock_w39v040c(struct flashchip *flash);
+int printlock_sst_fwhub(struct flashchip *flash);
+int unlock_49fl00x(struct flashchip *flash);
+int unlock_sst_fwhub(struct flashchip *flash);
+int unlock_winbond_fwhub(struct flashchip *flash);
+
 /* jedec.c */
 uint8_t oddparity(uint8_t val);
 void toggle_ready_jedec(chipaddr dst);
 void data_polling_jedec(chipaddr dst, uint8_t data);
 int write_byte_program_jedec(chipaddr bios, uint8_t *src,
                             chipaddr dst);
 int probe_jedec(struct flashchip *flash);
 int erase_chip_jedec(struct flashchip *flash);
 int write_jedec(struct flashchip *flash, uint8_t *buf);
 int write_jedec_1(struct flashchip *flash, uint8_t *buf);
 int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned 
int pagesize);
 int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int 
blocksize);
 int erase_chip_block_jedec(struct flashchip *flash, unsigned int page, 
unsigned int blocksize);
 int write_sector_jedec_common(struct flashchip *flash, uint8_t *src, chipaddr 
dst, unsigned int page_size, unsigned int mask);
 
 /* m29f400bt.c */
 int probe_m29f400bt(struct flashchip *flash);
 int erase_m29f400bt(struct flashchip *flash);
 int block_erase_m29f400bt(struct flashchip *flash, unsigned int start, 
unsigned int len);
 int block_erase_chip_m29f400bt(struct flashchip *flash, unsigned int start, 
unsigned int len);
 int write_m29f400bt(struct flashchip *flash, uint8_t *buf);
 int write_coreboot_m29f400bt(struct flashchip *flash, uint8_t *buf);
 void protect_m29f400bt(chipaddr bios);
 void write_page_m29f400bt(chipaddr bios, uint8_t *src,
                          chipaddr dst, int page_size);
 
-/* pm49fl00x.c */
-int probe_49fl00x(struct flashchip *flash);
-int erase_49fl00x(struct flashchip *flash);
-int write_49fl00x(struct flashchip *flash, uint8_t *buf);
-int unlock_49fl00x(struct flashchip *flash);
-
 /* sharplhf00l04.c */
 int probe_lhf00l04(struct flashchip *flash);
 int erase_lhf00l04_block(struct flashchip *flash, unsigned int blockaddr, 
unsigned int blocklen);
 int write_lhf00l04(struct flashchip *flash, uint8_t *buf);
 void protect_lhf00l04(chipaddr bios);
 
 /* sst28sf040.c */
 int probe_28sf040(struct flashchip *flash);
 int erase_chip_28sf040(struct flashchip *flash, unsigned int addr, unsigned 
int blocklen);
 int erase_sector_28sf040(struct flashchip *flash, unsigned int address, 
unsigned int sector_size);
 int write_28sf040(struct flashchip *flash, uint8_t *buf);
 
 /* sst49lfxxxc.c */
 int probe_49lfxxxc(struct flashchip *flash);
 int erase_49lfxxxc(struct flashchip *flash);
 int erase_sector_49lfxxxc(struct flashchip *flash, unsigned int address, 
unsigned int sector_size);
 int erase_block_49lfxxxc(struct flashchip *flash, unsigned int address, 
unsigned int sector_size);
 int erase_chip_49lfxxxc(struct flashchip *flash, unsigned int addr, unsigned 
int blocksize);
 int write_49lfxxxc(struct flashchip *flash, uint8_t *buf);
 int unlock_49lfxxxc(struct flashchip *flash);
 
-/* sst_fwhub.c */
-int probe_sst_fwhub(struct flashchip *flash);
-int erase_sst_fwhub(struct flashchip *flash);
-int erase_sst_fwhub_block(struct flashchip *flash, unsigned int offset, 
unsigned int page_size);
-int erase_sst_fwhub_sector(struct flashchip *flash, unsigned int offset, 
unsigned int page_size);
-int write_sst_fwhub(struct flashchip *flash, uint8_t *buf);
-
-/* w39v040c.c */
-int probe_w39v040c(struct flashchip *flash);
-int erase_w39v040c(struct flashchip *flash);
-int write_w39v040c(struct flashchip *flash, uint8_t *buf);
-int printlock_w39v040c(struct flashchip *flash);
-
-/* w39V080fa.c */
-int probe_winbond_fwhub(struct flashchip *flash);
-int erase_winbond_fwhub(struct flashchip *flash);
-int write_winbond_fwhub(struct flashchip *flash, uint8_t *buf);
-int unlock_winbond_fwhub(struct flashchip *flash);
-
 /* w29ee011.c */
 int probe_w29ee011(struct flashchip *flash);
 
 /* stm50flw0x0x.c */
 int probe_stm50flw0x0x(struct flashchip *flash);
 int erase_stm50flw0x0x(struct flashchip *flash);
 int erase_block_stm50flw0x0x(struct flashchip *flash, unsigned int block, 
unsigned int blocksize);
 int erase_sector_stm50flw0x0x(struct flashchip *flash, unsigned int block, 
unsigned int blocksize);
 int erase_chip_stm50flw0x0x(struct flashchip *flash, unsigned int addr, 
unsigned int blocklen);
 int write_stm50flw0x0x(struct flashchip *flash, uint8_t *buf);
 
 #endif /* !__CHIPDRIVERS_H__ */
diff --git a/chiplocks.c b/chiplocks.c
new file mode 100644
index 0000000..66f1832
--- /dev/null
+++ b/chiplocks.c
@@ -0,0 +1,226 @@
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright (C) 2009 Sean Nelson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include "flash.h"
+
+int printlock_w39v040c(struct flashchip *flash)
+{
+       chipaddr bios = flash->virtual_memory;
+       uint8_t lock;
+
+       chip_writeb(0xAA, bios + 0x5555);
+       programmer_delay(10);
+       chip_writeb(0x55, bios + 0x2AAA);
+       programmer_delay(10);
+       chip_writeb(0x90, bios + 0x5555);
+       programmer_delay(10);
+
+       lock = chip_readb(bios + 0xfff2);
+
+       chip_writeb(0xAA, bios + 0x5555);
+       programmer_delay(10);
+       chip_writeb(0x55, bios + 0x2AAA);
+       programmer_delay(10);
+       chip_writeb(0xF0, bios + 0x5555);
+       programmer_delay(40);
+
+       printf("%s: Boot block #TBL is %slocked, rest of chip #WP is 
%slocked.\n",
+               __func__, lock & 0x4 ? "" : "un", lock & 0x8 ? "" : "un");
+       return 0;
+}
+
+void write_lockbits_49fl00x(chipaddr bios, int size,
+                           unsigned char bits, int block_size)
+{
+       int i, left = size;
+
+       for (i = 0; left >= block_size; i++, left -= block_size) {
+               /* pm49fl002 */
+               if (block_size == 16384 && i % 2)
+                       continue;
+
+               chip_writeb(bits, bios + (i * block_size) + 2);
+       }
+}
+
+int unlock_49fl00x(struct flashchip *flash)
+{
+       write_lockbits_49fl00x(flash->virtual_registers, flash->total_size * 
1024, 0, flash->page_size);
+       return 0;
+}
+
+int check_sst_fwhub_block_lock(struct flashchip *flash, int offset)
+{
+       chipaddr registers = flash->virtual_registers;
+       uint8_t blockstatus;
+
+       blockstatus = chip_readb(registers + offset + 2);
+       printf_debug("Lock status for 0x%06x (size 0x%06x) is %02x, ",
+                    offset, flash->page_size, blockstatus);
+       switch (blockstatus & 0x3) {
+       case 0x0:
+               printf_debug("full access\n");
+               break;
+       case 0x1:
+               printf_debug("write locked\n");
+               break;
+       case 0x2:
+               printf_debug("locked open\n");
+               break;
+       case 0x3:
+               printf_debug("write locked down\n");
+               break;
+       }
+       /* Return content of the write_locked bit */
+       return blockstatus & 0x1;
+}
+
+int clear_sst_fwhub_block_lock(struct flashchip *flash, int offset)
+{
+       chipaddr registers = flash->virtual_registers;
+       uint8_t blockstatus;
+
+       blockstatus = check_sst_fwhub_block_lock(flash, offset);
+
+       if (blockstatus) {
+               printf_debug("Trying to clear lock for 0x%06x... ", offset)
+               chip_writeb(0, registers + offset + 2);
+
+               blockstatus = check_sst_fwhub_block_lock(flash, offset);
+               printf_debug("%s\n", (blockstatus) ? "failed" : "OK");
+       }
+
+       return blockstatus;
+}
+
+/* probe_jedec works fine for probing */
+int printlock_sst_fwhub(struct flashchip *flash)
+{
+       int i;
+
+       for (i = 0; i < flash->total_size * 1024; i += flash->page_size)
+               check_sst_fwhub_block_lock(flash, i);
+
+       return 0;
+}
+
+int unlock_sst_fwhub(struct flashchip *flash)
+{
+       int i;
+
+       for (i = 0; i < flash->total_size * 1024; i += flash->page_size)
+               clear_sst_fwhub_block_lock(flash, i);
+
+       return 0;
+}
+
+
+static int unlock_block_winbond_fwhub(struct flashchip *flash, int offset)
+{
+       chipaddr wrprotect = flash->virtual_registers + offset + 2;
+       uint8_t locking;
+
+       printf_debug("Trying to unlock block @0x%08x = 0x%02x\n", offset,
+                    chip_readb(wrprotect));
+
+       locking = chip_readb(wrprotect);
+       switch (locking & 0x7) {
+       case 0:
+               printf_debug("Full Access.\n");
+               return 0;
+       case 1:
+               printf_debug("Write Lock (Default State).\n");
+               chip_writeb(0, wrprotect);
+               return 0;
+       case 2:
+               printf_debug("Locked Open (Full Access, Lock Down).\n");
+               return 0;
+       case 3:
+               fprintf(stderr, "Error: Write Lock, Locked Down.\n");
+               return -1;
+       case 4:
+               printf_debug("Read Lock.\n");
+               chip_writeb(0, wrprotect);
+               return 0;
+       case 5:
+               printf_debug("Read/Write Lock.\n");
+               chip_writeb(0, wrprotect);
+               return 0;
+       case 6:
+               fprintf(stderr, "Error: Read Lock, Locked Down.\n");
+               return -1;
+       case 7:
+               fprintf(stderr, "Error: Read/Write Lock, Locked Down.\n");
+               return -1;
+       }
+
+       /* We will never reach this point, but GCC doesn't know */
+       return -1;
+}
+
+int unlock_winbond_fwhub(struct flashchip *flash)
+{
+       int i, total_size = flash->total_size * 1024;
+       chipaddr bios = flash->virtual_memory;
+       uint8_t locking;
+
+       /* Are there any hardware restrictions that we can't overcome? 
+        * If flashrom fail here, someone's got to check all those GPIOs.
+        */
+
+       /* Product Identification Entry */
+       chip_writeb(0xAA, bios + 0x5555);
+       chip_writeb(0x55, bios + 0x2AAA);
+       chip_writeb(0x90, bios + 0x5555);
+       programmer_delay(10);
+
+       /* Read Hardware Lock Bits */
+       locking = chip_readb(bios + 0xffff2);
+
+       /* Product Identification Exit */
+       chip_writeb(0xAA, bios + 0x5555);
+       chip_writeb(0x55, bios + 0x2AAA);
+       chip_writeb(0xF0, bios + 0x5555);
+       programmer_delay(10);
+
+       printf_debug("Lockout bits:\n");
+
+       if (locking & (1 << 2))
+               fprintf(stderr, "Error: hardware bootblock locking (#TBL).\n");
+       else
+               printf_debug("No hardware bootblock locking (good!)\n");
+
+       if (locking & (1 << 3))
+               fprintf(stderr, "Error: hardware block locking (#WP).\n");
+       else
+               printf_debug("No hardware block locking (good!)\n");
+
+       if (locking & ((1 << 2) | (1 << 3)))
+               return -1;
+
+       /* Unlock the complete chip */
+       for (i = 0; i < total_size; i += flash->page_size)
+               if (unlock_block_winbond_fwhub(flash, i))
+                       return -1;
+
+       return 0;
+}
diff --git a/flashchips.c b/flashchips.c
index 875d5b3..bacb8e5 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -1295,27 +1295,28 @@ struct flashchip flashchips[] = {
                .tested         = TEST_UNTESTED,
                .probe          = probe_jedec,
                .probe_timing   = TIMING_ZERO,  /* routine is wrapper to 
probe_jedec (pm49fl00x.c) */
                .block_erasers  =
                {
                        {
                                .eraseblocks = { {64 * 1024, 8} },
                                .block_erase = erase_block_jedec,
                        }, {
                                .eraseblocks = { {512 * 1024, 1} },
                                .block_erase = erase_chip_block_jedec,
                        }
                },
-               .write          = write_49fl00x,
+               .unlock         = unlock_49fl00x,
+               .write          = write_jedec_1,
                .read           = read_memmapped,
        },
 
        {
                .vendor         = "EMST",
                .name           = "F49B002UA",
                .bustype        = CHIP_BUSTYPE_PARALLEL,
                .manufacture_id = EMST_ID,
                .model_id       = EMST_F49B002UA,
                .total_size     = 256,
                .page_size      = 4096,
                .feature_bits   = FEATURE_EITHER_RESET,
                .tested         = TEST_UNTESTED,
@@ -3336,27 +3337,27 @@ struct flashchip flashchips[] = {
                {
                        {
                                .eraseblocks = { {4 * 1024, 64} },
                                .block_erase = erase_sector_jedec,
                        }, {
                                .eraseblocks = { {16 * 1024, 16} },
                                .block_erase = erase_block_jedec,
                        }, {
                                .eraseblocks = { {256 * 1024, 1} },
                                .block_erase = erase_chip_block_jedec,
                        }
                },
                .unlock         = unlock_49fl00x,
-               .write          = write_49fl00x,
+               .write          = write_jedec_1,
                .read           = read_memmapped,
        },
 
        {
                .vendor         = "PMC",
                .name           = "Pm49FL004",
                .bustype        = CHIP_BUSTYPE_LPC | CHIP_BUSTYPE_FWH, /* A/A 
Mux*/
                .manufacture_id = PMC_ID_NOPREFIX,
                .model_id       = PMC_49FL004,
                .total_size     = 512,
                .page_size      = 64 * 1024,
                .feature_bits   = FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
                .tested         = TEST_UNTESTED,
@@ -3366,27 +3367,27 @@ struct flashchip flashchips[] = {
                {
                        {
                                .eraseblocks = { {4 * 1024, 128} },
                                .block_erase = erase_sector_jedec,
                        }, {
                                .eraseblocks = { {64 * 1024, 8} },
                                .block_erase = erase_block_jedec,
                        }, {
                                .eraseblocks = { {512 * 1024, 1} },
                                .block_erase = erase_chip_block_jedec,
                        }
                },
                .unlock         = unlock_49fl00x,
-               .write          = write_49fl00x,
+               .write          = write_jedec_1,
                .read           = read_memmapped,
        },
 
        {
                .vendor         = "Sanyo",
                .name           = "LF25FW203A",
                .bustype        = CHIP_BUSTYPE_SPI,
                .manufacture_id = SANYO_ID,
                .model_id       = SANYO_LE25FW203A,
                .total_size     = 2048,
                .page_size      = 256,
                .tested         = TEST_UNTESTED,
                .probe          = probe_spi_rdid,
@@ -4039,103 +4040,109 @@ struct flashchip flashchips[] = {
                .read           = read_memmapped,
        },
 
        {
                .vendor         = "SST",
                .name           = "SST49LF002A/B",
                .bustype        = CHIP_BUSTYPE_FWH, /* A/A Mux */
                .manufacture_id = SST_ID,
                .model_id       = SST_49LF002A,
                .total_size     = 256,
                .page_size      = 16 * 1024,
                .feature_bits   = FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
                .tested         = TEST_OK_PRW,
-               .probe          = probe_sst_fwhub,
+               .probe          = probe_jedec,
                .probe_timing   = 1,            /* 150 ns | routine is wrapper 
to probe_jedec (sst_fwhub.c) */
                .block_erasers  =
                {
                        {
                                .eraseblocks = { {4 * 1024, 64} },
-                               .block_erase = erase_sst_fwhub_sector,
+                               .block_erase = erase_sector_jedec,
                        }, {
                                .eraseblocks = { {16 * 1024, 16} },
-                               .block_erase = erase_sst_fwhub_block,
+                               .block_erase = erase_block_jedec,
                        }, {
                                .eraseblocks = { {256 * 1024, 1} },
                                .block_erase = NULL, /* AA 55 80 AA 55 10, only 
in A/A mux mode */
                        }
                },
-               .write          = write_sst_fwhub,
+               .printlock      = printlock_sst_fwhub,
+               .unlock         = unlock_sst_fwhub,
+               .write          = write_jedec_1,
                .read           = read_memmapped,
        },
 
        {
                .vendor         = "SST",
                .name           = "SST49LF003A/B",
                .bustype        = CHIP_BUSTYPE_FWH, /* A/A Mux */
                .manufacture_id = SST_ID,
                .model_id       = SST_49LF003A,
                .total_size     = 384,
                .page_size      = 64 * 1024,
                .feature_bits   = FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
                .tested         = TEST_OK_PR,
-               .probe          = probe_sst_fwhub,
+               .probe          = probe_jedec,
                .probe_timing   = 1,            /* 150 ns | routine is wrapper 
to probe_jedec (sst_fwhub.c) */
                .block_erasers  =
                {
                        {
                                .eraseblocks = { {4 * 1024, 96} },
-                               .block_erase = erase_sst_fwhub_sector,
+                               .block_erase = erase_sector_jedec,
                        }, {
                                .eraseblocks = { {64 * 1024, 6} },
-                               .block_erase = erase_sst_fwhub_block,
+                               .block_erase = erase_block_jedec,
                        }, {
                                .eraseblocks = { {384 * 1024, 1} },
                                .block_erase = NULL, /* AA 55 80 AA 55 10, only 
in A/A mux mode */
                        }
                },
-               .write          = write_sst_fwhub,
+               .printlock      = printlock_sst_fwhub,
+               .unlock         = unlock_sst_fwhub,
+               .write          = write_jedec_1,
                .read           = read_memmapped,
        },
 
        {
                /* Contrary to the data sheet, TBL# on the SST49LF004B affects 
the top 128kB (instead of 64kB)
                 * and is only honored for 64k block erase, but not 4k sector 
erase.
                 */
                .vendor         = "SST",
                .name           = "SST49LF004A/B",
                .bustype        = CHIP_BUSTYPE_FWH, /* A/A Mux */
                .manufacture_id = SST_ID,
                .model_id       = SST_49LF004A,
                .total_size     = 512,
                .page_size      = 64 * 1024,
                .feature_bits   = FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
                .tested         = TEST_OK_PREW,
-               .probe          = probe_sst_fwhub,
+               .probe          = probe_jedec,
                .probe_timing   = 1,            /* 150 ns | routine is wrapper 
to probe_jedec (sst_fwhub.c) */
                .block_erasers  =
                {
                        {
                                .eraseblocks = { {4 * 1024, 128} },
-                               .block_erase = erase_sector_jedec, /* missing 
unlock */
+                               .block_erase = erase_sector_jedec,
                        }, {
                                .eraseblocks = { {64 * 1024, 8} },
-                               .block_erase = erase_sst_fwhub_block, /* same 
as erase_block_jedec, but with unlock */
+                               .block_erase = erase_block_jedec,
                        }, {
                                .eraseblocks = { {512 * 1024, 1} },
                                .block_erase = NULL, /* AA 55 80 AA 55 10, only 
in A/A mux mode */
                        },
                },
-               .write          = write_sst_fwhub,
+               .printlock      = printlock_sst_fwhub,
+               .unlock         = unlock_sst_fwhub,
+               .write          = write_jedec_1,
                .read           = read_memmapped,
        },
 
        {
                .vendor         = "SST",
                .name           = "SST49LF004C",
                .bustype        = CHIP_BUSTYPE_FWH,
                .manufacture_id = SST_ID,
                .model_id       = SST_49LF004C,
                .total_size     = 512,
                .page_size      = 4 * 1024,
                .feature_bits   = 0,
                .tested         = TEST_UNTESTED,
@@ -4160,42 +4167,44 @@ struct flashchip flashchips[] = {
                .read           = read_memmapped,
        },
 
        {
                .vendor         = "SST",
                .name           = "SST49LF008A",
                .bustype        = CHIP_BUSTYPE_FWH, /* A/A Mux */
                .manufacture_id = SST_ID,
                .model_id       = SST_49LF008A,
                .total_size     = 1024,
                .page_size      = 64 * 1024,
                .feature_bits   = FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
                .tested         = TEST_OK_PRW,
-               .probe          = probe_sst_fwhub,
+               .probe          = probe_jedec,
                .probe_timing   = 1,            /* 150 ns | routine is wrapper 
to probe_jedec (sst_fwhub.c) */
                .block_erasers  =
                {
                        {
                                .eraseblocks = { {4 * 1024, 256} },
-                               .block_erase = erase_sst_fwhub_sector,
+                               .block_erase = erase_sector_jedec,
                        }, {
                                .eraseblocks = { {64 * 1024, 16} },
-                               .block_erase = erase_sst_fwhub_block,
+                               .block_erase = erase_block_jedec,
                        }, {
                                .eraseblocks = { {1024 * 1024, 1} },
                                .block_erase = NULL, /* AA 55 80 AA 55 10, only 
in A/A mux mode */
                        }
                },
-               .write          = write_sst_fwhub,
+               .printlock      = printlock_sst_fwhub,
+               .unlock         = unlock_sst_fwhub,
+               .write          = write_jedec_1,
                .read           = read_memmapped,
        },
 
        {
                .vendor         = "SST",
                .name           = "SST49LF008C",
                .bustype        = CHIP_BUSTYPE_FWH,
                .manufacture_id = SST_ID,
                .model_id       = SST_49LF008C,
                .total_size     = 1024,
                .page_size      = 4 * 1024,
                .feature_bits   = 0,
                .tested         = TEST_UNTESTED,
@@ -4896,48 +4905,48 @@ struct flashchip flashchips[] = {
                {
                        {
                                .eraseblocks = { {64 * 1024, 8}, },
                                .block_erase = erase_sector_jedec,
                        }, {
                                .eraseblocks = { {512 * 1024, 1} },
                                .block_erase = erase_chip_block_jedec,
                        }
                },
                .write          = write_jedec_1,
                .read           = read_memmapped,
        },
 
-        {
-                .vendor         = "ST",
-                .name           = "M29W512B",
-                .bustype        = CHIP_BUSTYPE_PARALLEL,
-                .manufacture_id = ST_ID,
-                .model_id       = ST_M29W512B,
-                .total_size     = 64,
-                .page_size      = 64 * 1024,
-                .feature_bits   = FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
-                .tested         = TEST_OK_PREW,
-                .probe          = probe_jedec,
-                .probe_timing   = TIMING_ZERO,
-                .block_erasers  =
-                {
-                        {
-                                .eraseblocks = { {64 * 1024, 1} },
-                                .block_erase = erase_chip_block_jedec,
-                        }
-                },
-                .write          = write_jedec_1,
-                .read           = read_memmapped,
-        },
+       {
+               .vendor         = "ST",
+               .name           = "M29W512B",
+               .bustype        = CHIP_BUSTYPE_PARALLEL,
+               .manufacture_id = ST_ID,
+               .model_id       = ST_M29W512B,
+               .total_size     = 64,
+               .page_size      = 64 * 1024,
+               .feature_bits   = FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
+               .tested         = TEST_OK_PREW,
+               .probe          = probe_jedec,
+               .probe_timing   = TIMING_ZERO,
+               .block_erasers  =
+               {
+                       {
+                               .eraseblocks = { {64 * 1024, 1} },
+                               .block_erase = erase_chip_block_jedec,
+                       }
+               },
+               .write          = write_jedec_1,
+               .read           = read_memmapped,
+       },
 
        {
                .vendor         = "ST",
                .name           = "M50FLW040A",
                .bustype        = CHIP_BUSTYPE_FWH | CHIP_BUSTYPE_LPC, /* A/A 
Mux */
                .manufacture_id = ST_ID,
                .model_id       = ST_M50FLW040A,
                .total_size     = 512,
                .page_size      = 64 * 1024,
                .feature_bits   = 0,
                .tested         = TEST_UNTESTED,
                .probe          = probe_82802ab,
                .probe_timing   = TIMING_FIXME,
_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to