Skip to contentSkip to conversation

sf: Macronix additional chips supported

PATCH New Prafulla Wadaskar 2 participants 8 messages Jul 1, 2009 – Jul 6, 2009 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sf: Macronix additional chips supported

new chips supported:-
MX25L1605D, MX25L3205D, MX25L6405D, MX25L12855E
out of which MX25L6405D and MX25L12855E tested on Kirkwood platforms

Modified the Macronix flash support to use 2 bytes of device id instead of 1 This was required to support MX25L12855E

Contributor: Piyush Shah <[email protected]>

---
 drivers/mtd/spi/macronix.c |   63 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 52 insertions(+), 11 deletions(-)
drivers/mtd/spi/macronix.c +52 -11
index 9464c84..e6f87fb 100644
@@ -49,17 +49,21 @@
 #define CMD_MX25XX_DP		0xb9	/* Deep Power-down */
 #define CMD_MX25XX_RES		0xab	/* Release from DP, and Read Signature */
 
-#define MXIC_ID_MX2516		0x15
-#define MXIC_ID_MX2520		0x12
-#define MXIC_ID_MX2532		0x16
-#define MXIC_ID_MX2540		0x13
-#define MXIC_ID_MX2564		0x17
-#define MXIC_ID_MX2580		0x14
-#define MXIC_ID_MX25128		0x18
-
+#define MXIC_ID_MD_MX251605D	0x15	/* MD : Memory Density */
+#define MXIC_ID_MT_MX251605D	0x20	/* MT : Memory Type */
+#define MXIC_ID_MD_MX253205D	0x16	/* MD : Memory Density */
+#define MXIC_ID_MT_MX253205D	0x20	/* MT : Memory Type */
+#define MXIC_ID_MD_MX256405D	0x17	/* MD : Memory Density */
+#define MXIC_ID_MT_MX256405D	0x20	/* MT : Memory Type */
+#define MXIC_ID_MD_MX2512805D	0x18	/* MD : Memory Density */
+#define MXIC_ID_MT_MX2512805D	0x20	/* MT : Memory Type */
+#define MXIC_ID_MD_MX2512855E	0x18	/* MD : Memory Density */
+#define MXIC_ID_MT_MX2512855E	0x26	/* MT : Memory Type */
+ 
 #define MACRONIX_SR_WIP		(1 << 0)	/* Write-in-Progress */
 
 struct macronix_spi_flash_params {
+ 	u8 idcode0;
 	u8 idcode1;
 	u16 page_size;
 	u16 pages_per_sector;
@@ -81,13 +85,50 @@ static inline struct macronix_spi_flash *to_macronix_spi_flash(struct spi_flash
 
 static const struct macronix_spi_flash_params macronix_spi_flash_table[] = {
 	{
-		.idcode1 = MXIC_ID_MX25128,
+		.idcode0 = MXIC_ID_MT_MX251605D,
+		.idcode1 = MXIC_ID_MD_MX251605D,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 32,
+		.name = "MX25L1605D",
+	},
+	{
+		.idcode0 = MXIC_ID_MT_MX253205D,
+		.idcode1 = MXIC_ID_MD_MX253205D,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 64,
+		.name = "MX25L3205D",
+	},
+	{
+		.idcode0 = MXIC_ID_MT_MX256405D,
+		.idcode1 = MXIC_ID_MD_MX256405D,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 128,
+		.name = "MX25L6405D",
+	},
+	{
+		.idcode0 = MXIC_ID_MT_MX2512805,
+		.idcode1 = MXIC_ID_MD_MX2512805,
 		.page_size = 256,
 		.pages_per_sector = 16,
 		.sectors_per_block = 16,
 		.nr_blocks = 256,
 		.name = "MX25L12805D",
 	},
+	{
+		.idcode0 = MXIC_ID_MT_MX2512855E,
+		.idcode1 = MXIC_ID_MD_MX2512855E,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 256,
+		.name = "MX25L12855E",
+	},
 };
 
 static int macronix_wait_ready(struct spi_flash *flash, unsigned long timeout)
@@ -280,12 +321,12 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
 
 	for (i = 0; i < ARRAY_SIZE(macronix_spi_flash_table); i++) {
 		params = &macronix_spi_flash_table[i];
-		if (params->idcode1 == idcode[2])
+                if (params->idcode1 == idcode[2] && params->idcode0 == idcode[1])
 			break;
 	}
 
 	if (i == ARRAY_SIZE(macronix_spi_flash_table)) {
-		debug("SF: Unsupported Macronix ID %02x\n", idcode[1]);
+                debug("SF: Unsupported Macronix ID %02x%02x\n", idcode[1],idcode[2]);
 		return NULL;
 	}
 
Signature · 1 line
1.5.3.3
#1 lore raw

PATCH 1/1 sf: Macronix additional chips supported

Quoted 10 lines

-----Original Message-----
From: Prafulla Wadaskar [mailto:prafulla at marvell.com]
Sent: Wednesday, July 01, 2009 9:46 PM
To: u-boot at lists.denx.de
Cc: Nicolas Pitre; Manas Saksena; Lennert Buijtenhek; Prabhanjan Sarnaik; Ronen Shitrit; Ashish Karkare; Prafulla Wadaskar
Subject: [PATCH] sf: Macronix additional chips supported

Quoted 3 lines

new chips supported:-
MX25L1605D, MX25L3205D, MX25L6405D, MX25L12855E out of which MX25L6405D and MX25L12855E tested on Kirkwood platforms

Hi Mike,
Just FYI

Regards..
Prafulla . .

#2 lore raw

PATCH v2 1/1 sf: Macronix additional chips supported

new chips supported:-
MX25L1605D, MX25L3205D, MX25L6405D, MX25L12855E
out of which MX25L6405D and MX25L12855E tested on Kirkwood platforms

Modified the Macronix flash support to use 2 bytes of device id instead of 1 This was required to support MX25L12855E

Contributor: Piyush Shah <[email protected]>

---
Change log:-
v2: white space removed for clean patch apply
build error fixed
tested for new added chip MX25L6405D

 drivers/mtd/spi/macronix.c |   61 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 51 insertions(+), 10 deletions(-)
drivers/mtd/spi/macronix.c +51 -10
index 9464c84..d165277 100644
@@ -49,17 +49,21 @@
 #define CMD_MX25XX_DP		0xb9	/* Deep Power-down */
 #define CMD_MX25XX_RES		0xab	/* Release from DP, and Read Signature */
 
-#define MXIC_ID_MX2516		0x15
-#define MXIC_ID_MX2520		0x12
-#define MXIC_ID_MX2532		0x16
-#define MXIC_ID_MX2540		0x13
-#define MXIC_ID_MX2564		0x17
-#define MXIC_ID_MX2580		0x14
-#define MXIC_ID_MX25128		0x18
+#define MXIC_ID_MD_MX251605D	0x15	/* MD : Memory Density */
+#define MXIC_ID_MT_MX251605D	0x20	/* MT : Memory Type */
+#define MXIC_ID_MD_MX253205D	0x16	/* MD : Memory Density */
+#define MXIC_ID_MT_MX253205D	0x20	/* MT : Memory Type */
+#define MXIC_ID_MD_MX256405D	0x17	/* MD : Memory Density */
+#define MXIC_ID_MT_MX256405D	0x20	/* MT : Memory Type */
+#define MXIC_ID_MD_MX2512805D	0x18	/* MD : Memory Density */
+#define MXIC_ID_MT_MX2512805D	0x20	/* MT : Memory Type */
+#define MXIC_ID_MD_MX2512855E	0x18	/* MD : Memory Density */
+#define MXIC_ID_MT_MX2512855E	0x26	/* MT : Memory Type */
 
 #define MACRONIX_SR_WIP		(1 << 0)	/* Write-in-Progress */
 
 struct macronix_spi_flash_params {
+	u8 idcode0;
 	u8 idcode1;
 	u16 page_size;
 	u16 pages_per_sector;
@@ -81,13 +85,50 @@ static inline struct macronix_spi_flash *to_macronix_spi_flash(struct spi_flash
 
 static const struct macronix_spi_flash_params macronix_spi_flash_table[] = {
 	{
-		.idcode1 = MXIC_ID_MX25128,
+		.idcode0 = MXIC_ID_MT_MX251605D,
+		.idcode1 = MXIC_ID_MD_MX251605D,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 32,
+		.name = "MX25L1605D",
+	},
+	{
+		.idcode0 = MXIC_ID_MT_MX253205D,
+		.idcode1 = MXIC_ID_MD_MX253205D,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 64,
+		.name = "MX25L3205D",
+	},
+	{
+		.idcode0 = MXIC_ID_MT_MX256405D,
+		.idcode1 = MXIC_ID_MD_MX256405D,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 128,
+		.name = "MX25L6405D",
+	},
+	{
+		.idcode0 = MXIC_ID_MT_MX2512805D,
+		.idcode1 = MXIC_ID_MD_MX2512805D,
 		.page_size = 256,
 		.pages_per_sector = 16,
 		.sectors_per_block = 16,
 		.nr_blocks = 256,
 		.name = "MX25L12805D",
 	},
+	{
+		.idcode0 = MXIC_ID_MT_MX2512855E,
+		.idcode1 = MXIC_ID_MD_MX2512855E,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 256,
+		.name = "MX25L12855E",
+	},
 };
 
 static int macronix_wait_ready(struct spi_flash *flash, unsigned long timeout)
@@ -280,12 +321,12 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
 
 	for (i = 0; i < ARRAY_SIZE(macronix_spi_flash_table); i++) {
 		params = &macronix_spi_flash_table[i];
-		if (params->idcode1 == idcode[2])
+                if (params->idcode1 == idcode[2] && params->idcode0 == idcode[1])
 			break;
 	}
 
 	if (i == ARRAY_SIZE(macronix_spi_flash_table)) {
-		debug("SF: Unsupported Macronix ID %02x\n", idcode[1]);
+                debug("SF: Unsupported Macronix ID %02x%02x\n", idcode[1],idcode[2]);
 		return NULL;
 	}
 
Signature · 1 line
1.5.3.3
#3 lore raw

PATCH v2 1/1 sf: Macronix additional chips supported

Quoted 8 lines · On Friday 03 July 2009 13:28:01 Prafulla Wadaskar wrote:

new chips supported:-
MX25L1605D, MX25L3205D, MX25L6405D, MX25L12855E
out of which MX25L6405D and MX25L12855E tested on Kirkwood platforms

Modified the Macronix flash support to use 2 bytes of device id instead of 1 This was required to support MX25L12855E

Contributor: Piyush Shah <[email protected]>

a contributor really should be a signed-off-by

Quoted 72 lines
drivers/mtd/spi/macronix.c +40 -8
@@ -49,17 +49,21 @@
 #define CMD_MX25XX_DP		0xb9	/* Deep Power-down */
 #define CMD_MX25XX_RES		0xab	/* Release from DP, and Read Signature */
 
-#define MXIC_ID_MX2516		0x15
-#define MXIC_ID_MX2520		0x12
-#define MXIC_ID_MX2532		0x16
-#define MXIC_ID_MX2540		0x13
-#define MXIC_ID_MX2564		0x17
-#define MXIC_ID_MX2580		0x14
-#define MXIC_ID_MX25128		0x18
+#define MXIC_ID_MD_MX251605D	0x15	/* MD : Memory Density */
+#define MXIC_ID_MT_MX251605D	0x20	/* MT : Memory Type */
+#define MXIC_ID_MD_MX253205D	0x16	/* MD : Memory Density */
+#define MXIC_ID_MT_MX253205D	0x20	/* MT : Memory Type */
+#define MXIC_ID_MD_MX256405D	0x17	/* MD : Memory Density */
+#define MXIC_ID_MT_MX256405D	0x20	/* MT : Memory Type */
+#define MXIC_ID_MD_MX2512805D	0x18	/* MD : Memory Density */
+#define MXIC_ID_MT_MX2512805D	0x20	/* MT : Memory Type */
+#define MXIC_ID_MD_MX2512855E	0x18	/* MD : Memory Density */
+#define MXIC_ID_MT_MX2512855E	0x26	/* MT : Memory Type */
 
 #define MACRONIX_SR_WIP		(1 << 0)	/* Write-in-Progress */
 
 struct macronix_spi_flash_params {
+	u8 idcode0;
 	u8 idcode1;
 	u16 page_size;
 	u16 pages_per_sector;
@@ -81,13 +85,50 @@ static inline struct macronix_spi_flash
 *to_macronix_spi_flash(struct spi_flash
 
 static const struct macronix_spi_flash_params macronix_spi_flash_table[] =
 { {
-		.idcode1 = MXIC_ID_MX25128,
+		.idcode0 = MXIC_ID_MT_MX251605D,
+		.idcode1 = MXIC_ID_MD_MX251605D,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 32,
+		.name = "MX25L1605D",
+	},
+	{
+		.idcode0 = MXIC_ID_MT_MX253205D,
+		.idcode1 = MXIC_ID_MD_MX253205D,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 64,
+		.name = "MX25L3205D",
+	},
+	{
+		.idcode0 = MXIC_ID_MT_MX256405D,
+		.idcode1 = MXIC_ID_MD_MX256405D,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 128,
+		.name = "MX25L6405D",
+	},
+	{
+		.idcode0 = MXIC_ID_MT_MX2512805D,
+		.idcode1 = MXIC_ID_MD_MX2512805D,
 		.page_size = 256,
 		.pages_per_sector = 16,
 		.sectors_per_block = 16,
 		.nr_blocks = 256,
 		.name = "MX25L12805D",
 	},

drivers/mtd/spi/macronix.c static inline struct macronix_spi_flash · line 133

Quoted 10 lines
drivers/mtd/spi/macronix.c +9 -0
+	{
+		.idcode0 = MXIC_ID_MT_MX2512855E,
+		.idcode1 = MXIC_ID_MD_MX2512855E,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 256,
+		.name = "MX25L12855E",
+	},
 };

can you compare the code size to see if combining the id's in a u16 is better than comparing multiple u8's ?

and creating a dedicated list of defines for the id's isnt really necessary. using them inline in the structure itself is fine.

Quoted 13 lines
drivers/mtd/spi/macronix.c +0 -0
 	for (i = 0; i < ARRAY_SIZE(macronix_spi_flash_table); i++) {
drivers/mtd/spi/macronix.c +1 -1
 		params = &macronix_spi_flash_table[i];
-		if (params->idcode1 == idcode[2])
+                if (params->idcode1 == idcode[2] && params->idcode0 ==

idcode[1]) break;

drivers/mtd/spi/macronix.c +1 -1
 	}
 
 	if (i == ARRAY_SIZE(macronix_spi_flash_table)) {
-		debug("SF: Unsupported Macronix ID %02x\n", idcode[1]);
+                debug("SF: Unsupported Macronix ID %02x%02x\n",

idcode[1],idcode[2]); return NULL;
}

Quoted 3 lines

Change log:-
v2: white space removed for clean patch apply
build error fixed

looks like you broke whitespace in this version. you changed these if statements to use leading spaces, not tabs.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090703/15d73aa5/attachment.pgp

#4 lore raw

PATCH v2 1/1 sf: Macronix additional chips supported

Quoted 16 lines

-----Original Message-----
From: Mike Frysinger [mailto:vapier at gentoo.org]
Sent: Friday, July 03, 2009 11:31 PM
To: u-boot at lists.denx.de
Cc: Prafulla Wadaskar; Manas Saksena; Ronen Shitrit; Nicolas Pitre; Ashish Karkare; Prabhanjan Sarnaik; Lennert Buijtenhek
Subject: Re: [U-Boot] [PATCH v2] sf: Macronix additional chips supported

Quoted 4 lines · On Friday 03 July 2009 13:28:01 Prafulla Wadaskar wrote:

new chips supported:-
MX25L1605D, MX25L3205D, MX25L6405D, MX25L12855E out of which MX25L6405D and MX25L12855E tested on Kirkwood platforms

Quoted 7 lines
Quoted 5 lines

Modified the Macronix flash support to use 2 bytes of device id instead of
1 This was required to support MX25L12855E

Contributor: Piyush Shah <[email protected]>

a contributor really should be a signed-off-by

I will correct this

<snip>

Quoted 5 lines
Quoted 5 lines
drivers/mtd/spi/macronix.c +5 -0
+	{
+		.idcode0 = MXIC_ID_MT_MX2512855E,
+		.idcode1 = MXIC_ID_MD_MX2512855E,
+		.page_size = 256,
+		.pages_per_sector = 16,
Quoted 8 lines

drivers/mtd/spi/macronix.c static inline struct macronix_spi_flash *to_macronix_spi_flash(struct spi_flash · line 132

Quoted 5 lines
drivers/mtd/spi/macronix.c +4 -0
+		.sectors_per_block = 16,
+		.nr_blocks = 256,
+		.name = "MX25L12855E",
+	},
 };

can you compare the code size to see if combining the id's in a u16 is better than comparing multiple u8's ?

At this moment we can save 28bytes with above suggestions,
but Mx25L12805D and MX25L12855E have different memory types (0x20, 0x26 resp), and they have different protection algorithm features which I was trying to expose through "protect" command interface in my next patch, then we will need this abstraction. So I wish to keep this.
What do you think?

Quoted 4 lines

and creating a dedicated list of defines for the id's isnt really necessary.
using them inline in the structure itself is fine.

This is taken care...

Quoted 5 lines
Quoted 2 lines

Change log:-
v2: white space removed for clean patch apply build error fixed

looks like you broke whitespace in this version. you changed these if statements to use leading spaces, not tabs.

:-)

Regards..
Prafulla . .

#5 lore raw

PATCH v2 1/1 sf: Macronix additional chips supported

Quoted 16 lines · On Monday 06 July 2009 02:26:20 Prafulla Wadaskar wrote:

From: Mike Frysinger [mailto:vapier at gentoo.org]

Quoted 6 lines · On Friday 03 July 2009 13:28:01 Prafulla Wadaskar wrote:
Quoted 5 lines
drivers/mtd/spi/macronix.c +5 -0
+	{
+		.idcode0 = MXIC_ID_MT_MX2512855E,
+		.idcode1 = MXIC_ID_MD_MX2512855E,
+		.page_size = 256,
+		.pages_per_sector = 16,
Quoted 8 lines

drivers/mtd/spi/macronix.c static inline struct macronix_spi_flash *to_macronix_spi_flash(struct spi_flash · line 132

Quoted 5 lines
drivers/mtd/spi/macronix.c +4 -0
+		.sectors_per_block = 16,
+		.nr_blocks = 256,
+		.name = "MX25L12855E",
+	},
 };

can you compare the code size to see if combining the id's in a u16 is better than comparing multiple u8's ?

Quoted 6 lines

At this moment we can save 28bytes with above suggestions,
but Mx25L12805D and MX25L12855E have different memory types (0x20, 0x26 resp), and they have different protection algorithm features which I was trying to expose through "protect" command interface in my next patch, then we will need this abstraction. So I wish to keep this.
What do you think?

i was referring to also the .text differences, not just the .data. so with a u16, the structure would look like:
{...

	.id = 0x1826,
	.name = "MX25L12855E",
...},{...
	.id = 0x1820,
	.name = "MX25L12805D",

...},

and the probe would look something like:

	u16 id = idcode[0] | (idcode[1] << 8);
	...
	if (params->id == id)
		...

i dont think this would prevent you from doing protection detection on the 0x18 family as you could create a new define:
#define MX_PROT_FAMILY_FOO 0x18

and then in the probe code do:

	if (idcode[1] == MX_PROT_FAMILY_FOO)

i dont think the u8 -> u16 conversion would cause problems here would it ? -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090706/ebd3d66a/attachment.pgp

#6 lore raw

PATCH v3 1/1 sf: Macronix additional chips supported

new chips supported:-
MX25L1605D, MX25L3205D, MX25L6405D, MX25L12855E
out of which MX25L6405D and MX25L12855E tested on Kirkwood platforms

Modified the Macronix flash support to use 2 bytes of device id instead of 1 This was required to support MX25L12855E

---
Change log:-
v2: leading spaces removed for clean patch apply
build error fixed
tested for new added chip MX25L6405D

v3: updated contributors info
ids combined to u16
ids list of defines removed, used values in the struct

 drivers/mtd/spi/macronix.c |   49 +++++++++++++++++++++++++++++++++----------
 1 files changed, 37 insertions(+), 12 deletions(-)
drivers/mtd/spi/macronix.c +37 -12
index 9464c84..1522eb1 100644
@@ -49,18 +49,10 @@
 #define CMD_MX25XX_DP		0xb9	/* Deep Power-down */
 #define CMD_MX25XX_RES		0xab	/* Release from DP, and Read Signature */
 
-#define MXIC_ID_MX2516		0x15
-#define MXIC_ID_MX2520		0x12
-#define MXIC_ID_MX2532		0x16
-#define MXIC_ID_MX2540		0x13
-#define MXIC_ID_MX2564		0x17
-#define MXIC_ID_MX2580		0x14
-#define MXIC_ID_MX25128		0x18
-
 #define MACRONIX_SR_WIP		(1 << 0)	/* Write-in-Progress */
 
 struct macronix_spi_flash_params {
-	u8 idcode1;
+	u16 idcode;
 	u16 page_size;
 	u16 pages_per_sector;
 	u16 sectors_per_block;
@@ -81,13 +73,45 @@ static inline struct macronix_spi_flash *to_macronix_spi_flash(struct spi_flash
 
 static const struct macronix_spi_flash_params macronix_spi_flash_table[] = {
 	{
-		.idcode1 = MXIC_ID_MX25128,
+		.idcode = 0x2015,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 32,
+		.name = "MX25L1605D",
+	},
+	{
+		.idcode = 0x2016,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 64,
+		.name = "MX25L3205D",
+	},
+	{
+		.idcode = 0x2017,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 128,
+		.name = "MX25L6405D",
+	},
+	{
+		.idcode = 0x2018,
 		.page_size = 256,
 		.pages_per_sector = 16,
 		.sectors_per_block = 16,
 		.nr_blocks = 256,
 		.name = "MX25L12805D",
 	},
+	{
+		.idcode = 0x2618,
+		.page_size = 256,
+		.pages_per_sector = 16,
+		.sectors_per_block = 16,
+		.nr_blocks = 256,
+		.name = "MX25L12855E",
+	},
 };
 
 static int macronix_wait_ready(struct spi_flash *flash, unsigned long timeout)
@@ -277,15 +301,16 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
 	const struct macronix_spi_flash_params *params;
 	struct macronix_spi_flash *mcx;
 	unsigned int i;
+	u16 id = (u16 *) *idcode;
 
 	for (i = 0; i < ARRAY_SIZE(macronix_spi_flash_table); i++) {
 		params = &macronix_spi_flash_table[i];
-		if (params->idcode1 == idcode[2])
+                if (params->idcode == id)
 			break;
 	}
 
 	if (i == ARRAY_SIZE(macronix_spi_flash_table)) {
-		debug("SF: Unsupported Macronix ID %02x\n", idcode[1]);
+                debug("SF: Unsupported Macronix ID %04x\n", id);
 		return NULL;
 	}
 
Signature · 1 line
1.5.3.3
#7 lore raw

PATCH v3 1/1 sf: Macronix additional chips supported

drivers/mtd/spi/macronix.c struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode) · line 304

Quoted 1 line · On Monday 06 July 2009 07:41:52 Prafulla Wadaskar wrote:
drivers/mtd/spi/macronix.c +1 -0
+	u16 id = (u16 *) *idcode;

sorry, this wont fly on systems that cannot do unaligned accesses. i dont know the status of the get_unaligned() type macros in u-boot, but it'll probably be easier to just do:
idcode[0] | idcode[1] << 8;

drivers/mtd/spi/macronix.c struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode) · line 313

Quoted 4 lines
drivers/mtd/spi/macronix.c +2 -2
-		if (params->idcode1 == idcode[2])
+                if (params->idcode == id)
-		debug("SF: Unsupported Macronix ID %02x\n", idcode[1]);
+                debug("SF: Unsupported Macronix ID %04x\n", id);

you've still got busted whitespace here :/
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090706/5ae0ebb0/attachment-0001.pgp