flashchips: Add STM M28F256

Very simple 5V, 12V Vpp, 256kbit parallel flash.

Datasheet used:
https://www.mouser.com/catalog/specsheets/STMicroelectronics_M28F256.pdf

Change-Id: I95a59d0b36a9a99e102788bd9c850bf12192efba
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/522
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/82802ab.c b/82802ab.c
index c958f04..0af5d28 100644
--- a/82802ab.c
+++ b/82802ab.c
@@ -117,7 +117,7 @@
 	if (chip)
 		return probe_82802ab_generic(par, chip->total_size * KiB, chip->feature_bits);
 
-	for (chip_size = 256*KiB; chip_size <= 2*MiB; chip_size *= 2) {
+	for (chip_size = 32*KiB; chip_size <= 2*MiB; chip_size *= 2) {
 		*next_ptr = probe_82802ab_generic(par, chip_size, 0);
 		if (*next_ptr)
 			next_ptr = &(*next_ptr)->next;
diff --git a/flashchips.c b/flashchips.c
index d2fbaa3..6e9c9b4 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -20184,6 +20184,29 @@
 
 	{
 		.vendor		= "ST",
+		.name		= "M28F256",
+		.bustype	= BUS_PARALLEL,
+		.id.type	= ID_82802AB,
+		.id.manufacture	= ST_ID,
+		.id.model	= ST_M28F256,
+		.total_size	= 32,
+		.tested		= TEST_OK_PREW,
+		.block_erasers	=
+		{
+			{
+				.eraseblocks = { {32 * 1024, 1} },
+				.block_erase = erase_m28f,
+			}
+		},
+		.write		= write_m28f,
+		.read		= read_memmapped,
+		.voltage	= {4750, 5250}, /* 4.75-5.25V for type -X, others 4.5-5.5V, 12V Vpp */
+		.prepare_access	= prepare_memory_access,
+		.finish_access	= finish_memory_access,
+	},
+
+	{
+		.vendor		= "ST",
 		.name		= "M29F002B",
 		.bustype	= BUS_PARALLEL,
 		.id.type	= ID_JEDEC,
diff --git a/include/flashchips.h b/include/flashchips.h
index dd641d9..c1336cd 100644
--- a/include/flashchips.h
+++ b/include/flashchips.h
@@ -904,6 +904,7 @@
 #define ST_M29W010B		0x23
 #define ST_M29W040B		0xE3
 #define ST_M29W512B		0x27
+#define ST_M28F256		0xA8
 #define ST_M28W160ECB		0x88CF
 #define ST_M28W160ECT		0x88CE
 #define ST_M28W320FCB		0x88BB