Patchwork Add new Macronix MX25L6495F support

login
register
about
Submitter Alex Lu
Date 2014-10-15 10:13:54
Message ID <OFB45473F8.B146D2B1-ON48257D72.0037E02B-48257D72.0038345D@mxic.com.tw>
Download mbox | patch
Permalink /patch/4246/
State Superseded
Headers show

Comments

Alex Lu - 2014-10-15 10:13:54
Dear sirs,

        This mail comes from Macronix to add the new MX25L6495F flash chip 
support
in the flashrom project in order to help the adoption of the chip for 
Google Chromium OS.
Please help to review it. Thanks a lot!

Alex Lu
FAE SW manager



CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information 
and/or personal data, which is protected by applicable laws. Please be 
reminded that duplication, disclosure, distribution, or use of this e-mail 
(and/or its attachments) or any part thereof is prohibited. If you receive 
this e-mail in error, please notify us immediately and delete this mail as 
well as its attachment(s) from your system. In addition, please be 
informed that collection, processing, and/or use of personal data is 
prohibited unless expressly permitted by personal data protection laws. 
Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================



============================================================================

CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================
David Hendricks - 2014-11-14 02:23:00
Hi Alex,
Thanks for the patch. I uploaded a modified version to chromium.org's code
review server here: https://chromium-review.googlesource.com/229697

On Wed, Oct 15, 2014 at 3:13 AM, <alexlu6@mxic.com.tw> wrote:

> Dear sirs,
>
>         This mail comes from Macronix to add the new MX25L6495F flash chip
> support
> in the flashrom project in order to help the adoption of the chip for
> Google Chromium OS.
> Please help to review it. Thanks a lot!
>
> Alex Lu
> FAE SW manager
>
>
>
> CONFIDENTIALITY NOTE:
>
> This e-mail and any attachments may contain confidential information
> and/or personal data, which is protected by applicable laws. Please be
> reminded that duplication, disclosure, distribution, or use of this e-mail
> (and/or its attachments) or any part thereof is prohibited. If you receive
> this e-mail in error, please notify us immediately and delete this mail as
> well as its attachment(s) from your system. In addition, please be informed
> that collection, processing, and/or use of personal data is prohibited
> unless expressly permitted by personal data protection laws. Thank you for
> your attention and cooperation.
>
> Macronix International Co., Ltd.
>
> =====================================================================
>
> _______________________________________________
> flashrom mailing list
> flashrom@flashrom.org
> http://www.flashrom.org/mailman/listinfo/flashrom
>
Stefan Tauner - 2014-12-26 16:25:38
On Wed, 15 Oct 2014 18:13:54 +0800
alexlu6@mxic.com.tw wrote:

> 
> Dear sirs,
> 
>         This mail comes from Macronix to add the new MX25L6495F flash chip 
> support
> in the flashrom project in order to help the adoption of the chip for 
> Google Chromium OS.
> Please help to review it. Thanks a lot!

Hello Alex,

I'd like to add support for this chip to vanilla flashrom as well but
could not find a public datasheet to add a few additional bits. Will
this chip and a respective datasheet be available publicly?
Stefan Tauner - 2014-12-29 14:33:40
On Fri, 26 Dec 2014 17:25:38 +0100
Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> wrote:

> On Wed, 15 Oct 2014 18:13:54 +0800
> alexlu6@mxic.com.tw wrote:
> 
> > 
> > Dear sirs,
> > 
> >         This mail comes from Macronix to add the new MX25L6495F flash chip 
> > support
> > in the flashrom project in order to help the adoption of the chip for 
> > Google Chromium OS.
> > Please help to review it. Thanks a lot!
> 
> Hello Alex,
> 
> I'd like to add support for this chip to vanilla flashrom as well but
> could not find a public datasheet to add a few additional bits. Will
> this chip and a respective datasheet be available publicly?
> 

Just for the record if anybody needs some details: Alex has sent me the
(confidential) datasheet privately for reference.
Stefan Tauner - 2015-01-10 10:15:26
I have committed my refined version of the patch in r1867. Thanks
again, Alex!
Stefan Tauner - 2015-01-10 16:02:49
On Sat, 10 Jan 2015 11:15:26 +0100
Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> wrote:

> I have committed my refined version of the patch in r1867. Thanks
> again, Alex!
> 

Now that we have a build bot again for almost any OS I apparently
focused too much on compile tests and not enough on runtime tests...
r1867 compiled fine but did not run on any system because the
MX25L6495F definition was missing the .vendor field string. Sorry!

Fixed in r1868.

Patch

diff -u flashrom_orig/flashchips.c ../flashrom/flashchips.c
--- flashrom_orig/flashchips.c	2014-10-02 09:15:30.474142654 +0800
+++ ../flashrom/flashchips.c	2014-09-30 17:08:05.369024716 +0800
@@ -5109,7 +5069,45 @@ 
 		.write		= spi_chip_write_256,
 		.read		= spi_chip_read, /* Fast read (0x0B) supported */
 		.voltage	= {2700, 3600}, /* 2.35-3.6V for MX25V8005 */
		.wp		= &wp_generic,
+	},
+
+	{
+		.vendor		= "Macronix",
+		.name		= "MX25L6495F",
+		.bustype	= BUS_SPI,
+		.manufacture_id	= MACRONIX_ID,
+		.model_id	= MACRONIX_MX25L6495F,
+		.total_size	= 8192,
+		.page_size	= 256,
+		.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 = { {32 * 1024, 256} },
+				.block_erase = spi_block_erase_52,
+			}, {
+				.eraseblocks = { {8 * 1024 * 1024, 1} },
+				.block_erase = spi_block_erase_60,
+			}, {
+				.eraseblocks = { {8 * 1024 * 1024, 1} },
+				.block_erase = spi_block_erase_c7,
+			}
+		},
+		.unlock		= spi_disable_blockprotect,
+		.write		= spi_chip_write_256,
+		.read		= spi_chip_read, /* Fast read (0x0B) supported */
+		.voltage	= {2700, 3600}, /* 2.35-3.6V for MX25V8005 */
+		.wp		= &wp_w25,
 	},
 
 	{
diff -u flashrom_orig/flashchips.h ../flashrom/flashchips.h
--- flashrom_orig/flashchips.h	2014-10-02 09:15:30.474142654 +0800
+++ ../flashrom/flashchips.h	2014-09-24 14:54:39.564723985 +0800
@@ -389,11 +388,12 @@ 
 #define MACRONIX_MX25L1605	0x2015	/* MX25L1605{,A,D} */
 #define MACRONIX_MX25L3205	0x2016	/* MX25L3205{,A} */
 #define MACRONIX_MX25L6405	0x2017	/* MX25L6405{,D}, MX25L6406E, MX25L6445E */
+#define MACRONIX_MX25L6495F	0x9517	/* MX25L6495F */
 #define MACRONIX_MX25L12805	0x2018	/* MX25L12805 */
 #define MACRONIX_MX25L1635D	0x2415
 #define MACRONIX_MX25L1635E	0x2515	/* MX25L1635{E} */
 #define MACRONIX_MX25U1635E	0x2535
-#define MACRONIX_MX25U3235E	0x2536	/* Same as MX25U6435F */
+#define MACRONIX_MX25U3235E	0x2536	/* Same as MX25U3235F */
 #define MACRONIX_MX25U6435E	0x2537	/* Same as MX25U6435F */
 #define MACRONIX_MX25L3235D	0x5E16	/* MX25L3225D/MX25L3235D/MX25L3237D */
 #define MACRONIX_MX29F001B	0x19
diff -u flashrom_orig/writeprotect.c ../flashrom/writeprotect.c
--- flashrom_orig/writeprotect.c	2014-10-02 09:15:30.494132402 +0800
+++ ../flashrom/writeprotect.c	2014-09-24 15:06:00.465921641 +0800
@@ -312,27 +281,27 @@ 
 
 /* FIXME: Is there an mx25l3205 (without a trailing letter)? */
 static struct w25q_range mx25l3205d_ranges[] = {
-	{ X, 0, 0, {0, 0} },	/* none */
-	{ X, 0, 0x1, {0x3f0000, 64 * 1024} },
-	{ X, 0, 0x2, {0x3e0000, 128 * 1024} },
-	{ X, 0, 0x3, {0x3c0000, 256 * 1024} },
-	{ X, 0, 0x4, {0x380000, 512 * 1024} },
-	{ X, 0, 0x5, {0x300000, 1024 * 1024} },
-	{ X, 0, 0x6, {0x200000, 2048 * 1024} },
-	{ X, 0, 0x7, {0x000000, 4096 * 1024} },
+	{ 0, 0, 0, {0, 0} },	/* none */
+	{ 0, 0, 0x1, {0x3f0000, 64 * 1024} },
+	{ 0, 0, 0x2, {0x3e0000, 128 * 1024} },
+	{ 0, 0, 0x3, {0x3c0000, 256 * 1024} },
+	{ 0, 0, 0x4, {0x380000, 512 * 1024} },
+	{ 0, 0, 0x5, {0x300000, 1024 * 1024} },
+	{ 0, 0, 0x6, {0x200000, 2048 * 1024} },
+	{ 0, 0, 0x7, {0x000000, 4096 * 1024} },
 
-	{ X, 1, 0x0, {0x000000, 4096 * 1024} },
-	{ X, 1, 0x1, {0x000000, 2048 * 1024} },
-	{ X, 1, 0x2, {0x000000, 3072 * 1024} },
-	{ X, 1, 0x3, {0x000000, 3584 * 1024} },
-	{ X, 1, 0x4, {0x000000, 3840 * 1024} },
-	{ X, 1, 0x5, {0x000000, 3968 * 1024} },
-	{ X, 1, 0x6, {0x000000, 4032 * 1024} },
-	{ X, 1, 0x7, {0x000000, 4096 * 1024} },
+	{ 0, 1, 0x0, {0x000000, 4096 * 1024} },
+	{ 0, 1, 0x1, {0x000000, 2048 * 1024} },
+	{ 0, 1, 0x2, {0x000000, 3072 * 1024} },
+	{ 0, 1, 0x3, {0x000000, 3584 * 1024} },
+	{ 0, 1, 0x4, {0x000000, 3840 * 1024} },
+	{ 0, 1, 0x5, {0x000000, 3968 * 1024} },
+	{ 0, 1, 0x6, {0x000000, 4032 * 1024} },
+	{ 0, 1, 0x7, {0x000000, 4096 * 1024} },
 };
 
 static struct w25q_range mx25u3235e_ranges[] = {
-	{ X, 0, 0, {0, 0} },	/* none */
+	{ 0, 0, 0, {0, 0} },	/* none */
 	{ 0, 0, 0x1, {0x3f0000, 64 * 1024} },
 	{ 0, 0, 0x2, {0x3e0000, 128 * 1024} },
 	{ 0, 0, 0x3, {0x3c0000, 256 * 1024} },
@@ -351,8 +320,72 @@ 
 	{ 0, 1, 0x7, {0x000000, 4096 * 1024} },
 };
 
-static struct w25q_range mx25u6435e_ranges[] = {
+#if 0
+/* FIXME: MX25L6405D has same ID as MX25L6406 */
+static struct w25q_range mx25l6405d_ranges[] = {
 	{ X, 0, 0, {0, 0} },	/* none */
+	{ X, 0, 0x1, {0x7e0000, 2 * 64 * 1024} },	/* blocks 126-127 */
+	{ X, 0, 0x2, {0x7c0000, 4 * 64 * 1024} },	/* blocks 124-127 */
+	{ X, 0, 0x3, {0x780000, 8 * 64 * 1024} },	/* blocks 120-127 */
+	{ X, 0, 0x4, {0x700000, 16 * 64 * 1024} },	/* blocks 112-127 */
+	{ X, 0, 0x5, {0x600000, 32 * 64 * 1024} },	/* blocks 96-127 */
+	{ X, 0, 0x6, {0x400000, 64 * 64 * 1024} },	/* blocks 64-127 */
+	{ X, 0, 0x7, {0x000000, 64 * 128 * 1024} },	/* blocks 0-127 */
+
+	{ X, 1, 0x0, {0x000000, 8192 * 1024} },
+	{ X, 1, 0x1, {0x000000, 64 * 64 * 1024} },	/* blocks 0-63 */
+	{ X, 1, 0x2, {0x000000, 64 * 96 * 1024} },	/* blocks 0-95 */
+	{ X, 1, 0x3, {0x000000, 64 * 112 * 1024} },	/* blocks 0-111 */
+	{ X, 1, 0x4, {0x000000, 64 * 120 * 1024} },	/* blocks 0-119 */
+	{ X, 1, 0x5, {0x000000, 64 * 124 * 1024} },	/* blocks 0-123 */
+	{ X, 1, 0x6, {0x000000, 64 * 126 * 1024} },	/* blocks 0-125 */
+	{ X, 1, 0x7, {0x000000, 64 * 128 * 1024} },	/* blocks 0-127 */
+};
+#endif
+
+/* FIXME: MX25L6406 has same ID as MX25L6405D */
+static struct w25q_range mx25l6406e_ranges[] = {
+	{ 0, 0, 0, {0, 0} },	/* none */
+	{ 0, 0, 0x1, {0x7e0000, 64 * 2 * 1024} },	/* blocks 126-127 */
+	{ 0, 0, 0x2, {0x7c0000, 64 * 4 * 1024} },	/* blocks 124-127 */
+	{ 0, 0, 0x3, {0x7a0000, 64 * 8 * 1024} },	/* blocks 120-127 */
+	{ 0, 0, 0x4, {0x700000, 64 * 16 * 1024} },	/* blocks 112-127 */
+	{ 0, 0, 0x5, {0x600000, 64 * 32 * 1024} },	/* blocks 96-127 */
+	{ 0, 0, 0x6, {0x400000, 64 * 64 * 1024} },	/* blocks 64-127 */
+	{ 0, 0, 0x7, {0x000000, 64 * 128 * 1024} },	/* all */
+
+	{ 0, 1, 0x0, {0x000000, 64 * 128 * 1024} },	/* all */
+	{ 0, 1, 0x1, {0x000000, 64 * 64 * 1024} },	/* blocks 0-63 */
+	{ 0, 1, 0x2, {0x000000, 64 * 96 * 1024} },	/* blocks 0-95 */
+	{ 0, 1, 0x3, {0x000000, 64 * 112 * 1024} },	/* blocks 0-111 */
+	{ 0, 1, 0x4, {0x000000, 64 * 120 * 1024} },	/* blocks 0-119 */
+	{ 0, 1, 0x5, {0x000000, 64 * 124 * 1024} },	/* blocks 0-123 */
+	{ 0, 1, 0x6, {0x000000, 64 * 126 * 1024} },	/* blocks 0-125 */
+	{ 0, 1, 0x7, {0x000000, 64 * 128 * 1024} },	/* all */
+};
+
+static struct w25q_range mx25l6495f_ranges[] = {
+	{ 0, 0, 0, {0, 0} },	/* none */
+	{ 0, 0, 0x1, {0x7f0000, 1 * 64 * 1024} },	/* blocks 127 */
+	{ 0, 0, 0x2, {0x7e0000, 2 * 64 * 1024} },	/* blocks 126-127 */
+	{ 0, 0, 0x3, {0x7c0000, 4 * 64 * 1024} },	/* blocks 124-127 */
+	{ 0, 0, 0x4, {0x780000, 8 * 64 * 1024} },	/* blocks 120-127 */
+	{ 0, 0, 0x5, {0x700000, 16 * 64 * 1024} },	/* blocks 112-127 */
+	{ 0, 0, 0x6, {0x600000, 32 * 64 * 1024} },	/* blocks 96-127 */
+	{ 0, 0, 0x7, {0x400000, 64 * 64 * 1024} },	/* blocks 64-127 */
+
+	{ 0, 1, 0x0, {0x000000, 64 * 128 * 1024} },	/* all */
+	{ 0, 1, 0x1, {0x000000, 64 * 128 * 1024} },	/* all */
+	{ 0, 1, 0x2, {0x000000, 64 * 128 * 1024} },	/* all */
+	{ 0, 1, 0x3, {0x000000, 64 * 128 * 1024} },	/* all */
+	{ 0, 1, 0x4, {0x000000, 64 * 128 * 1024} },	/* all */
+	{ 0, 1, 0x5, {0x000000, 64 * 128 * 1024} },	/* all */
+	{ 0, 1, 0x6, {0x000000, 64 * 128 * 1024} },	/* all */
+	{ 0, 1, 0x7, {0x000000, 64 * 128 * 1024} },	/* all */
+};
+
+static struct w25q_range mx25u6435e_ranges[] = {
+	{ 0, 0, 0, {0, 0} },	/* none */
 	{ 0, 0, 0x1, {0x7f0000,   1 * 64 * 1024} },	/* block 127 */
 	{ 0, 0, 0x2, {0x7e0000,   2 * 64 * 1024} },	/* blocks 126-127 */
 	{ 0, 0, 0x3, {0x7c0000,   4 * 64 * 1024} },	/* blocks 124-127 */
@@ -728,6 +761,16 @@ 
 			*w25q_ranges = mx25u6435e_ranges;
 			*num_entries = ARRAY_SIZE(mx25u6435e_ranges);
 			break;
+		case MACRONIX_MX25L6495F:
+			*w25q_ranges = mx25l6495f_ranges;
+			*num_entries = ARRAY_SIZE(mx25l6495f_ranges);
+			break;
+		case MACRONIX_MX25L6405:
+			/* FIXME: MX25L64* chips have mixed capabilities and
+			   share IDs */
+			*w25q_ranges = mx25l6406e_ranges;
+			*num_entries = ARRAY_SIZE(mx25l6406e_ranges);
+			break;
 		default:
 			msg_cerr("%s():%d: MXIC flash chip mismatch (0x%04x)"
 			         ", aborting\n", __func__, __LINE__,