flashchips: Add Winbond 25Q40EW and rename 25Q40.W

Same story as for 25Q80BW/EW, 25Q40EW has a new ID and the only known
chip with the old ID is the BW variant.

Change-Id: Ib610b0d6f3a5561b2ac3505ef15bdee8b0edae25
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/25462
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
diff --git a/flashchips.c b/flashchips.c
index 3c04533..8eda608 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -15137,10 +15137,10 @@
 
 	{
 		.vendor		= "Winbond",
-		.name		= "W25Q40.W",
+		.name		= "W25Q40BW",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= WINBOND_NEX_ID,
-		.model_id	= WINBOND_NEX_W25Q40_W,
+		.model_id	= WINBOND_NEX_W25Q40BW,
 		.total_size	= 512,
 		.page_size	= 256,
 		/* OTP: 256B total; read 0x48; write 0x42, erase 0x44, read ID 0x4B */
@@ -15212,6 +15212,46 @@
 		.read		= spi_chip_read,
 		.voltage	= {1700, 1950}, /* Fast read (0x0B) and multi I/O supported */
 	},
+
+	{
+		.vendor		= "Winbond",
+		.name		= "W25Q40EW",
+		.bustype	= BUS_SPI,
+		.manufacture_id	= WINBOND_NEX_ID,
+		.model_id	= WINBOND_NEX_W25Q40EW,
+		.total_size	= 512,
+		.page_size	= 256,
+		/* OTP: 3*256B total; read 0x48; write 0x42, erase 0x44, read ID 0x4B */
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_spi_rdid,
+		.probe_timing	= TIMING_ZERO,
+		.block_erasers	=
+		{
+			{
+				.eraseblocks = { {4 * 1024, 128} },
+				.block_erase = spi_block_erase_20,
+			}, {
+				.eraseblocks = { {32 * 1024, 16} },
+				.block_erase = spi_block_erase_52,
+			}, {
+				.eraseblocks = { {64 * 1024, 8} },
+				.block_erase = spi_block_erase_d8,
+			}, {
+				.eraseblocks = { {512 * 1024, 1} },
+				.block_erase = spi_block_erase_60,
+			}, {
+				.eraseblocks = { {512 * 1024, 1} },
+				.block_erase = spi_block_erase_c7,
+			}
+		},
+		.printlock	= spi_prettyprint_status_register_plain, /* TODO: improve */
+		.unlock		= spi_disable_blockprotect,
+		.write		= spi_chip_write_256,
+		.read		= spi_chip_read,
+		.voltage	= {1650, 1950}, /* Fast read (0x0B) and multi I/O supported */
+	},
+
 	{
 		.vendor		= "Winbond",
 		.name		= "W25Q80EW",
diff --git a/flashchips.h b/flashchips.h
index 348f2fd..f00be3b 100644
--- a/flashchips.h
+++ b/flashchips.h
@@ -908,8 +908,9 @@
 #define WINBOND_NEX_W25Q128_V	0x4018	/* W25Q128BV; W25Q128FV in SPI mode (default) */
 #define WINBOND_NEX_W25Q256_V	0x4019	/* W25Q256FV */
 #define WINBOND_NEX_W25Q20_W	0x5012	/* W25Q20BW */
-#define WINBOND_NEX_W25Q40_W	0x5013	/* W25Q40BW */
+#define WINBOND_NEX_W25Q40BW	0x5013	/* W25Q40BW */
 #define WINBOND_NEX_W25Q80BW	0x5014	/* W25Q80BW */
+#define WINBOND_NEX_W25Q40EW	0x6013	/* W25Q40EW */
 #define WINBOND_NEX_W25Q80EW	0x6014	/* W25Q80EW */
 #define WINBOND_NEX_W25Q16_W	0x6015	/* W25Q16DW */
 #define WINBOND_NEX_W25Q32_W	0x6016	/* W25Q32DW; W25Q32FV in QPI mode */