Skip to contentSkip to conversation

sf: Macronix additional chips supported

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

lore
Share & tools
lore
#0 lore raw

PATCH v4 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

Done some indentation fixes

---
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

v4: indentation fixes,
line lengths brought below 78 chars
alligned access fixed for idcode

 drivers/mtd/spi/macronix.c |   83 +++++++++++++++++++++++++++++--------------
 1 files changed, 56 insertions(+), 27 deletions(-)
drivers/mtd/spi/macronix.c +56 -27
index 9464c84..64922b5 100644
@@ -20,7 +20,7 @@
  *
  * 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
+ * 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
@@ -47,20 +47,12 @@
 #define CMD_MX25XX_BE		0xD8	/* Block Erase */
 #define CMD_MX25XX_CE		0xc7	/* Chip Erase */
 #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 CMD_MX25XX_RES		0xab	/* Release from DP, and Read Sign */
 
 #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;
@@ -73,24 +65,57 @@ struct macronix_spi_flash {
 	const struct macronix_spi_flash_params *params;
 };
 
-static inline struct macronix_spi_flash *to_macronix_spi_flash(struct spi_flash
-							       *flash)
+static inline struct macronix_spi_flash *to_macronix_spi_flash(
+					struct spi_flash *flash)
 {
 	return container_of(flash, struct macronix_spi_flash, 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)
+static int macronix_wait_ready(struct spi_flash *flash,
+					unsigned long timeout)
 {
 	struct spi_slave *spi = flash->spi;
 	unsigned long timebase;
@@ -125,7 +150,7 @@ static int macronix_wait_ready(struct spi_flash *flash, unsigned long timeout)
 }
 
 static int macronix_read_fast(struct spi_flash *flash,
-			      u32 offset, size_t len, void *buf)
+				u32 offset, size_t len, void *buf)
 {
 	struct macronix_spi_flash *mcx = to_macronix_spi_flash(flash);
 	unsigned long page_addr;
@@ -145,7 +170,7 @@ static int macronix_read_fast(struct spi_flash *flash,
 }
 
 static int macronix_write(struct spi_flash *flash,
-			  u32 offset, size_t len, const void *buf)
+			u32 offset, size_t len, const void *buf)
 {
 	struct macronix_spi_flash *mcx = to_macronix_spi_flash(flash);
 	unsigned long page_addr;
@@ -176,8 +201,10 @@ static int macronix_write(struct spi_flash *flash,
 		cmd[3] = byte_addr;
 
 		debug
-		    ("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %d\n",
-		     buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);
+			("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x }"
+			" chunk_len = %d\n",
+			buf + actual, cmd[0], cmd[1], cmd[2], cmd[3],
+			chunk_len);
 
 		ret = spi_flash_cmd(flash->spi, CMD_MX25XX_WREN, NULL, 0);
 		if (ret < 0) {
@@ -186,7 +213,7 @@ static int macronix_write(struct spi_flash *flash,
 		}
 
 		ret = spi_flash_cmd_write(flash->spi, cmd, 4,
-					  buf + actual, chunk_len);
+					buf + actual, chunk_len);
 		if (ret < 0) {
 			debug("SF: Macronix Page Program failed\n");
 			break;
@@ -203,7 +230,7 @@ static int macronix_write(struct spi_flash *flash,
 	}
 
 	debug("SF: Macronix: Successfully programmed %u bytes @ 0x%x\n",
-	      len, offset);
+		len, offset);
 
 	spi_release_bus(flash->spi);
 	return ret;
@@ -227,7 +254,7 @@ int macronix_erase(struct spi_flash *flash, u32 offset, size_t len)
 			* mcx->params->sectors_per_block;
 
 	if (offset % sector_size || len % sector_size) {
-		debug("SF: Erase offset/length not multiple of sector size\n");
+		debug("SF: Erase offset/len not multiple of sector size\n");
 		return -1;
 	}
 
@@ -258,7 +285,8 @@ int macronix_erase(struct spi_flash *flash, u32 offset, size_t len)
 			break;
 		}
 
-		ret = macronix_wait_ready(flash, SPI_FLASH_PAGE_ERASE_TIMEOUT);
+		ret = macronix_wait_ready(flash,
+				SPI_FLASH_PAGE_ERASE_TIMEOUT);
 		if (ret < 0) {
 			debug("SF: Macronix page erase timed out\n");
 			break;
@@ -277,15 +305,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 = idcode[0] | idcode[1] << 8;
 
 	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;
 	}
 
@@ -303,10 +332,10 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
 	mcx->flash.erase = macronix_erase;
 	mcx->flash.read = macronix_read_fast;
 	mcx->flash.size = params->page_size * params->pages_per_sector
-	    * params->sectors_per_block * params->nr_blocks;
+		* params->sectors_per_block * params->nr_blocks;
 
 	printf("SF: Detected %s with page size %u, total %u bytes\n",
-	      params->name, params->page_size, mcx->flash.size);
+		params->name, params->page_size, mcx->flash.size);
 
 	return &mcx->flash;
 }
Signature · 1 line
1.5.3.3
#1 lore raw

PATCH v4 1/1 sf: Macronix additional chips supported

Hi Mike
I hope this is through :-)
While sending a patch I cut pasted --in-reply-to field wrongly, that does not hard patch contents.

Is this okay or shall I re-send this patch?

Regards..
Prafulla . .

Quoted 254 lines

-----Original Message-----
From: Prafulla Wadaskar [mailto:prafulla at marvell.com]
Sent: Monday, July 06, 2009 5:51 PM
To: u-boot at lists.denx.de
Cc: Nicolas Pitre; Manas Saksena; Lennert Buijtenhek; Prabhanjan Sarnaik; Ronen Shitrit; Ashish Karkare; Prafulla Wadaskar; Piyush Shah
Subject: [PATCH v4] 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

Done some indentation fixes

---
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

v4: indentation fixes,
line lengths brought below 78 chars
alligned access fixed for idcode

 drivers/mtd/spi/macronix.c |   83 
+++++++++++++++++++++++++++++--------------
 1 files changed, 56 insertions(+), 27 deletions(-)
(quoted diff) +0 -0

b/drivers/mtd/spi/macronix.c index 9464c84..64922b5 100644

drivers/mtd/spi/macronix.c +1 -1
@@ -20,7 +20,7 @@
  *
  * 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
+ * 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 @@ -47,20 +47,12 @@
#define CMD_MX25XX_BE 0xD8 /* Block Erase */
#define CMD_MX25XX_CE 0xc7 /* Chip Erase */
#define CMD_MX25XX_DP 0xb9 /* Deep Power-down */
-#define CMD_MX25XX_RES 0xab /* Release from
DP, and Read Signature */

drivers/mtd/spi/macronix.c +1 -8
-
-#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 CMD_MX25XX_RES		0xab	/* Release from 

DP, and Read Sign */

#define MACRONIX_SR_WIP (1 << 0) /*
Write-in-Progress */

struct macronix_spi_flash_params {

drivers/mtd/spi/macronix.c +38 -5
-	u8 idcode1;
+	u16 idcode;
 	u16 page_size;
 	u16 pages_per_sector;
 	u16 sectors_per_block;
@@ -73,24 +65,57 @@ struct macronix_spi_flash {
 	const struct macronix_spi_flash_params *params;  };
 
-static inline struct macronix_spi_flash 
 *to_macronix_spi_flash(struct spi_flash
-							       *flash)
+static inline struct macronix_spi_flash *to_macronix_spi_flash(
+					struct spi_flash *flash)
 {
 	return container_of(flash, struct macronix_spi_flash, 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)
+static int macronix_wait_ready(struct spi_flash *flash,
+					unsigned long timeout)
 {
 	struct spi_slave *spi = flash->spi;
drivers/mtd/spi/macronix.c +6 -4
 	unsigned long timebase;
@@ -125,7 +150,7 @@ static int macronix_wait_ready(struct 
 spi_flash *flash, unsigned long timeout)  }
 
 static int macronix_read_fast(struct spi_flash *flash,
-			      u32 offset, size_t len, void *buf)
+				u32 offset, size_t len, void *buf)
 {
 	struct macronix_spi_flash *mcx = to_macronix_spi_flash(flash);
 	unsigned long page_addr;
@@ -145,7 +170,7 @@ static int macronix_read_fast(struct 
 spi_flash *flash,  }
 
 static int macronix_write(struct spi_flash *flash,
-			  u32 offset, size_t len, const void *buf)
+			u32 offset, size_t len, const void *buf)
 {
 	struct macronix_spi_flash *mcx = to_macronix_spi_flash(flash);
 	unsigned long page_addr;
@@ -176,8 +201,10 @@ static int macronix_write(struct 
 spi_flash *flash,
 		cmd[3] = byte_addr;
 
 		debug
-		    ("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x 
 } chunk_len = %d\n",
-		     buf + actual, cmd[0], cmd[1], cmd[2], 
 cmd[3], chunk_len);
+			("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x }"
+			" chunk_len = %d\n",
+			buf + actual, cmd[0], cmd[1], cmd[2], cmd[3],
+			chunk_len);

ret = spi_flash_cmd(flash->spi,
CMD_MX25XX_WREN, NULL, 0);

drivers/mtd/spi/macronix.c +3 -3
 		if (ret < 0) {
@@ -186,7 +213,7 @@ static int macronix_write(struct spi_flash *flash,
 		}
 
 		ret = spi_flash_cmd_write(flash->spi, cmd, 4,
-					  buf + actual, chunk_len);
+					buf + actual, chunk_len);
 		if (ret < 0) {
 			debug("SF: Macronix Page Program failed\n");
 			break;
@@ -203,7 +230,7 @@ static int macronix_write(struct spi_flash *flash,
 	}
 
 	debug("SF: Macronix: Successfully programmed %u bytes @ 0x%x\n",
-	      len, offset);
+		len, offset);
 
 	spi_release_bus(flash->spi);
 	return ret;
@@ -227,7 +254,7 @@ int macronix_erase(struct spi_flash 
 *flash, u32 offset, size_t len)
 			* mcx->params->sectors_per_block;
 
 	if (offset % sector_size || len % sector_size) {
-		debug("SF: Erase offset/length not multiple of 
 sector size\n");
+		debug("SF: Erase offset/len not multiple of 
 sector size\n");
drivers/mtd/spi/macronix.c +2 -1
 		return -1;
 	}
@@ -258,7 +285,8 @@ int macronix_erase(struct spi_flash 
 *flash, u32 offset, size_t len)
 			break;
 		}
 
-		ret = macronix_wait_ready(flash, 
 SPI_FLASH_PAGE_ERASE_TIMEOUT);
+		ret = macronix_wait_ready(flash,
+				SPI_FLASH_PAGE_ERASE_TIMEOUT);
 		if (ret < 0) {
drivers/mtd/spi/macronix.c +5 -4
 			debug("SF: Macronix page erase timed out\n");
 			break;
@@ -277,15 +305,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 = idcode[0] | idcode[1] << 8;
 
 	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;
 	}
@@ -303,10 +332,10 @@ struct spi_flash 
 *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
 	mcx->flash.erase = macronix_erase;
 	mcx->flash.read = macronix_read_fast;
 	mcx->flash.size = params->page_size * params->pages_per_sector
-	    * params->sectors_per_block * params->nr_blocks;
+		* params->sectors_per_block * params->nr_blocks;
 
 	printf("SF: Detected %s with page size %u, total %u bytes\n",
-	      params->name, params->page_size, mcx->flash.size);
+		params->name, params->page_size, mcx->flash.size);
 
 	return &mcx->flash;

}
--
1.5.3.3

#2 lore raw

PATCH v4 1/1 sf: Macronix additional chips supported

In reply to Prafulla Wadaskar
Quoted 17 lines · On Monday 06 July 2009 08:21:16 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

Done some indentation fixes

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

Quoted 7 lines

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

v4: indentation fixes,
line lengths brought below 78 chars
alligned access fixed for idcode

blah, this just got much worse. code style cleanups should be kept separate. i.e. the v3 patch without whitespace damage should be one commit and then if you still want to do style changes, that needs to be on top of that.
-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/5d59b0f0/attachment.pgp

#3 lore raw

PATCH v4 1/1 sf: Macronix additional chips supported

Quoted 37 lines

-----Original Message-----
From: Mike Frysinger [mailto:vapier at gentoo.org]
Sent: Monday, July 06, 2009 1:58 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 v4] sf: Macronix additional chips supported

Quoted 17 lines · On Monday 06 July 2009 08:21:16 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

Done some indentation fixes

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

Quoted 7 lines

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

v4: indentation fixes,
line lengths brought below 78 chars
alligned access fixed for idcode

Quoted 5 lines

blah, this just got much worse. code style cleanups should be kept separate.
i.e. the v3 patch without whitespace damage should be one commit and then if you still want to do style changes, that needs to be on top of that.

Okay..
I will repost v4 for this patch without whitespcae change. And will post separate patch for indentation.

Regards..
Prafulla . .

Quoted 2 lines

-mike

#4 lore raw

PATCH v4 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

v4: alligned access fixed for idcode

 drivers/mtd/spi/macronix.c |   49 +++++++++++++++++++++++++++++++++----------
 1 files changed, 37 insertions(+), 12 deletions(-)
drivers/mtd/spi/macronix.c +37 -12
index 9464c84..4a49b54 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 = idcode[2] | idcode[1] << 8;
 
 	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
#5 lore raw

PATCH v4 1/1 sf: Macronix additional chips supported

Quoted 6 lines · On Monday 06 July 2009 10:59:15 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

this one looks fine to me. ive added it to my sf branch, thanks.
-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/2d7d998a/attachment-0001.pgp

#6 lore raw

PATCH v4 1/1 sf: Macronix additional chips supported

Quoted 16 lines

-----Original Message-----
From: Mike Frysinger [mailto:vapier at gentoo.org]
Sent: Tuesday, July 07, 2009 3:26 AM
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 v4][repost] sf: Macronix additional chips supported

Quoted 4 lines · On Monday 06 July 2009 10:59:15 Prafulla Wadaskar wrote:

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

Quoted 5 lines
Quoted 3 lines

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

this one looks fine to me. ive added it to my sf branch, thanks.

Thanks Mike.

Next- I want to support "protect off/on" commands for Macronix-SF, but I could not see framework for the same in SF generic code, any pointers/guidelines/reference for this activity?

Regards..
Prafulla . .

#7 lore raw

PATCH v4 1/1 sf: Macronix additional chips supported

Quoted 3 lines · On Tuesday 07 July 2009 03:14:46 Prafulla Wadaskar wrote:

Next- I want to support "protect off/on" commands for Macronix-SF, but I could not see framework for the same in SF generic code, any pointers/guidelines/reference for this activity?

should be straightforward to add it like other commands in sf. add "protect" to cmd_sf.c:do_spi_flash() which calls (the new function) cmd_sf.c:do_spi_flash_erase() which calls (the new function) drivers/mtd/spi/spi_flash.c:spi_flash_cmd_erase() ...
-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/20090707/38d5da7b/attachment.pgp