Complete the addition of Feature Bits for all Jedec based chips

Add FEATURE_SHORT_RESET, FEATURE_LONG_RESET, and FEATURE_EITHER_RESET
rewrite jedec functions to use getaddrmask

convert write_49f002 to write_jedec_1
convert write_w39v040c to write_jedec_1
convert probe_w39v040c to probe_jedec
convert write_49lf040 to write_jedec_1
convert write_pm29f002 to write_jedec
convert write_29f040b to write_jedec_1
convert probe_29f040b to probe_jedec
convert erase_chip_29f040b to erase_chip_block_jedec
convert erase_sector_29f040b to erase_sector_jedec
convert write_m29f002b to write_jedec
convert write_m29f002t to write_jedec
convert *_29f002 to *_jedec

decouple unused files from Makefile:
am29f040b.c
en29f002a.c
m29f002.c
mx29f002.c
pm29f002.c
sst49lf040.c
w39v040c.c
w49f002u.c

Corresponding to flashrom svn r886.

Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Anders Juel Jensen <andersjjensen@gmail.com>
diff --git a/Makefile b/Makefile
index b3f8b2f..62c6a74 100644
--- a/Makefile
+++ b/Makefile
@@ -42,8 +42,7 @@
 endif
 
 CHIP_OBJS = jedec.o stm50flw0x0x.o w39v080fa.o sharplhf00l04.o w29ee011.o \
-	sst28sf040.o am29f040b.o mx29f002.o m29f400bt.o pm29f002.o w39v040c.o \
-	w49f002u.o 82802ab.o pm49fl00x.o sst49lf040.o en29f002a.o m29f002.o \
+	sst28sf040.o m29f400bt.o 82802ab.o pm49fl00x.o \
 	sst49lfxxxc.o sst_fwhub.o flashchips.o spi.o
 
 LIB_OBJS = layout.o
diff --git a/flash.h b/flash.h
index f0ac246..3d31d44 100644
--- a/flash.h
+++ b/flash.h
@@ -154,8 +154,14 @@
 
 #define FEATURE_REGISTERMAP	(1 << 0)
 #define FEATURE_BYTEWRITES	(1 << 1)
+#define FEATURE_LONG_RESET	(0 << 4)
+#define FEATURE_SHORT_RESET	(1 << 4)
+#define FEATURE_EITHER_RESET	FEATURE_LONG_RESET
 #define FEATURE_ADDR_FULL	(0 << 2)
 #define FEATURE_ADDR_MASK	(3 << 2)
+#define FEATURE_ADDR_2AA	(1 << 2)
+#define FEATURE_ADDR_AAA	(2 << 2)
+#define FEATURE_ADDR_SHIFTED	0
 
 struct flashchip {
 	const char *vendor;
diff --git a/flashchips.c b/flashchips.c
index 03686e6..53d053a 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -62,21 +62,22 @@
 		.model_id	= AM_29F010B,	/* Same as Am29F010A */
 		.total_size	= 128,
 		.page_size	= 16 * 1024,
-		.tested		= TEST_OK_PRW,
-		.probe		= probe_29f040b,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,
 		.erase		= NULL,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {16 * 1024, 8} },
-				.block_erase = erase_sector_29f040b,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {128 * 1024, 1} },
-				.block_erase = erase_chip_29f040b,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_pm29f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -88,6 +89,7 @@
 		.model_id	= AM_29F002BB,
 		.total_size	= 256,
 		.page_size	= 256,
+		.feature_bits	= FEATURE_SHORT_RESET | FEATURE_ADDR_2AA,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,
@@ -119,7 +121,8 @@
 		.model_id	= AM_29F002BT,
 		.total_size	= 256,
 		.page_size	= 256,
-		.tested		= TEST_OK_PR,
+		.feature_bits	= FEATURE_EITHER_RESET | FEATURE_ADDR_2AA,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,
 		.erase		= NULL,
@@ -150,21 +153,22 @@
 		.model_id	= AM_29F016D,
 		.total_size	= 2 * 1024,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
 		.tested		= TEST_UNTESTED,
-		.probe		= probe_29f040b,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (am29f040b.c) */
 		.erase		= NULL,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {64 * 1024, 32} },
-				.block_erase = erase_sector_29f040b,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {2048 * 1024, 1} },
-				.block_erase = erase_chip_29f040b,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_29f040b,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -176,21 +180,22 @@
 		.model_id	= AM_29F040B,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.tested		= TEST_OK_PRW,
-		.probe		= probe_29f040b,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (am29f040b.c) */
 		.erase		= NULL,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {64 * 1024, 8} },
-				.block_erase = erase_sector_29f040b,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
-				.block_erase = erase_chip_29f040b,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_29f040b,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -202,6 +207,7 @@
 		.model_id	= AM_29F080B,
 		.total_size	= 1024,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,
@@ -210,13 +216,13 @@
 		{
 			{
 				.eraseblocks = { {64 * 1024, 16} },
-				.block_erase = erase_sector_29f040b,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {1024 * 1024, 1} },
-				.block_erase = erase_chip_29f040b,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_29f040b,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -228,21 +234,22 @@
 		.model_id	= AM_29LV040B,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
 		.tested		= TEST_UNTESTED,
-		.probe		= probe_29f040b,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (am29f040b.c) */
 		.erase		= NULL,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {64 * 1024, 8} },
-				.block_erase = erase_sector_29f040b,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
-				.block_erase = erase_chip_29f040b,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_29f040b,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -254,21 +261,22 @@
 		.model_id	= AM_29LV080B,
 		.total_size	= 1024,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
 		.tested		= TEST_UNTESTED,
-		.probe		= probe_29f040b,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (am29f040b.c) */
 		.erase		= NULL,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {64 * 1024, 16} },
-				.block_erase = erase_sector_29f040b,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {1024 * 1024, 1} },
-				.block_erase = erase_chip_29f040b,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_29f040b,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -280,6 +288,7 @@
 		.model_id	= ASD_AE49F2008,
 		.total_size	= 256,
 		.page_size	= 128,
+		.feature_bits	= FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_FIXME, 
@@ -841,7 +850,8 @@
 		.model_id	= AT_29C512,
 		.total_size	= 64,
 		.page_size	= 128,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_LONG_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10000, /* 10mS, Enter=Exec */
 		.erase		= NULL,
@@ -865,7 +875,8 @@
 		.model_id	= AT_29C010A,
 		.total_size	= 128,
 		.page_size	= 128,
-		.tested		= TEST_OK_PR,
+		.feature_bits	= FEATURE_LONG_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10000, /* 10mS, Enter=Exec */
 		.erase		= NULL,
@@ -888,7 +899,8 @@
 		.model_id	= AT_29C020,
 		.total_size	= 256,
 		.page_size	= 256,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_LONG_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10000,			/* 10ms */ 
 		.erase		= NULL,
@@ -911,6 +923,7 @@
 		.model_id	= AT_29C040A,
 		.total_size	= 512,
 		.page_size	= 256,
+		.feature_bits	= FEATURE_LONG_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10000,			/* 10 ms */
@@ -1078,7 +1091,8 @@
 		.model_id	= AT_49BV512,
 		.total_size	= 64,
 		.page_size	= 64,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
 		.erase		= NULL,
@@ -1089,7 +1103,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -1101,6 +1115,7 @@
 		.model_id	= AT_49F002N,
 		.total_size	= 256,
 		.page_size	= 256,
+		.feature_bits	= FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -1120,7 +1135,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -1132,7 +1147,8 @@
 		.model_id	= AT_49F002NT,
 		.total_size	= 256,
 		.page_size	= 256,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
 		.erase		= NULL,
@@ -1151,7 +1167,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -1229,8 +1245,9 @@
 		.model_id	= AMIC_A29002B,
 		.total_size	= 256,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
 		.tested		= TEST_UNTESTED,
-		.probe		= probe_29f002,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (mx29f002.c) */
 		.erase		= NULL,
 		.block_erasers	=
@@ -1242,10 +1259,10 @@
 					{32 * 1024, 1},
 					{64 * 1024, 3},
 				},
-				.block_erase = erase_sector_29f002,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {256 * 1024, 1} },
-				.block_erase = erase_chip_29f002,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
 		.write		= write_jedec_1,
@@ -1260,8 +1277,9 @@
 		.model_id	= AMIC_A29002T,
 		.total_size	= 256,
 		.page_size	= 64 * 1024,
-		.tested		= TEST_OK_PR,
-		.probe		= probe_29f002,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (mx29f002.c) */
 		.erase		= NULL,
 		.block_erasers	=
@@ -1273,10 +1291,10 @@
 					{8 * 1024, 2},
 					{16 * 1024, 1},
 				},
-				.block_erase = erase_sector_29f002,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {256 * 1024, 1} },
-				.block_erase = erase_chip_29f002,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
 		.write		= write_jedec_1,
@@ -1291,21 +1309,22 @@
 		.model_id	= AMIC_A29040B,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.tested		= TEST_OK_PR,
-		.probe		= probe_29f040b,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (am29f040b.c) */
 		.erase		= NULL,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {64 * 1024, 8} },
-				.block_erase = erase_sector_29f040b,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
-				.block_erase = erase_chip_29f040b,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_29f040b,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -1317,8 +1336,8 @@
 		.model_id	= AMIC_A49LF040A,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.feature_bits	= FEATURE_REGISTERMAP,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* routine is wrapper to probe_jedec (pm49fl00x.c) */
 		.erase		= NULL,
@@ -1344,6 +1363,7 @@
 		.model_id	= EMST_F49B002UA,
 		.total_size	= 256,
 		.page_size	= 4096,
+		.feature_bits	= FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -1363,7 +1383,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -2151,6 +2171,7 @@
 		.model_id	= EN_29F002B,
 		.total_size	= 256,
 		.page_size	= 256,
+		.feature_bits	= FEATURE_ADDR_AAA | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -2182,7 +2203,8 @@
 		.model_id	= EN_29F002T,
 		.total_size	= 256,
 		.page_size	= 256,
-		.tested		= TEST_OK_PR,
+		.feature_bits	= FEATURE_ADDR_AAA | FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
 		.erase		= NULL,
@@ -2213,6 +2235,7 @@
 		.model_id	= MBM29F004BC,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -2226,10 +2249,10 @@
 					{32 * 1024, 1},
 					{64 * 1024, 7},
 				},
-				.block_erase = erase_sector_29f040b,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
-				.block_erase = erase_chip_29f040b,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
 		.write		= NULL,
@@ -2244,6 +2267,7 @@
 		.model_id	= MBM29F004TC,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -2257,10 +2281,10 @@
 					{8 * 1024, 2},
 					{16 * 1024, 1},
 				},
-				.block_erase = erase_sector_29f040b,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
-				.block_erase = erase_chip_29f040b,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
 		.write		= NULL,
@@ -2268,6 +2292,7 @@
 	},
 
 	{
+		/* FIXME: this has WORD/BYTE sequences; 2AA for word, 555 for byte */
 		.vendor		= "Fujitsu",
 		.name		= "MBM29F400BC",
 		.bustype	= CHIP_BUSTYPE_PARALLEL,
@@ -2275,6 +2300,7 @@
 		.model_id	= MBM29F400BC,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_SHIFTED | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_m29f400bt,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (m29f400bt.c) */
@@ -2306,6 +2332,7 @@
 		.model_id	= MBM29F400TC,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_SHIFTED | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_m29f400bt,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (m29f400bt.c) */
@@ -2337,6 +2364,7 @@
 		.model_id	= P28F001BXB,
 		.total_size	= 128,
 		.page_size	= 128 * 1024, /* 8k + 2x4k + 112k */
+		.feature_bits	= 0,
 		.tested		= TEST_BAD_WRITE,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -2364,7 +2392,8 @@
 		.model_id	= P28F001BXT,
 		.total_size	= 128,
 		.page_size	= 128 * 1024, /* 112k + 2x4k + 8k */
-		.tested		= TEST_OK_PR|TEST_BAD_WRITE,
+		.feature_bits	= 0,
+		.tested		= TEST_BAD_WRITE,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
 		.erase		= NULL,
@@ -2391,6 +2420,7 @@
 		.model_id	= I_82802AB,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
+		.feature_bits	= 0,
 		.tested		= TEST_OK_PRW,
 		.probe		= probe_82802ab,
 		.probe_timing	= TIMING_IGNORED, /* routine does not use probe_timing (82802ab.c) */
@@ -2414,6 +2444,7 @@
 		.model_id	= I_82802AC,
 		.total_size	= 1024,
 		.page_size	= 64 * 1024,
+		.feature_bits	= 0,
 		.tested		= TEST_OK_PRW,
 		.probe		= probe_82802ab,
 		.probe_timing	= TIMING_IGNORED, /* routine does not use probe_timing (82802ab.c) */
@@ -2804,8 +2835,9 @@
 		.model_id	= MX_29F001B,
 		.total_size	= 128,
 		.page_size	= 32 * 1024,
-		.tested		= TEST_OK_PR,
-		.probe		= probe_29f002,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (mx29f002.c) */
 		.erase		= NULL,
 		.block_erasers	=
@@ -2818,10 +2850,10 @@
 					{32 * 1024, 1},
 					{64 * 1024, 1},
 				},
-				.block_erase = erase_sector_29f002,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {128 * 1024, 1} },
-				.block_erase = erase_chip_29f002,
+				.block_erase = erase_chip_block_jedec,
 			}
 		},
 		.write		= write_jedec_1,
@@ -2836,8 +2868,9 @@
 		.model_id	= MX_29F001T,
 		.total_size	= 128,
 		.page_size	= 32 * 1024,
-		.tested		= TEST_OK_PR,
-		.probe		= probe_29f002,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (mx29f002.c) */
 		.erase		= NULL,
 		.block_erasers	=
@@ -2850,10 +2883,10 @@
 					{4 * 1024, 2},
 					{8 * 1024, 1},
 				},
-				.block_erase = erase_sector_29f002,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {128 * 1024, 1} },
-				.block_erase = erase_chip_29f002,
+				.block_erase = erase_chip_block_jedec,
 			}
 		},
 		.write		= write_jedec_1,
@@ -2868,8 +2901,9 @@
 		.model_id	= MX_29F002B,
 		.total_size	= 256,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
 		.tested		= TEST_UNTESTED,
-		.probe		= probe_29f002,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (mx29f002.c) */
 		.erase		= NULL,
 		.block_erasers	=
@@ -2881,10 +2915,10 @@
 					{32 * 1024, 1},
 					{64 * 1024, 3},
 				},
-				.block_erase = erase_sector_29f002,	/* This erase function has 64k blocksize for eLiteFlash */
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {256 * 1024, 1} },
-				.block_erase = erase_chip_29f002,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
 		.write		= write_jedec_1,
@@ -2899,8 +2933,9 @@
 		.model_id	= MX_29F002T,
 		.total_size	= 256,
 		.page_size	= 64 * 1024,
-		.tested		= TEST_OK_PR,
-		.probe		= probe_29f002,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (mx29f002.c) */
 		.erase		= NULL,
 		.block_erasers	=
@@ -2912,10 +2947,10 @@
 					{8 * 1024, 2},
 					{16 * 1024, 1},
 				},
-				.block_erase = erase_sector_29f002,	/* This erase function has 64k blocksize for eLiteFlash */
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {256 * 1024, 1} },
-				.block_erase = erase_chip_29f002,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
 		.write		= write_jedec_1,
@@ -2930,18 +2965,19 @@
 		.model_id	= MX_29LV040,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.tested		= TEST_OK_PR,
-		.probe		= probe_29f002,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (mx29f002.c) */
 		.erase		= NULL,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {64 * 1024, 8}, },
-				.block_erase = erase_sector_29f002,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
-				.block_erase = erase_chip_29f002,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
 		.write		= write_jedec_1,
@@ -3287,8 +3323,9 @@
 		.model_id	= PMC_29F002T,
 		.total_size	= 256,
 		.page_size	= 8 * 1024,
-		.tested		= TEST_OK_PRW,
-		.probe		= probe_29f040b,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_FIXME, 
 		.erase		= NULL,
 		.block_erasers	=
@@ -3300,13 +3337,13 @@
 					{8 * 1024, 2},
 					{16 * 1024, 1},
 				},
-				.block_erase = erase_sector_29f040b,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {256 * 1024, 1} },
-				.block_erase = erase_chip_29f040b,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_pm29f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -3318,8 +3355,9 @@
 		.model_id	= PMC_29F002B,
 		.total_size	= 256,
 		.page_size	= 8 * 1024,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
-		.probe		= probe_29f040b,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_FIXME, 
 		.erase		= NULL,
 		.block_erasers	=
@@ -3331,13 +3369,13 @@
 					{96 * 1024, 1},
 					{128 * 1024, 1},
 				},
-				.block_erase = erase_sector_29f040b,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {256 * 1024, 1} },
-				.block_erase = erase_chip_29f040b,
+				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_pm29f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -3349,7 +3387,8 @@
 		.model_id	= PMC_39F010,
 		.total_size	= 128,
 		.page_size	= 4096,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
 		.erase		= NULL,
@@ -3366,20 +3405,20 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
 	{
 		.vendor		= "PMC",
 		.name		= "Pm49FL002",
-		.bustype	= CHIP_BUSTYPE_LPC|CHIP_BUSTYPE_FWH, /* A/A Mux*/
+		.bustype	= CHIP_BUSTYPE_LPC | CHIP_BUSTYPE_FWH, /* A/A Mux*/
 		.manufacture_id	= PMC_ID_NOPREFIX,
 		.model_id	= PMC_49FL002,
 		.total_size	= 256,
 		.page_size	= 16 * 1024,
-		.feature_bits	= FEATURE_REGISTERMAP,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* routine is wrapper to probe_jedec (pm49fl00x.c) */
 		.erase		= NULL, /* Was: erase_49fl00x */
@@ -3403,13 +3442,13 @@
 	{
 		.vendor		= "PMC",
 		.name		= "Pm49FL004",
-		.bustype	= CHIP_BUSTYPE_LPC|CHIP_BUSTYPE_FWH, /* A/A Mux*/
+		.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,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* routine is wrapper to probe_jedec (pm49fl00x.c) */
 		.erase		= NULL, /* Was: erase_49fl00x */
@@ -3464,6 +3503,7 @@
 		.model_id	= SHARP_LHF00L04,
 		.total_size	= 1024,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_49lfxxxc,
 		.probe_timing	= TIMING_ZERO,
@@ -3751,6 +3791,7 @@
 		.model_id	= SST_28SF040,
 		.total_size	= 512,
 		.page_size	= 256,
+		.feature_bits	= 0,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_28sf040,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (sst28sf040.c) */
@@ -3777,7 +3818,8 @@
 		.model_id	= SST_29EE010,
 		.total_size	= 128,
 		.page_size	= 128,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_LONG_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10, 
 		.erase		= NULL,
@@ -3800,6 +3842,7 @@
 		.model_id	= SST_29LE010,
 		.total_size	= 128,
 		.page_size	= 128,
+		.feature_bits	= FEATURE_LONG_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10, 
@@ -3823,7 +3866,8 @@
 		.model_id	= SST_29EE020A,
 		.total_size	= 256,
 		.page_size	= 128,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_LONG_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10,
 		.erase		= NULL,
@@ -3846,6 +3890,7 @@
 		.model_id	= SST_29LE020,
 		.total_size	= 256,
 		.page_size	= 128,
+		.feature_bits	= FEATURE_LONG_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10, 
@@ -3869,7 +3914,8 @@
 		.model_id	= SST_39SF512,
 		.total_size	= 64,
 		.page_size	= 4096,
-		.tested		= TEST_OK_PREW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns */
 		.erase		= NULL,
@@ -3883,7 +3929,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -3895,7 +3941,8 @@
 		.model_id	= SST_39SF010,
 		.total_size	= 128,
 		.page_size	= 4096,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns */
 		.erase		= NULL,
@@ -3909,7 +3956,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -3921,7 +3968,8 @@
 		.model_id	= SST_39SF020,
 		.total_size	= 256,
 		.page_size	= 4096,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns */ 
 		.erase		= NULL,
@@ -3935,7 +3983,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -3947,7 +3995,8 @@
 		.model_id	= SST_39SF040,
 		.total_size	= 512,
 		.page_size	= 4096,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns */ 
 		.erase		= NULL,
@@ -3961,7 +4010,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -3973,7 +4022,8 @@
 		.model_id	= SST_39VF512,
 		.total_size	= 64,
 		.page_size	= 4096,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns*/ 
 		.erase		= NULL,
@@ -3987,7 +4037,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -3999,7 +4049,8 @@
 		.model_id	= SST_39VF010,
 		.total_size	= 128,
 		.page_size	= 4096,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns */ 
 		.erase		= NULL,
@@ -4013,7 +4064,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4025,7 +4076,8 @@
 		.model_id	= SST_39VF020,
 		.total_size	= 256,
 		.page_size	= 4096,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns */ 
 		.erase		= NULL,
@@ -4039,7 +4091,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4051,7 +4103,8 @@
 		.model_id	= SST_39VF040,
 		.total_size	= 512,
 		.page_size	= 4096,
-		.tested		= TEST_OK_PROBE,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns */ 
 		.erase		= NULL,
@@ -4065,7 +4118,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4077,6 +4130,7 @@
 		.model_id	= SST_39VF080,
 		.total_size	= 1024,
 		.page_size	= 4096,
+		.feature_bits	= FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns */ 
@@ -4094,7 +4148,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4106,7 +4160,7 @@
 		.model_id	= SST_49LF002A,
 		.total_size	= 256,
 		.page_size	= 16 * 1024,
-		.feature_bits	= FEATURE_REGISTERMAP,
+		.feature_bits	= FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
 		.tested		= TEST_OK_PRW,
 		.probe		= probe_sst_fwhub,
 		.probe_timing	= 1,		/* 150 ns | routine is wrapper to probe_jedec (sst_fwhub.c) */
@@ -4136,7 +4190,7 @@
 		.model_id	= SST_49LF003A,
 		.total_size	= 384,
 		.page_size	= 64 * 1024,
-		.feature_bits	= FEATURE_REGISTERMAP,
+		.feature_bits	= FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
 		.tested		= TEST_OK_PR,
 		.probe		= probe_sst_fwhub,
 		.probe_timing	= 1,		/* 150 ns | routine is wrapper to probe_jedec (sst_fwhub.c) */
@@ -4169,7 +4223,7 @@
 		.model_id	= SST_49LF004A,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.feature_bits	= FEATURE_REGISTERMAP,
+		.feature_bits	= FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_sst_fwhub,
 		.probe_timing	= 1,		/* 150 ns | routine is wrapper to probe_jedec (sst_fwhub.c) */
@@ -4199,6 +4253,7 @@
 		.model_id	= SST_49LF004C,
 		.total_size	= 512,
 		.page_size	= 4 * 1024,
+		.feature_bits	= 0,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_49lfxxxc,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (sst49lfxxxc.c) */
@@ -4230,7 +4285,7 @@
 		.model_id	= SST_49LF008A,
 		.total_size	= 1024,
 		.page_size	= 64 * 1024,
-		.feature_bits	= FEATURE_REGISTERMAP,
+		.feature_bits	= FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
 		.tested		= TEST_OK_PRW,
 		.probe		= probe_sst_fwhub,
 		.probe_timing	= 1,		/* 150 ns | routine is wrapper to probe_jedec (sst_fwhub.c) */
@@ -4260,6 +4315,7 @@
 		.model_id	= SST_49LF008C,
 		.total_size	= 1024,
 		.page_size	= 4 * 1024,
+		.feature_bits	= 0,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_49lfxxxc,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (sst49lfxxxc.c) */
@@ -4291,6 +4347,7 @@
 		.model_id	= SST_49LF016C,
 		.total_size	= 2048,
 		.page_size	= 4 * 1024,
+		.feature_bits	= 0,
 		.tested		= TEST_OK_PRW,
 		.probe		= probe_49lfxxxc,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (sst49lfxxxc.c) */
@@ -4322,7 +4379,8 @@
 		.model_id	= SST_49LF020,
 		.total_size	= 256,
 		.page_size	= 16 * 1024,
-		.tested		= TEST_OK_PR,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns */ 
 		.erase		= NULL,
@@ -4339,7 +4397,7 @@
 				.block_erase = NULL,
 			}
 		},
-		.write		= write_49lf040,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4351,7 +4409,8 @@
 		.model_id	= SST_49LF020A,
 		.total_size	= 256,
 		.page_size	= 4 * 1024,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns */ 
 		.erase		= NULL,
@@ -4368,7 +4427,7 @@
 				.block_erase = NULL,
 			}
 		},
-		.write		= write_49lf040,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4380,7 +4439,8 @@
 		.model_id	= SST_49LF040,
 		.total_size	= 512,
 		.page_size	= 4096,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,			/* 150 ns */ 
 		.erase		= NULL,
@@ -4397,7 +4457,7 @@
 				.block_erase = NULL,
 			}
 		},
-		.write		= write_49lf040,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4409,7 +4469,7 @@
 		.model_id	= SST_49LF040B,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.feature_bits	= FEATURE_REGISTERMAP,
+		.feature_bits	= FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 1,		/* 150ns | routine is wrapper to probe_jedec (sst_fwhub.c) */
@@ -4427,7 +4487,7 @@
 				.block_erase = NULL,
 			}
 		},
-		.write		= write_49lf040,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4439,7 +4499,8 @@
  		.model_id	= SST_49LF080A,
 		.total_size	= 1024,
 		.page_size	= 4096,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_FIXME, 
 		.erase		= NULL,
@@ -4456,7 +4517,7 @@
 				.block_erase = NULL,
 			}
 		},
-		.write		= write_49lf040,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4468,6 +4529,7 @@
 		.model_id	= SST_49LF160C,
 		.total_size	= 2048,
 		.page_size	= 4 * 1024,
+		.feature_bits	= 0,
 		.tested		= TEST_OK_PRW,
 		.probe		= probe_49lfxxxc,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (sst49lfxxxc.c) */
@@ -4818,6 +4880,7 @@
 		.model_id	= ST_M29F002B,
 		.total_size	= 256,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_AAA | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -4837,7 +4900,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_m29f002b,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4849,7 +4912,8 @@
 		.model_id	= ST_M29F002T,
 		.total_size	= 256,
 		.page_size	= 64 * 1024,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_ADDR_AAA | FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
 		.erase		= NULL,
@@ -4868,7 +4932,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_m29f002t,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4880,25 +4944,27 @@
 		.model_id	= ST_M29F040B,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.tested		= TEST_OK_PRW,
-		.probe		= probe_29f040b,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (am29f040b.c) */
 		.erase		= NULL,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {64 * 1024, 8}, },
-				.block_erase = erase_sector_29f040b,
+				.block_erase = erase_sector_jedec,
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
-				.block_erase = erase_chip_29f040b,
+				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_29f040b,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
 	{
+		/* FIXME: this has WORD/BYTE sequences; 2AA for word, 555 for byte */
 		.vendor		= "ST",
 		.name		= "M29F400BT",
 		.bustype	= CHIP_BUSTYPE_PARALLEL,
@@ -4906,6 +4972,7 @@
 		.model_id	= ST_M29F400BT,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_SHIFTED | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_m29f400bt,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (m29f400bt.c) */
@@ -4937,6 +5004,7 @@
 		.model_id	= ST_M29W010B,
 		.total_size	= 128,
 		.page_size	= 16 * 1024,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -4951,7 +5019,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -4963,6 +5031,7 @@
 		.model_id	= ST_M29W040B,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -4977,21 +5046,21 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_jedec,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
 	{
 		.vendor		= "ST",
 		.name		= "M50FLW040A",
-		.bustype	= CHIP_BUSTYPE_FWH|CHIP_BUSTYPE_LPC, /* A/A Mux */
+		.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	= FEATURE_REGISTERMAP,
+		.feature_bits	= 0,
 		.tested		= TEST_UNTESTED,
-		.probe		= probe_jedec,
+		.probe		= probe_82802ab,
 		.probe_timing	= TIMING_FIXME,
 		.erase		= NULL,
 		.block_erasers	=
@@ -5019,14 +5088,14 @@
 	{
 		.vendor		= "ST",
 		.name		= "M50FLW040B",
-		.bustype	= CHIP_BUSTYPE_FWH|CHIP_BUSTYPE_LPC, /* A/A Mux */
+		.bustype	= CHIP_BUSTYPE_FWH | CHIP_BUSTYPE_LPC, /* A/A Mux */
 		.manufacture_id	= ST_ID,
 		.model_id	= ST_M50FLW040B,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.feature_bits	= FEATURE_REGISTERMAP,
+		.feature_bits	= 0,
 		.tested		= TEST_UNTESTED,
-		.probe		= probe_jedec,
+		.probe		= probe_82802ab,
 		.probe_timing	= TIMING_FIXME,
 		.erase		= NULL,
 		.block_erasers	=
@@ -5054,14 +5123,14 @@
 	{
 		.vendor		= "ST",
 		.name		= "M50FLW080A",
-		.bustype	= CHIP_BUSTYPE_FWH|CHIP_BUSTYPE_LPC, /* A/A Mux */
+		.bustype	= CHIP_BUSTYPE_FWH | CHIP_BUSTYPE_LPC, /* A/A Mux */
 		.manufacture_id	= ST_ID,
 		.model_id	= ST_M50FLW080A,
 		.total_size	= 1024,
 		.page_size	= 64 * 1024,
-		.feature_bits	= FEATURE_REGISTERMAP,
-		.tested		= TEST_OK_PRW,
-		.probe		= probe_jedec,
+		.feature_bits	= 0,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_82802ab,
 		.probe_timing	= TIMING_FIXME,
 		.erase		= NULL,
 		.block_erasers	=
@@ -5089,14 +5158,14 @@
 	{
 		.vendor		= "ST",
 		.name		= "M50FLW080B",
-		.bustype	= CHIP_BUSTYPE_FWH|CHIP_BUSTYPE_LPC, /* A/A Mux */
+		.bustype	= CHIP_BUSTYPE_FWH | CHIP_BUSTYPE_LPC, /* A/A Mux */
 		.manufacture_id	= ST_ID,
 		.model_id	= ST_M50FLW080B,
 		.total_size	= 1024,
 		.page_size	= 64 * 1024,
-		.feature_bits	= FEATURE_REGISTERMAP,
+		.feature_bits	= 0,
 		.tested		= TEST_UNTESTED,
-		.probe		= probe_jedec,
+		.probe		= probe_82802ab,
 		.probe_timing	= TIMING_FIXME,
 		.erase		= NULL,
 		.block_erasers	=
@@ -5129,8 +5198,9 @@
 		.model_id	= ST_M50FW002,
 		.total_size	= 256,
 		.page_size	= 64 * 1024,
+		.feature_bits	= 0,
 		.tested		= TEST_UNTESTED,
-		.probe		= probe_49lfxxxc,
+		.probe		= probe_82802ab,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (sst49lfxxxc.c) */
 		.erase		= NULL,
 		.block_erasers	=
@@ -5148,7 +5218,7 @@
 				.block_erase = erase_chip_stm50flw0x0x,
 			}
 		},
-		.write		= NULL,
+		.write		= write_stm50flw0x0x,
 		.read		= read_memmapped,
 	},
 
@@ -5160,6 +5230,7 @@
 		.model_id	= ST_M50FW016,
 		.total_size	= 2048,
 		.page_size	= 64 * 1024,
+		.feature_bits	= 0,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_82802ab,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (82802ab.c) */
@@ -5186,6 +5257,7 @@
 		.model_id	= ST_M50FW040,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
+		.feature_bits	= 0,
 		.tested		= TEST_OK_PRW,
 		.probe		= probe_82802ab,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (82802ab.c) */
@@ -5212,6 +5284,7 @@
 		.model_id	= ST_M50FW080,
 		.total_size	= 1024,
 		.page_size	= 64 * 1024,
+		.feature_bits	= 0,
 		.tested		= TEST_OK_PRW,
 		.probe		= probe_82802ab,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (82802ab.c) */
@@ -5238,8 +5311,9 @@
 		.model_id	= ST_M50LPW116,
 		.total_size	= 2048,
 		.page_size	= 64 * 1024,
+		.feature_bits	= 0,
 		.tested		= TEST_UNTESTED,
-		.probe		= probe_jedec,
+		.probe		= probe_82802ab,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
 		.erase		= NULL,
 		.block_erasers	=
@@ -5255,10 +5329,10 @@
 				.block_erase = erase_block_stm50flw0x0x,
 			}, {
 				.eraseblocks = { {2 * 1024 * 1024, 1} },
-				.block_erase = erase_chip_block_jedec,
+				.block_erase = erase_chip_stm50flw0x0x,
 			}
 		},
-		.write		= write_jedec,
+		.write		= write_stm50flw0x0x,
 		.read		= read_memmapped,
 	},
 
@@ -5270,6 +5344,7 @@
 		.model_id	= S29C31004T,
 		.total_size	= 512,
 		.page_size	= 128,
+		.feature_bits	= FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -5284,7 +5359,7 @@
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5296,6 +5371,7 @@
 		.model_id	= S29C51001T,
 		.total_size	= 128,
 		.page_size	= 128,
+		.feature_bits	= FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -5310,7 +5386,7 @@
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5322,7 +5398,8 @@
 		.model_id	= S29C51002T,
 		.total_size	= 256,
 		.page_size	= 128,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
 		.erase		= NULL,
@@ -5336,7 +5413,7 @@
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5348,6 +5425,7 @@
 		.model_id	= S29C51004T,
 		.total_size	= 512,
 		.page_size	= 128,
+		.feature_bits	= FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,
@@ -5362,7 +5440,7 @@
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5374,6 +5452,7 @@
 		.model_id	= TI_TMS29F002RB,
 		.total_size	= 256,
 		.page_size	= 16384, /* Non-uniform sectors */
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -5393,7 +5472,7 @@
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= NULL,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5405,6 +5484,7 @@
 		.model_id	= TI_TMS29F002RT,
 		.total_size	= 256,
 		.page_size	= 16384, /* Non-uniform sectors */
+		.feature_bits	= FEATURE_ADDR_2AA | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_ZERO,	/* Datasheet has no timing info specified */
@@ -5424,7 +5504,7 @@
 				.block_erase = erase_chip_block_jedec,
 			},
 		},
-		.write		= NULL,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5681,7 +5761,8 @@
 		.model_id	= W_29C011,
 		.total_size	= 128,
 		.page_size	= 128,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_LONG_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10,		/* used datasheet for the W29C011A */
 		.erase		= NULL,
@@ -5704,7 +5785,8 @@
 		.model_id	= W_29C020C,
 		.total_size	= 256,
 		.page_size	= 128,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_LONG_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10, 
 		.erase		= NULL,
@@ -5727,7 +5809,8 @@
 		.model_id	= W_29C040P,
 		.total_size	= 512,
 		.page_size	= 256,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_LONG_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10, 
 		.erase		= NULL,
@@ -5750,6 +5833,7 @@
 		.model_id	= W_29C011,
 		.total_size	= 128,
 		.page_size	= 128,
+		.feature_bits	= FEATURE_LONG_RESET,
 		.tested		= TEST_OK_PRW,
 		.probe		= probe_w29ee011,
 		.probe_timing	= TIMING_IGNORED, /* routine don't use probe_timing (w29ee011.c) */
@@ -5773,7 +5857,8 @@
 		.model_id	= W_39V040A,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10, 
 		.erase		= NULL,
@@ -5787,7 +5872,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5799,7 +5884,8 @@
 		.model_id	= W_39V040B,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.tested		= TEST_OK_PR | TEST_BAD_WRITE,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10, 
 		.erase		= NULL,
@@ -5813,7 +5899,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5825,8 +5911,9 @@
 		.model_id	= W_39V040C,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.tested		= TEST_OK_PRW,
-		.probe		= probe_w39v040c,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_jedec,
 		.probe_timing	= TIMING_FIXME,
 		.erase		= NULL, /* Was erase_w39v040c */
 		.block_erasers	=
@@ -5839,7 +5926,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_w39v040c,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5851,7 +5938,8 @@
 		.model_id	= W_39V040FA,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10, 
 		.erase		= NULL,
@@ -5868,7 +5956,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5880,7 +5968,8 @@
 		.model_id	= W_39V080A,
 		.total_size	= 1024,
 		.page_size	= 64 * 1024,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10, 
 		.erase		= NULL,
@@ -5894,7 +5983,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5906,7 +5995,8 @@
 		.model_id	= W_49F002U,
 		.total_size	= 256,
 		.page_size	= 128,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10,
 		.erase		= NULL,
@@ -5925,7 +6015,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5937,7 +6027,8 @@
 		.model_id	= W_49V002A,
 		.total_size	= 256,
 		.page_size	= 128,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10, 
 		.erase		= NULL,
@@ -5956,7 +6047,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5968,6 +6059,7 @@
 		.model_id	= W_49V002FA,
 		.total_size	= 256,
 		.page_size	= 128,
+		.feature_bits	= FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= 10,
@@ -5987,7 +6079,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_49f002,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -5999,8 +6091,8 @@
 		.model_id	= W_39V080FA,
 		.total_size	= 1024,
 		.page_size	= 64 * 1024,
-		.feature_bits	= FEATURE_REGISTERMAP,
-		.tested		= TEST_OK_PRW,
+		.feature_bits	= FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
+		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_FIXME,
 		.erase		= NULL, /* Was erase_winbond_fwhub */
@@ -6014,7 +6106,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_winbond_fwhub,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
@@ -6026,7 +6118,7 @@
 		.model_id	= W_39V080FA_DM,
 		.total_size	= 512,
 		.page_size	= 64 * 1024,
-		.feature_bits	= FEATURE_REGISTERMAP,
+		.feature_bits	= FEATURE_REGISTERMAP | FEATURE_EITHER_RESET,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_jedec,
 		.probe_timing	= TIMING_FIXME,
@@ -6041,7 +6133,7 @@
 				.block_erase = erase_chip_block_jedec,
 			}
 		},
-		.write		= write_winbond_fwhub,
+		.write		= write_jedec_1,
 		.read		= read_memmapped,
 	},
 
diff --git a/jedec.c b/jedec.c
index 055fbc3..055e910 100644
--- a/jedec.c
+++ b/jedec.c
@@ -27,6 +27,7 @@
 #define MAX_REFLASH_TRIES 0x10
 #define MASK_FULL 0xffff
 #define MASK_2AA 0x7ff
+#define MASK_AAA 0xfff
 
 /* Check one byte for odd parity */
 uint8_t oddparity(uint8_t val)
@@ -98,8 +99,7 @@
 	chip_writeb(0xA0, bios + (0x5555 & mask));
 }
 
-int probe_jedec_common(struct flashchip *flash,
-			unsigned int mask, int long_reset)
+int probe_jedec_common(struct flashchip *flash, unsigned int mask)
 {
 	chipaddr bios = flash->virtual_memory;
 	uint8_t id1, id2;
@@ -152,7 +152,7 @@
 	}
 
 	/* Issue JEDEC Product ID Exit command */
-	if (long_reset)
+	if ((flash->feature_bits & FEATURE_SHORT_RESET) == FEATURE_LONG_RESET)
 	{
 		chip_writeb(0xAA, bios + (0x5555 & mask));
 		if (probe_timing_exit)
@@ -379,6 +379,12 @@
 	case FEATURE_ADDR_FULL:
 		return MASK_FULL;
 		break;
+	case FEATURE_ADDR_2AA:
+		return MASK_2AA;
+		break;
+	case FEATURE_ADDR_AAA:
+		return MASK_AAA;
+		break;
 	default:
 		fprintf(stderr, "%s called with unknown mask\n", __func__);
 		return 0;
@@ -388,10 +394,13 @@
 
 int write_jedec(struct flashchip *flash, uint8_t *buf)
 {
+	int mask;
 	int i, failed = 0;
 	int total_size = flash->total_size * 1024;
 	int page_size = flash->page_size;
 
+	mask = getaddrmask(flash);
+
 	if (erase_chip_jedec(flash)) {
 		fprintf(stderr,"ERASE FAILED!\n");
 		return -1;
@@ -401,7 +410,7 @@
 	for (i = 0; i < total_size / page_size; i++) {
 		printf("%04d at address: 0x%08x", i, i * page_size);
 		if (write_page_write_jedec_common(flash, buf + i * page_size,
-					   i * page_size, page_size, MASK_FULL))
+					   i * page_size, page_size, mask))
 			failed = 1;
 		printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
 	}
@@ -415,6 +424,9 @@
 	int i;
 	chipaddr bios = flash->virtual_memory;
 	chipaddr dst = bios;
+	int mask;
+
+	mask = getaddrmask(flash);
 
 	programmer_delay(10);
 	if (erase_flash(flash)) {
@@ -427,7 +439,7 @@
 		if ((i & 0x3) == 0)
 			printf("address: 0x%08lx", (unsigned long)i * 1024);
 
-                write_sector_jedec_common(flash, buf + i * 1024, dst + i * 1024, 1024, MASK_FULL);
+                write_sector_jedec_common(flash, buf + i * 1024, dst + i * 1024, 1024, mask);
 
 		if ((i & 0x3) == 0)
 			printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
@@ -441,12 +453,15 @@
 int erase_chip_block_jedec(struct flashchip *flash, unsigned int addr,
 			   unsigned int blocksize)
 {
+	int mask;
+
+	mask = getaddrmask(flash);
 	if ((addr != 0) || (blocksize != flash->total_size * 1024)) {
 		fprintf(stderr, "%s called with incorrect arguments\n",
 			__func__);
 		return -1;
 	}
-	return erase_chip_jedec_common(flash, MASK_FULL);
+	return erase_chip_jedec_common(flash, mask);
 }
 
 int probe_jedec(struct flashchip *flash)
@@ -454,20 +469,29 @@
 	int mask;
 
 	mask = getaddrmask(flash);
-	return probe_jedec_common(flash, mask, 1);
+	return probe_jedec_common(flash, mask);
 }
 
 int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int size)
 {
-	return erase_sector_jedec_common(flash, page, size, MASK_FULL);
+	int mask;
+
+	mask = getaddrmask(flash);
+	return erase_sector_jedec_common(flash, page, size, mask);
 }
 
 int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int size)
 {
-	return erase_block_jedec_common(flash, page, size, MASK_FULL);
+	int mask;
+
+	mask = getaddrmask(flash);
+	return erase_block_jedec_common(flash, page, size, mask);
 }
 
 int erase_chip_jedec(struct flashchip *flash)
 {
-	return erase_chip_jedec_common(flash, MASK_FULL);
+	int mask;
+
+	mask = getaddrmask(flash);
+	return erase_chip_jedec_common(flash, mask);
 }