Skip to contentSkip to conversation

sf: Divide spi_flash into multiple parts

PATCH Superseded Jagannadha Sutradharudu Teki 1 participant 12 messages Aug 4, 2013 1 message not in the archive Memory technology devices (MTD)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/12 sf: Divide spi_flash into multiple parts

Divided the spi_flash framework into mutiple parts for
- spi_flash.c:
spi flash core file, interaction for spi/qspi driver to spi_flash framework.
- spi_flash_ops.c
spi flash preffered operations, erase,write and read.
- spi_flash_probe.c
spi flash probing, easy to extend probing functionality.

This change will support to extend the functionality in a proper manner.

---
 drivers/mtd/spi/Makefile          |   2 +-
 drivers/mtd/spi/spi_flash.c       | 569 +-------------------------------------
 drivers/mtd/spi/spi_flash_ops.c   | 314 +++++++++++++++++++++
 drivers/mtd/spi/spi_flash_probe.c | 274 ++++++++++++++++++
 4 files changed, 594 insertions(+), 565 deletions(-)
 create mode 100644 drivers/mtd/spi/spi_flash_ops.c
 create mode 100644 drivers/mtd/spi/spi_flash_probe.c
drivers/mtd/spi/Makefile +1 -1
index e537fcf..0304b12 100644
@@ -13,7 +13,7 @@ ifdef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_SPL_SPI_LOAD)	+= spi_spl_load.o
 endif
 
-COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash.o
+COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash_probe.o spi_flash_ops.o spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
 COBJS-$(CONFIG_SPI_FLASH_EON)	+= eon.o
 COBJS-$(CONFIG_SPI_FLASH_GIGADEVICE)	+= gigadevice.o
drivers/mtd/spi/spi_flash.c +5 -564

590 lines not on this page · raw message

drivers/mtd/spi/spi_flash_ops.c new file +314 -0

314 lines not on this page · raw message

drivers/mtd/spi/spi_flash_probe.c new file +274 -0

274 lines not on this page · raw message

Signature · 1 line
1.8.3
#2 lore raw

PATCH 2/12 sf: probe: Add new spi_flash_probe support

In reply to a message not in the archive

Added new spi_flash_probe support, currently added N25Q* flash part attributes support.

Defined CONFIG_SPI_FLASH_LEGACY for old probing style which is available on spi_flash_probe_legacy.c, this will removed soon once all flashes are supported in new spi_flash_probe.

---
 drivers/mtd/spi/Makefile                 |   1 +
 drivers/mtd/spi/spi_flash_probe.c        | 226 ++++++++++++-------------
 drivers/mtd/spi/spi_flash_probe_legacy.c | 274 +++++++++++++++++++++++++++++++
 3 files changed, 380 insertions(+), 121 deletions(-)
 create mode 100644 drivers/mtd/spi/spi_flash_probe_legacy.c
drivers/mtd/spi/Makefile +1 -0
index 0304b12..188fb98 100644
@@ -13,6 +13,7 @@ ifdef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_SPL_SPI_LOAD)	+= spi_spl_load.o
 endif
 
+COBJS-$(CONFIG_SPI_FLASH_LEGACY) += spi_flash_legacy.o spi_flash_ops.o spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash_probe.o spi_flash_ops.o spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
 COBJS-$(CONFIG_SPI_FLASH_EON)	+= eon.o
drivers/mtd/spi/spi_flash_probe.c +105 -121

290 lines not on this page · raw message

drivers/mtd/spi/spi_flash_probe_legacy.c new file +274 -0

274 lines not on this page · raw message

Signature · 1 line
1.8.3
#3 lore raw

PATCH 3/12 sf: probe: Update sector_size for N25Q* parts

In reply to a message not in the archive

Updated the sector_size as 64 * 1024 as these sectors are 64KB.

---
 drivers/mtd/spi/spi_flash_probe.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/mtd/spi/spi_flash_probe.c +12 -12
index 8536c08..d129162 100644
@@ -35,18 +35,18 @@ static const struct {
 	u32 nr_sectors;
 } spi_flash_ids[] = {
 	/* STMICRO */
-	{"N25Q32",		0x20ba16, 0x0,    256 * 256,    64},
-	{"N25Q32A",		0x20bb16, 0x0,    256 * 256,    64},
-	{"N25Q64",		0x20ba17, 0x0,    256 * 256,    128},
-	{"N25Q64A",		0x20bb17, 0x0,    256 * 256,    128},
-	{"N25Q128",		0x20ba18, 0x0,    256 * 256,    256},
-	{"N25Q128A",		0x20bb18, 0x0,    256 * 256,    256},
-	{"N25Q256",		0x20ba19, 0x0,    256 * 256,    512},
-	{"N25Q256A",		0x20bb19, 0x0,    256 * 256,    512},
-	{"N25Q512",		0x20ba20, 0x0,    256 * 256,    1024},
-	{"N25Q512A",		0x20bb20, 0x0,    256 * 256,    1024},
-	{"N25Q1024",		0x20ba21, 0x0,    256 * 256,    2048},
-	{"N25Q1024A",		0x20bb21, 0x0,    256 * 256,    2048},
+	{"N25Q32",		0x20ba16, 0x0,    64 * 1024,    64},
+	{"N25Q32A",		0x20bb16, 0x0,    64 * 1024,    64},
+	{"N25Q64",		0x20ba17, 0x0,    64 * 1024,    128},
+	{"N25Q64A",		0x20bb17, 0x0,    64 * 1024,    128},
+	{"N25Q128",		0x20ba18, 0x0,    64 * 1024,    256},
+	{"N25Q128A",		0x20bb18, 0x0,    64 * 1024,    256},
+	{"N25Q256",		0x20ba19, 0x0,    64 * 1024,    512},
+	{"N25Q256A",		0x20bb19, 0x0,    64 * 1024,    512},
+	{"N25Q512",		0x20ba20, 0x0,    64 * 1024,    1024},
+	{"N25Q512A",		0x20bb20, 0x0,    64 * 1024,    1024},
+	{"N25Q1024",		0x20ba21, 0x0,    64 * 1024,    2048},
+	{"N25Q1024A",		0x20bb21, 0x0,    64 * 1024,    2048},
 	/*
 	 * TODO:
 	 * ATMEL
Signature · 1 line
1.8.3
#4 lore raw

PATCH 4/12 sf: probe: Add support for M25P* flash parts

In reply to a message not in the archive

All M25P* flash parts are taken from spi_flash_probe_legacy.c.

---
 drivers/mtd/spi/spi_flash_probe.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +8 -1
index d129162..7b11365 100644
@@ -35,6 +35,14 @@ static const struct {
 	u32 nr_sectors;
 } spi_flash_ids[] = {
 	/* STMICRO */
+	{"M25P10",		0x202011, 0x0,    256 * 256,    4},
+	{"M25P20",		0x202012, 0x0,    256 * 256,    4},
+	{"M25P40",		0x202013, 0x0,    256 * 256,    8},
+	{"M25P80",		0x202014, 0x0,    256 * 256,    16},
+	{"M25P16",		0x202015, 0x0,    256 * 256,    32},
+	{"M25P32",		0x202016, 0x0,    256 * 256,    64},
+	{"M25P64",		0x202017, 0x0,    256 * 256,    128},
+	{"M25P128",		0x202018, 0x0,    256 * 1024,   64},
 	{"N25Q32",		0x20ba16, 0x0,    64 * 1024,    64},
 	{"N25Q32A",		0x20bb16, 0x0,    64 * 1024,    64},
 	{"N25Q64",		0x20ba17, 0x0,    64 * 1024,    128},
@@ -56,7 +64,6 @@ static const struct {
 	 * RAMTRON
 	 * SPANSION
 	 * SST
-	 * STMICRO (M25*)
 	 * WINBOND
 	 * non-JEDEC ID's
 	 */
Signature · 1 line
1.8.3
#5 lore raw

PATCH 5/12 sf: probe: Update sector_size for M25P* parts

In reply to a message not in the archive

Updated/Corrected the sector_size as per the datasheets.

---
 drivers/mtd/spi/spi_flash_probe.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/mtd/spi/spi_flash_probe.c +8 -8
index 7b11365..93209a9 100644
@@ -35,14 +35,14 @@ static const struct {
 	u32 nr_sectors;
 } spi_flash_ids[] = {
 	/* STMICRO */
-	{"M25P10",		0x202011, 0x0,    256 * 256,    4},
-	{"M25P20",		0x202012, 0x0,    256 * 256,    4},
-	{"M25P40",		0x202013, 0x0,    256 * 256,    8},
-	{"M25P80",		0x202014, 0x0,    256 * 256,    16},
-	{"M25P16",		0x202015, 0x0,    256 * 256,    32},
-	{"M25P32",		0x202016, 0x0,    256 * 256,    64},
-	{"M25P64",		0x202017, 0x0,    256 * 256,    128},
-	{"M25P128",		0x202018, 0x0,    256 * 1024,   64},
+	{"M25P10",		0x202011, 0x0,    32 * 1024,    4},
+	{"M25P20",		0x202012, 0x0,    64 * 1024,    4},
+	{"M25P40",		0x202013, 0x0,    64 * 1024,    8},
+	{"M25P80",		0x202014, 0x0,    64 * 1024,    16},
+	{"M25P16",		0x202015, 0x0,    64 * 1024,    32},
+	{"M25P32",		0x202016, 0x0,    64 * 1024,    64},
+	{"M25P64",		0x202017, 0x0,    64 * 1024,    128},
+	{"M25P128",		0x202018, 0x0,   256 * 1024,	64},
 	{"N25Q32",		0x20ba16, 0x0,    64 * 1024,    64},
 	{"N25Q32A",		0x20bb16, 0x0,    64 * 1024,    64},
 	{"N25Q64",		0x20ba17, 0x0,    64 * 1024,    128},
Signature · 1 line
1.8.3
#6 lore raw

PATCH 6/12 sf: probe: Add support for EN25Q* flash parts

In reply to a message not in the archive

All EON EN25Q* flash parts are taken from spi_flash_probe_legacy.c.

---
 drivers/mtd/spi/spi_flash_probe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +4 -1
index 93209a9..e48842a 100644
@@ -34,6 +34,10 @@ static const struct {
 	u32 sector_size;
 	u32 nr_sectors;
 } spi_flash_ids[] = {
+	/* EON */
+	{"EN25Q32B",		0x1c3016, 0x0,	  64 * 1024,	64},
+	{"EN25Q128B",		0x1c3018, 0x0,    64 * 1024,	256},
+
 	/* STMICRO */
 	{"M25P10",		0x202011, 0x0,    32 * 1024,    4},
 	{"M25P20",		0x202012, 0x0,    64 * 1024,    4},
@@ -58,7 +62,6 @@ static const struct {
 	/*
 	 * TODO:
 	 * ATMEL
-	 * EON
 	 * GIGADEVICE
 	 * MACRONIX
 	 * RAMTRON
Signature · 1 line
1.8.3
#7 lore raw

PATCH 7/12 sf: probe: Add support for GD25* flash parts

In reply to a message not in the archive

All GIGADEVICE GD25* flash parts are taken from spi_flash_probe_legacy.c.

---
 drivers/mtd/spi/spi_flash_probe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +4 -1
index e48842a..8cca809 100644
@@ -34,6 +34,10 @@ static const struct {
 	u32 sector_size;
 	u32 nr_sectors;
 } spi_flash_ids[] = {
+	/* GIGADEVICE */
+	{"GD25Q64B",		0xc84017, 0x0,	  64 * 1024,	128},
+	{"GD25LQ32",		0xc86016, 0x0,	  64 * 1024,	64},
+
 	/* EON */
 	{"EN25Q32B",		0x1c3016, 0x0,	  64 * 1024,	64},
 	{"EN25Q128B",		0x1c3018, 0x0,    64 * 1024,	256},
@@ -62,7 +66,6 @@ static const struct {
 	/*
 	 * TODO:
 	 * ATMEL
-	 * GIGADEVICE
 	 * MACRONIX
 	 * RAMTRON
 	 * SPANSION
Signature · 1 line
1.8.3
#8 lore raw

PATCH 8/12 sf: probe: Add support for MX25L* flash parts

In reply to a message not in the archive

All MACRONIX MX25L* flash parts are taken from spi_flash_probe_legacy.c.

---
 drivers/mtd/spi/spi_flash_probe.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +9 -1
index 8cca809..75b2245 100644
@@ -34,6 +34,15 @@ static const struct {
 	u32 sector_size;
 	u32 nr_sectors;
 } spi_flash_ids[] = {
+	/* MACRONIX */
+	{"MX25L4005",		0xc22013, 0x0,	  64 * 1024,	8},
+	{"MX25L8005",		0xc22014, 0x0,	  64 * 1024,	16},
+	{"MX25L1605D",		0xc22015, 0x0,	  64 * 1024,	32},
+	{"MX25L3205D",		0xc22016, 0x0,	  64 * 1024,	64},
+	{"MX25L6405D",		0xc22017, 0x0,	  64 * 1024,	128},
+	{"MX25L12805",		0xc22018, 0x0,	  64 * 1024,	256},
+	{"MX25L12855E",		0xc22618, 0x0,	  64 * 1024,	256},
+
 	/* GIGADEVICE */
 	{"GD25Q64B",		0xc84017, 0x0,	  64 * 1024,	128},
 	{"GD25LQ32",		0xc86016, 0x0,	  64 * 1024,	64},
@@ -66,7 +75,6 @@ static const struct {
 	/*
 	 * TODO:
 	 * ATMEL
-	 * MACRONIX
 	 * RAMTRON
 	 * SPANSION
 	 * SST
Signature · 1 line
1.8.3
#9 lore raw

PATCH 9/12 sf: probe: Add support for W25* flash parts

In reply to a message not in the archive

All WINBOND W25* flash parts are taken from spi_flash_probe_legacy.c.

---
 drivers/mtd/spi/spi_flash_probe.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +32 -1
index 75b2245..1be55b3 100644
@@ -72,13 +72,44 @@ static const struct {
 	{"N25Q512A",		0x20bb20, 0x0,    64 * 1024,    1024},
 	{"N25Q1024",		0x20ba21, 0x0,    64 * 1024,    2048},
 	{"N25Q1024A",		0x20bb21, 0x0,    64 * 1024,    2048},
+
+	/* WINBOND */
+	{"W25P80",		0xef2014, 0x0,	  65536,	16},
+	{"W25P16",		0xef2015, 0x0,	  65536,	32},
+	{"W25P32",		0xef2016, 0x0,	  65536,	64},
+	{"W25X40",		0xef3013, 0x0,	  4096,		8},
+	{"W25X16",		0xef3015, 0x0,	  4096,		32},
+	{"W25X32",		0xef3016, 0x0,	  4096,		64},
+	{"W25X64",		0xef3017, 0x0,	  4096,		128},
+	{"W25Q80BL",		0xef4014, 0x0,	  4096,		16},
+	{"W25Q16CL",		0xef4015, 0x0,	  4096,		32},
+	{"W25Q32BV",		0xef4016, 0x0,	  4096,		64},
+	{"W25Q64CV",		0xef4017, 0x0,	  4096,		128},
+	{"W25Q128BV",		0xef4018, 0x0,	  4096,		256},
+	{"W25Q256",		0xef4019, 0x0,	  4096,		512},
+	{"W25Q80BW",		0xef5014, 0x0,	  4096,		16},
+	{"W25Q16DW",		0xef6015, 0x0,	  4096,		32},
+	{"W25Q32DW",		0xef6016, 0x0,	  4096,		64},
+	{"W25Q64DW",		0xef6017, 0x0,	  4096,		128},
+	{"W25Q128FW",		0xef6018, 0x0,	  4096,		256},
+	/*
+	 * Note:
+	 * Below paired flash devices has similar spi_flash_ids attributes.
+	 * (W25Q80BL, W25Q80BV)
+	 * (W25Q16CL, W25Q16DV)
+	 * (W25Q32BV, W25Q32FV_SPI)
+	 * (W25Q64CV, W25Q64FV_SPI)
+	 * (W25Q128BV, W25Q128FV_SPI)
+	 * (W25Q32DW, W25Q32FV_QPI)
+	 * (W25Q64DW, W25Q64FV_QPI)
+	 * (W25Q128FW, W25Q128FV_QPI)
+	 */
 	/*
 	 * TODO:
 	 * ATMEL
 	 * RAMTRON
 	 * SPANSION
 	 * SST
-	 * WINBOND
 	 * non-JEDEC ID's
 	 */
 };
Signature · 1 line
1.8.3
#10 lore raw

PATCH 10/12 sf: probe: Update sector_size for W25* parts

In reply to a message not in the archive

Updated/Corrected the sector_size as per the datasheets.

---
 drivers/mtd/spi/spi_flash_probe.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)
drivers/mtd/spi/spi_flash_probe.c +18 -18
index 1be55b3..3ffc94f 100644
@@ -74,24 +74,24 @@ static const struct {
 	{"N25Q1024A",		0x20bb21, 0x0,    64 * 1024,    2048},
 
 	/* WINBOND */
-	{"W25P80",		0xef2014, 0x0,	  65536,	16},
-	{"W25P16",		0xef2015, 0x0,	  65536,	32},
-	{"W25P32",		0xef2016, 0x0,	  65536,	64},
-	{"W25X40",		0xef3013, 0x0,	  4096,		8},
-	{"W25X16",		0xef3015, 0x0,	  4096,		32},
-	{"W25X32",		0xef3016, 0x0,	  4096,		64},
-	{"W25X64",		0xef3017, 0x0,	  4096,		128},
-	{"W25Q80BL",		0xef4014, 0x0,	  4096,		16},
-	{"W25Q16CL",		0xef4015, 0x0,	  4096,		32},
-	{"W25Q32BV",		0xef4016, 0x0,	  4096,		64},
-	{"W25Q64CV",		0xef4017, 0x0,	  4096,		128},
-	{"W25Q128BV",		0xef4018, 0x0,	  4096,		256},
-	{"W25Q256",		0xef4019, 0x0,	  4096,		512},
-	{"W25Q80BW",		0xef5014, 0x0,	  4096,		16},
-	{"W25Q16DW",		0xef6015, 0x0,	  4096,		32},
-	{"W25Q32DW",		0xef6016, 0x0,	  4096,		64},
-	{"W25Q64DW",		0xef6017, 0x0,	  4096,		128},
-	{"W25Q128FW",		0xef6018, 0x0,	  4096,		256},
+	{"W25P80",		0xef2014, 0x0,	  64 * 1024,	16},
+	{"W25P16",		0xef2015, 0x0,	  64 * 1024,	32},
+	{"W25P32",		0xef2016, 0x0,	  64 * 1024,	64},
+	{"W25X40",		0xef3013, 0x0,	  64 * 1024,	8},
+	{"W25X16",		0xef3015, 0x0,	  64 * 1024,	32},
+	{"W25X32",		0xef3016, 0x0,	  64 * 1024,	64},
+	{"W25X64",		0xef3017, 0x0,	  64 * 1024,	128},
+	{"W25Q80BL",		0xef4014, 0x0,	  64 * 1024,	16},
+	{"W25Q16CL",		0xef4015, 0x0,	  64 * 1024,	32},
+	{"W25Q32BV",		0xef4016, 0x0,	  64 * 1024,	64},
+	{"W25Q64CV",		0xef4017, 0x0,	  64 * 1024,	128},
+	{"W25Q128BV",		0xef4018, 0x0,	  64 * 1024,	256},
+	{"W25Q256",		0xef4019, 0x0,	  64 * 1024,	512},
+	{"W25Q80BW",		0xef5014, 0x0,	  64 * 1024,	16},
+	{"W25Q16DW",		0xef6015, 0x0,	  64 * 1024,	32},
+	{"W25Q32DW",		0xef6016, 0x0,	  64 * 1024,	64},
+	{"W25Q64DW",		0xef6017, 0x0,	  64 * 1024,	128},
+	{"W25Q128FW",		0xef6018, 0x0,	  64 * 1024,	256},
 	/*
 	 * Note:
 	 * Below paired flash devices has similar spi_flash_ids attributes.
Signature · 1 line
1.8.3
#11 lore raw

PATCH 11/12 sf: probe: Add support for S25FL* flash parts

In reply to a message not in the archive

All SPANSION S25FL* flash parts are taken from spi_flash_probe_legacy.c.

---
 drivers/mtd/spi/spi_flash_probe.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)
drivers/mtd/spi/spi_flash_probe.c +22 -4
index 3ffc94f..054c166 100644
@@ -51,6 +51,19 @@ static const struct {
 	{"EN25Q32B",		0x1c3016, 0x0,	  64 * 1024,	64},
 	{"EN25Q128B",		0x1c3018, 0x0,    64 * 1024,	256},
 
+	/* SPANSION */
+	{"S25FL008A",		0x010213, 0x0,	  256 * 256,	16},
+	{"S25FL016A",		0x010214, 0x0,	  256 * 256,	32},
+	{"S25FL032A",		0x010215, 0x0,	  256 * 256,	64},
+	{"S25FL064A",		0x010216, 0x0,	  256 * 256,	128},
+	{"S25FL128P_64K",	0x012018, 0x0301, 256 * 256,	256},
+	{"S25FL128P_256K",	0x012018, 0x0300, 256 * 1024,	64},
+	{"S25FL032P",		0x010215, 0x4d00, 256 * 256,	64},
+	{"S25FL064P",		0x010216, 0x4d00, 256 * 256,	128},
+	{"S25FL128S_64K",	0x012018, 0x4d01, 256 * 256,	256},
+	{"S25FL256S_64K",	0x010219, 0x4d01, 256 * 256,	512},
+	{"S25FL512S_64K",	0x010220, 0x4d01, 256 * 256,	1024},
+
 	/* STMICRO */
 	{"M25P10",		0x202011, 0x0,    32 * 1024,    4},
 	{"M25P20",		0x202012, 0x0,    64 * 1024,    4},
@@ -95,6 +108,7 @@ static const struct {
 	/*
 	 * Note:
 	 * Below paired flash devices has similar spi_flash_ids attributes.
+	 * (S25FL129P_64K, S25FL128S_64K)
 	 * (W25Q80BL, W25Q80BV)
 	 * (W25Q16CL, W25Q16DV)
 	 * (W25Q32BV, W25Q32FV_SPI)
@@ -108,7 +122,6 @@ static const struct {
 	 * TODO:
 	 * ATMEL
 	 * RAMTRON
-	 * SPANSION
 	 * SST
 	 * non-JEDEC ID's
 	 */
@@ -119,18 +132,23 @@ struct spi_flash *spi_flash_validate_ids(struct spi_slave *spi, u8 *idcode)
 	struct spi_flash *flash;
 	int i;
 	u16 jedec = idcode[1] << 8 | idcode[2];
+	u16 ext_jedec = idcode[3] << 8 | idcode[4];
 
 	/* Get the flash id (jedec = manuf_id + dev_id) */
 	for (i = 0; i < ARRAY_SIZE(spi_flash_ids); i++) {
 		if ((spi_flash_ids[i].jedec >> 16) == idcode[0]) {
-			if (((spi_flash_ids[i].jedec << 16) >> 16) == jedec)
+			if (((spi_flash_ids[i].jedec << 16) >> 16) == jedec) {
+				if ((spi_flash_ids[i].ext_jedec != 0x0) &&
+				    (spi_flash_ids[i].ext_jedec == ext_jedec))
+					continue;
 				break;
+			}
 		}
 	}
 
 	if (i == ARRAY_SIZE(spi_flash_ids)) {
-		printf("SF: Unsupported flash ID: manuf %02x, jedec %04x\n",
-		       idcode[0], jedec);
+		printf("SF: Unsupported flash ID: manuf %02x, jedec %04x, "
+		       "ext_jedec %04x\n", idcode[0], jedec, ext_jedec);
 		return NULL;
 	}
 
Signature · 1 line
1.8.3
#12 lore raw

PATCH 12/12 sf: probe: Update sector_size for S25FL* parts

In reply to a message not in the archive

Updated/Corrected the sector_size as per the datasheets.

---
 drivers/mtd/spi/spi_flash_probe.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/mtd/spi/spi_flash_probe.c +10 -10
index 054c166..f265e04 100644
@@ -52,17 +52,17 @@ static const struct {
 	{"EN25Q128B",		0x1c3018, 0x0,    64 * 1024,	256},
 
 	/* SPANSION */
-	{"S25FL008A",		0x010213, 0x0,	  256 * 256,	16},
-	{"S25FL016A",		0x010214, 0x0,	  256 * 256,	32},
-	{"S25FL032A",		0x010215, 0x0,	  256 * 256,	64},
-	{"S25FL064A",		0x010216, 0x0,	  256 * 256,	128},
-	{"S25FL128P_64K",	0x012018, 0x0301, 256 * 256,	256},
+	{"S25FL008A",		0x010213, 0x0,	  64 * 1024,	16},
+	{"S25FL016A",		0x010214, 0x0,	  64 * 1024,	32},
+	{"S25FL032A",		0x010215, 0x0,	  64 * 1024,	64},
+	{"S25FL064A",		0x010216, 0x0,	  64 * 1024,	128},
 	{"S25FL128P_256K",	0x012018, 0x0300, 256 * 1024,	64},
-	{"S25FL032P",		0x010215, 0x4d00, 256 * 256,	64},
-	{"S25FL064P",		0x010216, 0x4d00, 256 * 256,	128},
-	{"S25FL128S_64K",	0x012018, 0x4d01, 256 * 256,	256},
-	{"S25FL256S_64K",	0x010219, 0x4d01, 256 * 256,	512},
-	{"S25FL512S_64K",	0x010220, 0x4d01, 256 * 256,	1024},
+	{"S25FL128P_64K",	0x012018, 0x0301, 64 * 1024,	256},
+	{"S25FL032P",		0x010215, 0x4d00, 64 * 1024,	64},
+	{"S25FL064P",		0x010216, 0x4d00, 64 * 1024,	128},
+	{"S25FL128S_64K",	0x012018, 0x4d01, 64 * 1024,	256},
+	{"S25FL256S_64K",	0x010219, 0x4d01, 64 * 1024,	512},
+	{"S25FL512S_64K",	0x010220, 0x4d01, 64 * 1024,	1024},
 
 	/* STMICRO */
 	{"M25P10",		0x202011, 0x0,    32 * 1024,    4},
Signature · 1 line
1.8.3