public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michael Trimarchi <michael@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] sf: Disable 4-KB erase command for SPANSION S25FS128
Date: Wed, 22 Jun 2016 09:58:32 +0200	[thread overview]
Message-ID: <20160622075827.GA11818@panicking> (raw)

The S25FS128 is part of S25FS-S family physical sectors may be
configured as a hybrid combination of eight 4-kB parameter sectors
at the top or bottom of the address space with all but one of the
remaining sectors being uniform size. This rework a bit commit

80c1bfd2332e71dfe669cac53ba06b7435a7ca39

and add this jedec part number

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/mtd/spi/spi_flash.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 64d4e0f..c993588 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -972,6 +972,21 @@ int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash)
 #endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
 
 #ifdef CONFIG_SPI_FLASH_SPANSION
+
+inline int is_spansion_s25fss_family(u16 jedec, u16 ext_jedec)
+{
+	switch (jedec) {
+	case 0x0219:
+	case 0x0220:
+	case 0x2018:
+		if ((ext_jedec & 0xff00) == 0x4d00)
+			return 1;
+	default:;
+	}
+
+	return 0;
+}
+
 static int spansion_s25fss_disable_4KB_erase(struct spi_slave *spi)
 {
 	u8 cmd[4];
@@ -1072,8 +1087,7 @@ int spi_flash_scan(struct spi_flash *flash)
 	 * sector that is not overlaid by the parameter sectors.
 	 * The uniform sector erase command has no effect on parameter sectors.
 	 */
-	if ((jedec == 0x0219 || (jedec == 0x0220)) &&
-	    (ext_jedec & 0xff00) == 0x4d00) {
+	if (is_spansion_s25fss_family(jedec, ext_jedec)) {
 		int ret;
 		u8 id[6];
 
-- 
2.9.0

             reply	other threads:[~2016-06-22  7:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22  7:58 Michael Trimarchi [this message]
2016-06-22 10:00 ` [U-Boot] [PATCH] sf: Disable 4-KB erase command for SPANSION S25FS128 Yao Yuan
2016-06-22 10:06   ` Michael Trimarchi
2016-06-22 10:14     ` Yao Yuan
2016-06-22 10:55       ` [U-Boot] Booting imx7d from qspi using spansion flash (WAS Re: [PATCH] sf: Disable 4-KB erase command for SPANSION S25FS128) Michael Trimarchi
2016-08-06 14:37       ` [U-Boot] [PATCH] sf: Disable 4-KB erase command for SPANSION S25FS128 Jagan Teki
2016-08-06 14:40         ` Michael Trimarchi
2016-08-06 15:08           ` Jagan Teki
2016-08-06 15:14             ` Michael Trimarchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160622075827.GA11818@panicking \
    --to=michael@amarulasolutions.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox