[U-Boot] [PATCH] MTD: Add support for S25FL032P spi nor-flash
David Jander
david.jander at protonic.nl
Mon Aug 23 15:12:16 CEST 2010
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 at protonic.nl>
---
drivers/mtd/spi/spansion.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
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;
}
}
--
1.6.3.3
More information about the U-Boot
mailing list