[RFC,2/2] flashchips: Add Macronix MX25U51245G

Message ID 20180604130244.23912-3-daniel.thompson@linaro.org
State New
Headers show
Series
  • Experimental Developerbox/CP2102 bitbang programmer
Related show

Commit Message

Daniel Thompson June 4, 2018, 1:02 p.m.
Copy 'n paste support for Macronix MX25U51245G. I don't pretend to know
a whole lot about SPI FLASH so its mosty copied from other MX25U devices.

Currently probe works OK and I can read the first 4MB of FLASH (the
remain 60MB is unprogrammed) but its not practical to read the whole
chip but with the bit banger I'm using it would take >3 days.

What testing is needed? For example is setting up a layout to read/write
the first and last megabytes of the flash sufficient to replace
TEST_UNTESTED?

Change-Id: I2117fc205006088967f3d97644375d10db1791f1
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 flashchips.c | 40 ++++++++++++++++++++++++++++++++++++++++
 flashchips.h |  1 +
 2 files changed, 41 insertions(+)

Patch

diff --git a/flashchips.c b/flashchips.c
index 8eda608843e5..89b4faab843f 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -8484,6 +8484,46 @@  const struct flashchip flashchips[] = {
 		.voltage	= {1650, 2000},
 	},
 
+	{
+		.vendor		= "Macronix",
+		.name		= "MX25U51245G",
+		.bustype	= BUS_SPI,
+		.manufacture_id	= MACRONIX_ID,
+		.model_id	= MACRONIX_MX25U51245G,
+		.total_size	= 65536,
+		.page_size	= 256,
+		/* OTP: 512B total; enter 0xB1, exit 0xC1 */
+		.feature_bits	= FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_QPI,
+		.tested		= TEST_UNTESTED,
+		.probe		= probe_spi_rdid,
+		.probe_timing	= TIMING_ZERO,
+		.block_erasers	=
+		{
+			{
+				.eraseblocks = { {4 * 1024, 16384} },
+				.block_erase = spi_block_erase_20,
+			}, {
+				.eraseblocks = { {32 * 1024, 2048} },
+				.block_erase = spi_block_erase_52,
+			}, {
+				.eraseblocks = { {64 * 1024, 1024} },
+				.block_erase = spi_block_erase_d8,
+			}, {
+				.eraseblocks = { {64 * 1024 * 1024, 1} },
+				.block_erase = spi_block_erase_60,
+			}, {
+				.eraseblocks = { {64 * 1024 * 1024, 1} },
+				.block_erase = spi_block_erase_c7,
+			}
+		},
+		/* TODO: security register */
+		.printlock	= spi_prettyprint_status_register_bp3_srwd, /* bit6 is quad enable */
+		.unlock		= spi_disable_blockprotect_bp3_srwd,
+		.write		= spi_chip_write_256, /* Multi I/O supported */
+		.read		= spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
+		.voltage	= {1650, 2000},
+	},
+
 	{
 		.vendor		= "Macronix",
 		.name		= "MX25L6495F",
diff --git a/flashchips.h b/flashchips.h
index f00be3bc78fa..e0b2c0e72c3d 100644
--- a/flashchips.h
+++ b/flashchips.h
@@ -489,6 +489,7 @@ 
 #define MACRONIX_MX25U6435E	0x2537	/* Same as MX25U6435F */
 #define MACRONIX_MX25U12835E	0x2538	/* Same as MX25U12835F */
 #define MACRONIX_MX25U25635F	0x2539
+#define MACRONIX_MX25U51245G	0x253a
 #define MACRONIX_MX25L3235D	0x5E16	/* MX25L3225D/MX25L3235D/MX25L3237D */
 #define MACRONIX_MX25L6495F	0x9517