flashchips: Add Fudan FM25Q128 3.3V part

This chip has non-volatile DC bits that control the number of dummy
cycles for all fast-read commands in all modes. As we don't check
such bits, we don't enable any fast reads for now. Otherwise it
looks well featured. Block protection seems to follow Winbonds
scheme, however without SEC and SRL bits.

Datasheet used:
http://eng.fmsh.com/nvm/FM25Q128_ds_eng.pdf

Change-Id: I9cda2fdbc13c20eda999555d09c9a847d0192536
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/290
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/flashchips.c b/flashchips.c
index 8bb8eb5..e077c69 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -6993,6 +6993,63 @@
 	},
 
 	{
+		.vendor		= "Fudan",
+		.name		= "FM25Q128",
+		.bustype	= BUS_SPI,
+		.manufacture_id	= FUDAN_ID_NOPREFIX,
+		.model_id	= FUDAN_FM25Q128,
+		.total_size	= 16384,
+		.page_size	= 256,
+		/* Supports full QIO/QPI but has non-volatile DC bits controlling all modes. */
+		.feature_bits	= FEATURE_WRSR_EITHER | FEATURE_WRSR_EXT2 |
+				  FEATURE_WRSR2 | FEATURE_WRSR3 | FEATURE_OTP |
+				  FEATURE_FAST_READ | FEATURE_FAST_READ_DOUT | FEATURE_FAST_READ_QOUT,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_spi_rdid,
+		.probe_timing	= TIMING_ZERO,
+		.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},
+			.dc	= {{STATUS2, 6, RW}, {STATUS2, 7, RW}},
+			.srp	= {STATUS1, 7, RW},
+			.bp	= {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}},
+			.tb	= {STATUS1, 5, RW},
+			.cmp	= {STATUS1, 6, RW},
+			.wps	= {STATUS3, 2, RW},
+		},
+		.wp_write_cfg	= spi_wp_write_cfg,
+		.wp_read_cfg	= spi_wp_read_cfg,
+		.wp_get_ranges	= spi_wp_get_available_ranges,
+		.decode_range	= decode_range_spi25,
+		.printlock	= spi_prettyprint_status_register_bp2_tb_bpl,
+		.unlock		= spi_disable_blockprotect_bp2_srwd,
+		.write		= spi_chip_write_256,
+		.read		= spi_chip_read,
+		.voltage	= {2700, 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 4718bd2..03798bf 100644
--- a/include/flashchips.h
+++ b/include/flashchips.h
@@ -354,6 +354,7 @@
 #define FUDAN_FM25Q16		0x4015
 #define FUDAN_FM25Q32		0x4016
 #define FUDAN_FM25Q64		0x4017
+#define FUDAN_FM25Q128		0x4018
 
 #define FUJITSU_ID		0x04	/* Fujitsu */
 #define FUJITSU_MBM29DL400BC	0x0F