Patchwork [U-Boot,RESEND,v2,15/20] sf: probe: Add support for flag status polling

login
register
mail settings
Submitter Jagannadha Sutradharudu Teki
Date Aug. 6, 2013, 4:17 p.m.
Message ID <05b62f13-72ec-49df-b008-b1548f590df3@DB8EHSMHS001.ehs.local>
Download mbox | patch
Permalink /patch/265130/
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Comments

Jagannadha Sutradharudu Teki - Aug. 6, 2013, 4:17 p.m.
From Micron, 512MB onwards, flash requires to poll flag status
instead of read status- hence added E_FSR flag on spectific
flash parts.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
---
Changes for v2:
	- none

 drivers/mtd/spi/spi_flash_probe.c | 14 +++++++++-----
 include/spi_flash.h               |  1 +
 2 files changed, 10 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/mtd/spi/spi_flash_probe.c b/drivers/mtd/spi/spi_flash_probe.c
index 0d005a1..acccee0 100644
--- a/drivers/mtd/spi/spi_flash_probe.c
+++ b/drivers/mtd/spi/spi_flash_probe.c
@@ -94,10 +94,10 @@  static const struct spi_flash_params spi_flash_params_table[] = {
 	{"N25Q128A",	   0x20bb18, 0x0,       64 * 1024,   256,	       SECT_4K},
 	{"N25Q256",	   0x20ba19, 0x0,       64 * 1024,   512,	       SECT_4K},
 	{"N25Q256A",	   0x20bb19, 0x0,       64 * 1024,   512,	       SECT_4K},
-	{"N25Q512",	   0x20ba20, 0x0,       64 * 1024,  1024,	       SECT_4K},
-	{"N25Q512A",	   0x20bb20, 0x0,       64 * 1024,  1024,	       SECT_4K},
-	{"N25Q1024",	   0x20ba21, 0x0,       64 * 1024,  2048,	       SECT_4K},
-	{"N25Q1024A",	   0x20bb21, 0x0,       64 * 1024,  2048,	       SECT_4K},
+	{"N25Q512",	   0x20ba20, 0x0,       64 * 1024,  1024,      E_FSR | SECT_4K},
+	{"N25Q512A",	   0x20bb20, 0x0,       64 * 1024,  1024,      E_FSR | SECT_4K},
+	{"N25Q1024",	   0x20ba21, 0x0,       64 * 1024,  2048,      E_FSR | SECT_4K},
+	{"N25Q1024A",	   0x20bb21, 0x0,       64 * 1024,  2048,      E_FSR | SECT_4K},
 #endif
 #ifdef CONFIG_SPI_FLASH_SST		/* SST */
 	{"SST25VF040B",	   0xbf258d, 0x0,	64 * 1024,     8,     SECT_4K | SST_WP},
@@ -186,7 +186,6 @@  struct spi_flash *spi_flash_validate_ids(struct spi_slave *spi, u8 *idcode)
 
 	flash->spi = spi;
 	flash->name = params->name;
-	flash->poll_cmd = CMD_READ_STATUS;
 
 	/* Assign spi_flash ops */
 	flash->write = spi_flash_cmd_write_multi;
@@ -214,6 +213,11 @@  struct spi_flash *spi_flash_validate_ids(struct spi_slave *spi, u8 *idcode)
 		flash->erase_size = flash->sector_size;
 	}
 
+	/* Poll cmd seclection */
+	flash->poll_cmd = CMD_READ_STATUS;
+	if (params->flags & E_FSR)
+		flash->poll_cmd = CMD_FLAG_STATUS;
+
 	/* Flash powers up read-only, so clear BP# bits */
 	if (((params->jedec >> 16) == SPI_FLASH_CFI_MFR_ATMEL) ||
 	    ((params->jedec >> 16) == SPI_FLASH_CFI_MFR_MACRONIX) ||
diff --git a/include/spi_flash.h b/include/spi_flash.h
index 387af86..3e60fdc 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -25,6 +25,7 @@ 
 /* SECT flags */
 #define SECT_4K			(1 << 0)
 #define SECT_32K		(1 << 1)
+#define E_FSR			(1 << 2)
 
 /* SST specific macros */
 #ifdef CONFIG_SPI_FLASH_SST