[3/4] WIP: Add support for OTP/Security Register infrastructure to existing chips

Submitted by Hatim Kanchwala on July 28, 2016, 12:15 p.m.

Details

Message ID 1469708129-1422-4-git-send-email-hatim@hatimak.me
State New
Headers show

Commit Message

Hatim Kanchwala July 28, 2016, 12:15 p.m.
Infrastructure support in flashchips.c added for (31 in total) -
  - Eon(13) : EN25Q40, EN25Q80(A), EN25Q16, EN25Q32(A/B), EN25Q64, EN25Q128, EN25QH16, EN25QH32, EN25QH64, EN25QH128
  - GigaDevice(16) : GD25LQ40, GD25LQ80, GD25LQ16, GD25Q80B, GD25Q16B, GD25Q32(B), GD25Q64(B), GD25Q128B, GD25Q128C, GD25VQ21B, GD25VQ40C, GD25VQ41B, GD25VQ80C, GD25VQ16C
  - Winbond(2) : W25Q40BL, W25Q64FV

Signed-off-by: Hatim Kanchwala <hatim@hatimak.me>
---
 Makefile      |   3 +-
 flashchips.c  | 117 +++++++++++++++---------------
 otp.h         |  11 +++
 otp_layouts.c | 229 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 302 insertions(+), 58 deletions(-)
 create mode 100644 otp_layouts.c

Patch hide | download patch | download mbox

diff --git a/Makefile b/Makefile
index e97f641..47b9e2c 100644
--- a/Makefile
+++ b/Makefile
@@ -504,27 +504,28 @@  endif
 ifeq ($(CONFIG_IT8212), yes)
 UNSUPPORTED_FEATURES += CONFIG_IT8212=yes
 else
 override CONFIG_IT8212 = no
 endif
 endif
 
 ###############################################################################
 # Flash chip drivers and bus support infrastructure.
 
 CHIP_OBJS = jedec.o stm50.o w39.o w29ee011.o \
 	sst28sf040.o 82802ab.o sst49lfxxxc.o sst_fwhub.o flashchips.o spi.o \
 	spi25.o spi25_statusreg.o otp.o writeprotect.o statusreg_layouts.o \
-	writeprotect_layouts.o opaque.o sfdp.o en29lv640b.o at45db.o
+	otp_layouts.o writeprotect_layouts.o opaque.o sfdp.o en29lv640b.o \
+	at45db.o
 
 ###############################################################################
 # Library code.
 
 LIB_OBJS = layout.o flashrom.o udelay.o programmer.o helpers.o
 
 ###############################################################################
 # Frontend related stuff.
 
 CLI_OBJS = cli_classic.o cli_output.o cli_common.o print.o
 
 # Set the flashrom version string from the highest revision number of the checked out flashrom files.
 # Note to packagers: Any tree exported with "make export" or "make tarball"
diff --git a/flashchips.c b/flashchips.c
index 43545a4..b946cb8 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -4507,102 +4507,101 @@  const struct flashchip flashchips[] = {
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
 
 	{
 		.vendor		= "Eon",
 		.name		= "EN25Q40",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
 		.model_id	= EON_EN25Q40,
 		.total_size	= 512,
 		.page_size	= 256,
-		/* OTP: 256B total; enter 0x3A */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 128} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.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,
 			}
 		},
 		.status_register = &en25q80a_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 		.wp		= &en25q40_wp,
+		.otp		= &en256_512otp,
 	},
 
 	{
 		.vendor		= "Eon",
 		.name		= "EN25Q80(A)",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
 		.model_id	= EON_EN25Q80,
 		.total_size	= 1024,
 		.page_size	= 256,
-		/* OTP: 256B total; enter 0x3A */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 256} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {64 * 1024, 16} },
 				.block_erase = spi_block_erase_d8,
 			}, {
 				.eraseblocks = { {1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &en25q80a_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 		.wp		= &en25q80a_wp,
+		.otp		= &en256_1024otp,
 	},
 
 	{
 		/* Note: EN25D16 is an evil twin which shares the model ID
 		   but has different write protection capabilities */
 		.vendor		= "Eon",
 		.name		= "EN25Q16",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
 		.model_id	= EON_EN25Q16,
 		.total_size	= 2048,
 		.page_size	= 256,
-		/* OTP: D16 512B/Q16 128B total; enter 0x3A */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 512} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {64 * 1024, 32} },
 				.block_erase = spi_block_erase_d8,
 			}, {
 				/* not supported by Q16 version */
@@ -4611,319 +4610,320 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {2 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {2 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &en25q16_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 		.wp		= &en25q16_wp,
+		.otp		= &en128_2048otp,
 	},
 
 	{
 		.vendor		= "Eon",
 		.name		= "EN25Q32",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
 		.model_id	= EON_EN25Q32,
 		.total_size	= 4096,
 		.page_size	= 256,
-		/* OTP: 512B total; enter 0x3A */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 1024} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {64 * 1024, 64} },
 				.block_erase = spi_block_erase_d8,
 			}, {
 				.eraseblocks = { {4 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {4 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &en25q16_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 		.wp		= &en25q32_wp,
+		.otp		= &en512_4096otp,
 	},
 
 	{
 		.vendor		= "Eon",
 		.name		= "EN25Q32A/EN25Q32B",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
 		.model_id	= EON_EN25Q32,
 		.total_size	= 4096,
 		.page_size	= 256,
-		/* OTP: 512B total; enter 0x3A */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 1024} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {64 * 1024, 64} },
 				.block_erase = spi_block_erase_d8,
 			}, {
 				.eraseblocks = { {4 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {4 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &en25qh128_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 		.wp		= &en25q32ab_wp,
+		.otp		= &en512_4096otp,
 	},
 
 	{
 		.vendor		= "Eon",
 		.name		= "EN25Q64",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
 		.model_id	= EON_EN25Q64,
 		.total_size	= 8192,
 		.page_size	= 256,
-		/* OTP: 512B total; enter 0x3A */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 2048} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {64 * 1024, 128} },
 				.block_erase = spi_block_erase_d8,
 			}, {
 				.eraseblocks = { {8 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {8 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &en25qh128_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 		.wp		= &en25q64_wp,
+		.otp		= &en512_8192otp,
 	},
 
 	{
 		.vendor		= "Eon",
 		.name		= "EN25Q128",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
 		.model_id	= EON_EN25Q128,
 		.total_size	= 16384,
 		.page_size	= 256,
-		/* OTP: 512B total; enter 0x3A */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 4096} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {64 * 1024, 256} },
 				.block_erase = spi_block_erase_d8,
 			}, {
 				.eraseblocks = { {16 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {16 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &en25qh128_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.wp		= &en25q128_wp,
+		.otp		= &en512_16384otp,
 	},
 
 	{
 		.vendor		= "Eon",
 		.name		= "EN25QH16",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
 		.model_id	= EON_EN25QH16,
 		.total_size	= 2048,
 		.page_size	= 256,
 		/* supports SFDP */
-		/* OTP: 512B total; enter 0x3A */
 		/* QPI enable 0x38, disable 0xFF */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI,
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_QPI,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 512} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {64 * 1024, 32} },
 				.block_erase = spi_block_erase_d8,
 			}, {
 				.eraseblocks = { {1024 * 2048, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {1024 * 2048, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &en25qh16_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 		.wp		= &en25qh16_wp,
+		.otp		= &en512_2048otp,
 	},
 
 	{
 		.vendor		= "Eon",
 		.name		= "EN25QH32",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
 		.model_id	= EON_EN25QH32,
 		.total_size	= 4096,
 		.page_size	= 256,
 		/* supports SFDP */
-		/* OTP: 512B total; enter 0x3A */
 		/* QPI enable 0x38, disable 0xFF */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI,
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_QPI,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 1024} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {64 * 1024, 64} },
 				.block_erase = spi_block_erase_d8,
 			}, {
 				.eraseblocks = { {1024 * 4096, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {1024 * 4096, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &en25qh128_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 		.wp		= &en25qh32_wp,
+		.otp		= &en512_4096otp,
 	},
 
 	{
 		.vendor		= "Eon",
 		.name		= "EN25QH64",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
 		.model_id	= EON_EN25QH64,
 		.total_size	= 8192,
 		.page_size	= 256,
 		/* supports SFDP */
-		/* OTP: 512B total; enter 0x3A */
 		/* QPI enable 0x38, disable 0xFF */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI,
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_QPI,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	= {
 			{
 				.eraseblocks = { {4 * 1024, 2048} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {64 * 1024, 128} },
 				.block_erase = spi_block_erase_d8,
 			}, {
 				.eraseblocks = { { 8192 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { { 8192 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &en25qh128_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 		.wp		= &en25qh64_wp,
+		.otp		= &en512_8192otp,
 	},
 
 	{
 		.vendor		= "Eon",
 		.name		= "EN25QH128",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
 		.model_id	= EON_EN25QH128,
 		.total_size	= 16384,
 		.page_size	= 256,
 		/* supports SFDP */
-		/* OTP: 512B total; enter 0x3A */
 		/* QPI enable 0x38, disable 0xFF */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI,
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_QPI,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	= {
 			{
 				.eraseblocks = { {4 * 1024, 4096} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.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,
 			}
 		},
 		.status_register = &en25qh128_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 		.wp		= &en25qh128_wp,
+		.otp		= &en512_16384otp,
 	},
 
 	{
 		.vendor		= "Eon",
 		.name		= "EN25S10",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= EON_ID_NOPREFIX,
 		.model_id	= EON_EN25S10,
 		.total_size	= 128,
 		.page_size	= 256,
 		/* OTP: 256B total; enter 0x3A */
 		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
 		.tested		= TEST_UNTESTED,
@@ -5714,28 +5714,27 @@  const struct flashchip flashchips[] = {
 		.write		= write_jedec_1, /* Supports a fast mode too */
 		.read		= read_memmapped,
 		.voltage	= {3000, 3600}, /* 3.0-3.6V for type -70, others 2.7-3.6V */
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25LQ40",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25LQ40,
 		.total_size	= 512,
 		.page_size	= 256,
-		/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.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} },
@@ -5743,38 +5742,38 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25lq_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {1695, 1950},
 		.wp		= &gd_w_wp,
+		.otp		= &gd_w256_3_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25LQ80",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25LQ80,
 		.total_size	= 1024,
 		.page_size	= 256,
-		/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 256} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {32 * 1024, 32} },
 				.block_erase = spi_block_erase_52,
 			}, {
 				.eraseblocks = { {64 * 1024, 16} },
@@ -5782,38 +5781,38 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {1 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {1 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25lq_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {1695, 1950},
 		.wp		= &gd_w_wp,
+		.otp		= &gd_w256_3_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25LQ16",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25LQ16,
 		.total_size	= 2048,
 		.page_size	= 256,
-		/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 512} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {32 * 1024, 64} },
 				.block_erase = spi_block_erase_52,
 			}, {
 				.eraseblocks = { {64 * 1024, 32} },
@@ -5821,26 +5820,27 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {2 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {2 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25lq_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {1695, 1950},
 		.wp		= &gd_w_wp,
+		.otp		= &gd_w256_3_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25LQ32",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25LQ32,
 		.total_size	= 4096,
 		.page_size	= 256,
 		/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44 */
 		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
 		.tested		= TEST_OK_PREW,
@@ -6095,27 +6095,27 @@  const struct flashchip flashchips[] = {
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2700, 3600},
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25Q80",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25Q80,
 		.total_size	= 1024,
 		.page_size	= 256,
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 256} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {32 * 1024, 32} },
 				.block_erase = spi_block_erase_52,
 			}, {
 				.eraseblocks = { {64 * 1024, 16} },
@@ -6133,28 +6133,27 @@  const struct flashchip flashchips[] = {
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2700, 3600},
 		.wp		= &gd_w_wp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25Q80B",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25Q80,
 		.total_size	= 1024,
 		.page_size	= 256,
-		/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 256} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {32 * 1024, 32} },
 				.block_erase = spi_block_erase_52,
 			}, {
 				.eraseblocks = { {64 * 1024, 16} },
@@ -6162,26 +6161,27 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25q80b_128_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2700, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd256_4_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25Q16",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25Q16,
 		.total_size	= 2048,
 		.page_size	= 256,
 		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
@@ -6210,28 +6210,27 @@  const struct flashchip flashchips[] = {
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2700, 3600},
 		.wp		= &gd_w_wp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25Q16B",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25Q16,
 		.total_size	= 2048,
 		.page_size	= 256,
-		/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44 (B version only) */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 512} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {32 * 1024, 64} },
 				.block_erase = spi_block_erase_52,
 			}, {
 				.eraseblocks = { {64 * 1024, 32} },
@@ -6239,38 +6238,38 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {2 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {2 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25q16_32_64b_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2700, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd256_4_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25Q32(B)",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25Q32,
 		.total_size	= 4096,
 		.page_size	= 256,
-		/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 1024} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {32 * 1024, 128} },
 				.block_erase = spi_block_erase_52,
 			}, {
 				.eraseblocks = { {64 * 1024, 64} },
@@ -6278,38 +6277,38 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {4 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {4 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25q16_32_64b_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2700, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd256_4_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25Q64(B)",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25Q64,
 		.total_size	= 8192,
 		.page_size	= 256,
-		/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 2048} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {32 * 1024, 256} },
 				.block_erase = spi_block_erase_52,
 			}, {
 				.eraseblocks = { {64 * 1024, 128} },
@@ -6317,38 +6316,38 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {8 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {8 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25q16_32_64b_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2700, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd256_4_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25Q128B",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25Q128,
 		.total_size	= 16384,
 		.page_size	= 256,
-		/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.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} },
@@ -6356,39 +6355,39 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {16 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {16 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25q16_32_64b_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2700, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd256_4_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25Q128C",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25Q128,
 		.total_size	= 16384,
 		.page_size	= 256,
-		/* OTP: 1536B total; read 0x48; write 0x42, erase 0x44 */
 		/* QPI: enable 0x38, disable 0xFF */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI,
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_QPI,
 		.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} },
@@ -6396,26 +6395,27 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {16 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {16 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25q128c_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2700, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd512_3_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25T80",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25T80,
 		.total_size	= 1024,
 		.page_size	= 256,
 		/* OTP: 256B total; enter 0x3A */
 		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
 		.tested		= TEST_UNTESTED,
@@ -6444,28 +6444,27 @@  const struct flashchip flashchips[] = {
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25VQ21B",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25VQ21B,
 		.total_size	= 256,
 		.page_size	= 256,
-		/* OTP: 1536B total; read 0x48, write 0x42, erase 0x44 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI,
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_QPI,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { { 4 * 1024, 64} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { { 32 * 1024, 8} },
 				.block_erase = spi_block_erase_52,
 			}, {
 				.eraseblocks = { { 64 * 1024, 4} },
@@ -6473,39 +6472,39 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {256 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {256 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25vq21_41b_q21_q41b_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2300, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd512_3_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25VQ40C",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25VQ41B,
 		.total_size	= 512,
 		.page_size	= 256,
 		/* Supports SFDP */
-		/* OTP: 1024B total; read 0x48, write 0x42, erase 0x44 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI,
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_QPI,
 		.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} },
@@ -6513,38 +6512,38 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25vq16_80c_q16_40c_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2300, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd256_4_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25VQ41B",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25VQ41B,
 		.total_size	= 512,
 		.page_size	= 256,
-		/* OTP: 1536B total; read 0x48, write 0x42, erase 0x44 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI,
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_QPI,
 		.tested		= TEST_OK_PREW,
 		.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} },
@@ -6552,39 +6551,39 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25vq21_41b_q21_q41b_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2300, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd512_3_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25VQ80C",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25VQ80C,
 		.total_size	= 1024,
 		.page_size	= 256,
 		/* Supports SFDP */
-		/* OTP: 1024B total; read 0x48, write 0x42, erase 0x44 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI,
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_QPI,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { { 4 * 1024, 256} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { { 32 * 1024, 32} },
 				.block_erase = spi_block_erase_52,
 			}, {
 				.eraseblocks = { { 64 * 1024, 16} },
@@ -6592,39 +6591,39 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25vq16_80c_q16_40c_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2300, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd256_4_otp,
 	},
 
 	{
 		.vendor		= "GigaDevice",
 		.name		= "GD25VQ16C",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= GIGADEVICE_ID,
 		.model_id	= GIGADEVICE_GD25VQ16C,
 		.total_size	= 2 * 1024,
 		.page_size	= 256,
 		/* Supports SFDP */
-		/* OTP: 1024B total; read 0x48, write 0x42, erase 0x44 */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI,
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_QPI,
 		.tested		= TEST_UNTESTED,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { { 4 * 1024, 512} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { { 32 * 1024, 64} },
 				.block_erase = spi_block_erase_52,
 			}, {
 				.eraseblocks = { { 64 * 1024, 32} },
@@ -6632,26 +6631,27 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {2 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {2 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &gd25vq16_80c_q16_40c_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2300, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd256_4_otp,
 	},
 
 	{
 		.vendor		= "Hyundai",
 		.name		= "HY29F002T",
 		.bustype	= BUS_PARALLEL,
 		.manufacture_id	= HYUNDAI_ID,
 		.model_id	= HYUNDAI_HY29F002T,
 		.total_size	= 256,
 		.page_size	= 256 * 1024,
 		.feature_bits	= FEATURE_EITHER_RESET, /* Some revisions may need FEATURE_ADDR_2AA */
 		.tested		= TEST_OK_PRE,
 		.probe		= probe_jedec,
@@ -14538,28 +14538,28 @@  const struct flashchip flashchips[] = {
 		.read		= read_memmapped,
 		.voltage	= {4500, 5500},
 	},
 
 	{
 		.vendor		= "Winbond",
 		.name		= "W25Q40.V",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= WINBOND_NEX_ID,
 		.model_id	= WINBOND_NEX_W25Q40_V,
 		.total_size	= 512,
 		.page_size	= 256,
 		/* supports SFDP */
-		/* OTP: 756B total; read 0x48; write 0x42, erase 0x44, read ID 0x4B */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		/* Read ID 0x4B */
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.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} },
@@ -14567,26 +14567,27 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {512 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &w25q40bl_64fv_sr,
 		.write		= spi_chip_write_256, /* Multi I/O supported */
 		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
 		.voltage	= {2700, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd_w256_3_otp,
 	},
 
 	{
 		.vendor		= "Winbond",
 		.name		= "W25Q80.V",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= WINBOND_NEX_ID,
 		.model_id	= WINBOND_NEX_W25Q80_V,
 		.total_size	= 1024,
 		.page_size	= 256,
 		/* supports SFDP */
 		/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44, read ID 0x4B */
 		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
@@ -14698,28 +14699,28 @@  const struct flashchip flashchips[] = {
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 	},
 
 	{
 		.vendor		= "Winbond",
 		.name		= "W25Q64.V",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= WINBOND_NEX_ID,
 		.model_id	= WINBOND_NEX_W25Q64_V,
 		.total_size	= 8192,
 		.page_size	= 256,
 		/* supports SFDP */
-		/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44, read ID 0x4B */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
+		/* Read ID 0x4B */
+		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 2048} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {32 * 1024, 256} },
 				.block_erase = spi_block_erase_52,
 			}, {
 				.eraseblocks = { {64 * 1024, 128} },
@@ -14727,26 +14728,27 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {8 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {8 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &w25q40bl_64fv_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {2700, 3600},
 		.wp		= &gd_w_wp,
+		.otp		= &gd_w256_3_otp,
 	},
 
 	{
 		.vendor		= "Winbond",
 		.name		= "W25Q128.V",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= WINBOND_NEX_ID,
 		.model_id	= WINBOND_NEX_W25Q128_V,
 		.total_size	= 16384,
 		.page_size	= 256,
 		/* supports SFDP */
 		/* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44, read ID 0x4B */
 		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP,
@@ -14974,29 +14976,29 @@  const struct flashchip flashchips[] = {
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {1700, 1950}, /* Fast read (0x0B) and multi I/O supported */
 	},
 
 	{
 		.vendor		= "Winbond",
 		.name		= "W25Q64.W",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= WINBOND_NEX_ID,
 		.model_id	= WINBOND_NEX_W25Q64_W,
 		.total_size	= 8192,
 		.page_size	= 256,
-		/* OTP: 256B total; read 0x48; write 0x42, erase 0x44, read ID 0x4B */
+		/* Read ID 0x4B */
 		/* QPI enable 0x38, disable 0xFF */
-		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI,
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_QPI,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
 		.probe_timing	= TIMING_ZERO,
 		.block_erasers	=
 		{
 			{
 				.eraseblocks = { {4 * 1024, 2048} },
 				.block_erase = spi_block_erase_20,
 			}, {
 				.eraseblocks = { {32 * 1024, 256} },
 				.block_erase = spi_block_erase_52,
 			}, {
 				.eraseblocks = { {64 * 1024, 128} },
@@ -15004,26 +15006,27 @@  const struct flashchip flashchips[] = {
 			}, {
 				.eraseblocks = { {8 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_60,
 			}, {
 				.eraseblocks = { {8 * 1024 * 1024, 1} },
 				.block_erase = spi_block_erase_c7,
 			}
 		},
 		.status_register = &w25q40bl_64fv_sr,
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read,
 		.voltage	= {1700, 1950}, /* Fast read (0x0B) and multi I/O supported */
 		.wp		= &gd_w_wp,
+		.otp		= &gd_w256_3_otp,
 	},
 
 	{
 		.vendor		= "Winbond",
 		.name		= "W25X10",
 		.bustype	= BUS_SPI,
 		.manufacture_id	= WINBOND_NEX_ID,
 		.model_id	= WINBOND_NEX_W25X10,
 		.total_size	= 128,
 		.page_size	= 256,
 		.feature_bits	= FEATURE_WRSR_WREN,
 		.tested		= TEST_OK_PREW,
 		.probe		= probe_spi_rdid,
diff --git a/otp.h b/otp.h
index 790c8c5..7ea9d3f 100644
--- a/otp.h
+++ b/otp.h
@@ -15,14 +15,25 @@ 
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
 #ifndef __OTP_H__
 #define __OTP_H__ 1
 
 #define MAX_OTP_REGIONS 4
 
 enum otp_region { OTP_REG_1 = 0, OTP_REG_2, OTP_REG_3 };
 
+extern struct otp en128_2048otp;
+extern struct otp en256_512otp;
+extern struct otp en256_1024otp;
+extern struct otp en512_2048otp;
+extern struct otp en512_4096otp;
+extern struct otp en512_8192otp;
+extern struct otp en512_16384otp;
+extern struct otp gd_w256_3_otp;
+extern struct otp gd256_4_otp;
+extern struct otp gd512_3_otp;
+
 #endif		/* !__OTP_H__ */
diff --git a/otp_layouts.c b/otp_layouts.c
new file mode 100644
index 0000000..e19516a
--- /dev/null
+++ b/otp_layouts.c
@@ -0,0 +1,229 @@ 
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright (C) 2016 Hatim Kanchwala <hatim@hatimak.me>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#include "chipdrivers.h"
+#include "flash.h"
+#include "otp.h"
+
+/* === Eon === */
+/* EN25Q16 */
+struct otp en128_2048otp = {
+	.region = {
+		{
+			.addr = 0x1FF000,
+			.size = 128,
+			.status_bit = SRP0,
+		},
+	},
+	.status = &eon_status_generic,
+	.print_status = &eon_print_status_generic,
+	.read = &eon_read_generic,
+	.write = &eon_write_generic,
+	.erase = &eon_erase_generic,
+	.lock = &eon_lock_generic,
+};
+
+/* EN25Q40 */
+struct otp en256_512otp = {
+	.region = {
+		{
+			.addr = 0x07F000,
+			.size = 256,
+			.status_bit = SRP0,
+		},
+	},
+	.status = &eon_status_generic,
+	.print_status = &eon_print_status_generic,
+	.read = &eon_read_generic,
+	.write = &eon_write_generic,
+	.erase = &eon_erase_generic,
+	.lock = &eon_lock_generic,
+};
+
+/* EN25Q80(A) */
+struct otp en256_1024otp = {
+	.region = {
+		{
+			.addr = 0x0FF000,
+			.size = 256,
+			.status_bit = SRP0,
+		},
+	},
+	.status = &eon_status_generic,
+	.print_status = &eon_print_status_generic,
+	.read = &eon_read_generic,
+	.write = &eon_write_generic,
+	.erase = &eon_erase_generic,
+	.lock = &eon_lock_generic,
+};
+
+/* EN25QH16 */
+struct otp en512_2048otp = {
+	.region = {
+		{
+			.addr = 0x1FF000,
+			.size = 512,
+			.status_bit = SRP0,
+		},
+	},
+	.status = &eon_status_generic,
+	.print_status = &eon_print_status_generic,
+	.read = &eon_read_generic,
+	.write = &eon_write_generic,
+	.erase = &eon_erase_generic,
+	.lock = &eon_lock_generic,
+};
+
+/* EN25Q32(A/B), EN25QH32 */
+struct otp en512_4096otp = {
+	.region = {
+		{
+			.addr = 0x3FF000,
+			.size = 512,
+			.status_bit = SRP0,
+		},
+	},
+	.status = &eon_status_generic,
+	.print_status = &eon_print_status_generic,
+	.read = &eon_read_generic,
+	.write = &eon_write_generic,
+	.erase = &eon_erase_generic,
+	.lock = &eon_lock_generic,
+};
+
+/* EN25Q64, EN25QH64 */
+struct otp en512_8192otp = {
+	.region = {
+		{
+			.addr = 0x7FF000,
+			.size = 512,
+			.status_bit = SRP0,
+		},
+	},
+	.status = &eon_status_generic,
+	.print_status = &eon_print_status_generic,
+	.read = &eon_read_generic,
+	.write = &eon_write_generic,
+	.erase = &eon_erase_generic,
+	.lock = &eon_lock_generic,
+};
+
+/* EN25Q128, EN25QH128 */
+struct otp en512_16384otp = {
+	.region = {
+		{
+			.addr = 0xFFF000,
+			.size = 512,
+			.status_bit = SRP0,
+		},
+	},
+	.status = &eon_status_generic,
+	.print_status = &eon_print_status_generic,
+	.read = &eon_read_generic,
+	.write = &eon_write_generic,
+	.erase = &eon_erase_generic,
+	.lock = &eon_lock_generic,
+};
+
+/* === GigaDevice and Winbond === */
+// FIXME(hatim): Deal with chips with shared OTP modifier bit
+/* GD25LQ16, GD25LQ80, GD25LQ40, W25Q40BL, W25Q64FV
+ * (There is an additional 256 bytes security register
+ * at 0x000000 which is reserved and can only be read.) */
+// FIXME(hatim): Add support to interact with the reserved security register
+struct otp gd_w256_3_otp = {
+	.region = {
+		{
+			.addr = 0x001000,
+			.size = 256,
+			.status_bit = LB1,
+		}, {
+			.addr = 0x002000,
+			.size = 256,
+			.status_bit = LB2,
+		}, {
+			.addr = 0x003000,
+			.size = 256,
+			.status_bit = LB3,
+		},
+	},
+	.status = &gd_w_status_generic,
+	.print_status = &gd_w_print_status_generic,
+	.read = &gd_w_read_generic,
+	.write = &gd_w_write_generic,
+	.erase = &gd_erase_generic,
+	.lock = &gd_w_lock_generic,
+};
+
+/* GD25VQ16C, GD25VQ40C, GD25VQ80C, GD25Q16B, GD25Q32B, GD25Q64B, GD25Q80(B), GD25Q128B */
+// FIXME(hatim): Datasheets show 4 registers for program, but single 1024 B register
+// for read and erase; which could be modelled as a single 1024 B register starting 0x000000
+struct otp gd256_4_otp = {
+	.region = {
+		{
+			.addr = 0x000000,
+			.size = 256,
+			.status_bit = LB1, /* LB1 is same as LB */
+		}, {
+			.addr = 0x000100,
+			.size = 256,
+			.status_bit = LB1, /* LB1 is same as LB */
+		}, {
+			.addr = 0x000200,
+			.size = 256,
+			.status_bit = LB1, /* LB1 is same as LB */
+		}, {
+			.addr = 0x000300,
+			.size = 256,
+			.status_bit = LB1, /* LB1 is same as LB */
+		},
+	},
+	.status = &gd_w_status_generic,
+	.print_status = &gd_w_print_status_generic,
+	.read = &gd_w_read_generic,
+	.write = &gd_w_write_generic,
+	.erase = &gd_erase_generic,
+	.lock = &gd_w_lock_generic,
+};
+
+/* GD25VQ21B, GD25VQ41B, GD25Q128C */
+struct otp gd512_3_otp = {
+	.region = {
+		{
+			.addr = 0x001000,
+			.size = 512,
+			.status_bit = LB1,
+		}, {
+			.addr = 0x002000,
+			.size = 512,
+			.status_bit = LB2,
+		}, {
+			.addr = 0x003000,
+			.size = 512,
+			.status_bit = LB3,
+		},
+	},
+	.status = &gd_w_status_generic,
+	.print_status = &gd_w_print_status_generic,
+	.read = &gd_w_read_generic,
+	.write = &gd_w_write_generic,
+	.erase = &gd_erase_generic,
+	.lock = &gd_w_lock_generic,
+};