Patchwork [U-Boot] MTD: Add support for S25FL032P spi nor-flash

login
register
mail settings
Submitter David Jander
Date Aug. 24, 2010, 6:49 a.m.
Message ID <1282632543-17437-1-git-send-email-david@protonic.nl>
Download mbox | patch
Permalink /patch/71826/
State Superseded
Delegated to: Mike Frysinger
Headers show

Comments

David Jander - Aug. 24, 2010, 6:49 a.m.
This patch introduces an extra mask-field in spansion_spi_flash_params
to support flash chips with 1-byte extended ID (like the S25FL032P).

Signed-off-by: David Jander <david@protonic.nl>
---
 drivers/mtd/spi/spansion.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

Patch

diff --git a/drivers/mtd/spi/spansion.c b/drivers/mtd/spi/spansion.c
index d6c1a5f..14cd6d3 100644
--- a/drivers/mtd/spi/spansion.c
+++ b/drivers/mtd/spi/spansion.c
@@ -52,12 +52,14 @@ 
 #define SPSN_ID_S25FL128P	0x2018
 #define SPSN_EXT_ID_S25FL128P_256KB	0x0300
 #define SPSN_EXT_ID_S25FL128P_64KB	0x0301
+#define SPSN_EXT_ID_S25FL032P		0x4d00
 
 #define SPANSION_SR_WIP		(1 << 0)	/* Write-in-Progress */
 
 struct spansion_spi_flash_params {
 	u16 idcode1;
 	u16 idcode2;
+	u16 idmask2;
 	u16 page_size;
 	u16 pages_per_sector;
 	u16 nr_sectors;
@@ -79,6 +81,7 @@  static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
 	{
 		.idcode1 = SPSN_ID_S25FL008A,
 		.idcode2 = 0,
+		.idmask2 = 0xffff,
 		.page_size = 256,
 		.pages_per_sector = 256,
 		.nr_sectors = 16,
@@ -87,6 +90,7 @@  static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
 	{
 		.idcode1 = SPSN_ID_S25FL016A,
 		.idcode2 = 0,
+		.idmask2 = 0xffff,
 		.page_size = 256,
 		.pages_per_sector = 256,
 		.nr_sectors = 32,
@@ -95,6 +99,7 @@  static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
 	{
 		.idcode1 = SPSN_ID_S25FL032A,
 		.idcode2 = 0,
+		.idmask2 = 0xffff,
 		.page_size = 256,
 		.pages_per_sector = 256,
 		.nr_sectors = 64,
@@ -103,6 +108,7 @@  static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
 	{
 		.idcode1 = SPSN_ID_S25FL064A,
 		.idcode2 = 0,
+		.idmask2 = 0xffff,
 		.page_size = 256,
 		.pages_per_sector = 256,
 		.nr_sectors = 128,
@@ -111,6 +117,7 @@  static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
 	{
 		.idcode1 = SPSN_ID_S25FL128P,
 		.idcode2 = SPSN_EXT_ID_S25FL128P_64KB,
+		.idmask2 = 0xffff,
 		.page_size = 256,
 		.pages_per_sector = 256,
 		.nr_sectors = 256,
@@ -119,11 +126,21 @@  static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
 	{
 		.idcode1 = SPSN_ID_S25FL128P,
 		.idcode2 = SPSN_EXT_ID_S25FL128P_256KB,
+		.idmask2 = 0xffff,
 		.page_size = 256,
 		.pages_per_sector = 1024,
 		.nr_sectors = 64,
 		.name = "S25FL128P_256K",
 	},
+	{
+		.idcode1 = SPSN_ID_S25FL032A,
+		.idcode2 = SPSN_EXT_ID_S25FL032P,
+		.idmask2 = 0xff00,
+		.page_size = 256,
+		.pages_per_sector = 256,
+		.nr_sectors = 64,
+		.name = "S25FL032P",
+	},
 };
 
 static int spansion_wait_ready(struct spi_flash *flash, unsigned long timeout)
@@ -317,7 +334,7 @@  struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)
 	for (i = 0; i < ARRAY_SIZE(spansion_spi_flash_table); i++) {
 		params = &spansion_spi_flash_table[i];
 		if (params->idcode1 == jedec) {
-			if (params->idcode2 == ext_jedec)
+			if (params->idcode2 == (ext_jedec & params->idmask2))
 				break;
 		}
 	}