flashchips: Add Fudan FM25W128, wide voltage range chip

Surprisingly, this chip is status-register-wise closer to the
FM25Q64 than the FM25Q128. There's also a 3rd status register,
but it is read only.

Some of the BP bits aren't documented. Hence we don't hook the
WP support up.

Datasheet used:
https://www.fmsh.com/nvm/FM25W128_ds_eng.pdf

Change-Id: Id0e3ac404b5de0caa84775cdb112e6ccf50566a5
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/573
diff --git a/flashchips.c b/flashchips.c
index c1e08d9..2d98ab6 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -7114,6 +7114,61 @@
 	},
 
 	{
+		.vendor		= "Fudan",
+		.name		= "FM25W128",
+		.bustype	= BUS_SPI,
+		.id.type	= ID_SPI_RDID,
+		.id.manufacture	= FUDAN_ID_NOPREFIX,
+		.id.model	= FUDAN_FM25W128,
+		.total_size	= 16384,
+		.page_size	= 256,
+		.feature_bits	= FEATURE_WRSR_EITHER | FEATURE_WRSR_EXT2 | FEATURE_WRSR2 |
+				  FEATURE_OTP | FEATURE_QPI_SRP,
+		.dummy_cycles	= { .qpi_read_params = { 2, 4, 6, 8 } },
+		.tested		= TEST_UNTESTED,
+		.block_erasers	=
+		{
+			{
+				.eraseblocks = { {4 * 1024, 4096} },
+				.block_erase = spi_block_erase_20,
+			}, {
+				.eraseblocks = { {32 * 1024, 512} },
+				.block_erase = spi_block_erase_52,
+			}, {
+				.eraseblocks = { {64 * 1024, 256} },
+				.block_erase = spi_block_erase_d8,
+			}, {
+				.eraseblocks = { {16384 * 1024, 1} },
+				.block_erase = spi_block_erase_60,
+			}, {
+				.eraseblocks = { {16384 * 1024, 1} },
+				.block_erase = spi_block_erase_c7,
+			},
+		},
+		.reg_bits	=
+		{
+			.qe	= {STATUS2, 1, RW},
+			/*
+			 * Not all BP bit combinations are documented,
+			 * full WP support would need specific testing.
+			 * .srp	= {STATUS1, 7, RW},
+			 * .srl	= {STATUS2, 0, RW},
+			 * .bp	= {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}},
+			 * .tb	= {STATUS1, 5, RW},
+			 * .sec	= {STATUS1, 6, RW},
+			 * .cmp	= {STATUS2, 6, RW},
+			 */
+		},
+		.printlock	= spi_prettyprint_status_register_bp2_tb_bpl,
+		.unlock		= spi_disable_blockprotect_bp2_srwd,
+		.write		= spi_chip_write_256,
+		.read		= spi_chip_read,
+		.voltage	= {1650, 3600},
+		.prepare_access	= spi_prepare_io,
+		.finish_access	= spi_finish_io,
+	},
+
+	{
 		.vendor		= "Fujitsu",
 		.name		= "MBM29F004BC",
 		.bustype	= BUS_PARALLEL,
diff --git a/include/flashchips.h b/include/flashchips.h
index 0631277..557043e 100644
--- a/include/flashchips.h
+++ b/include/flashchips.h
@@ -346,6 +346,7 @@
 
 #define FUDAN_ID		0x7F7F7F7F7F7F7FA1	/* Shanghai Fudan Microelectronics resides in bank 8 */
 #define FUDAN_ID_NOPREFIX	0xA1	/* Fudan, missing 0x7F prefix */
+#define FUDAN_FM25W128		0x2818
 #define FUDAN_FM25F005		0x3110
 #define FUDAN_FM25F01		0x3111
 #define FUDAN_FM25F02		0x3112	/* Same as FM25F02A */