[U-Boot] [PATCH v3 2/9] sf: Update Atmel flash params

Bin Meng bmeng.cn at gmail.com
Wed Dec 10 13:51:25 CET 2014


Update flash sector size to 4KiB as long as flash supports sector
erase (20h) command. Correct AT25DF321 JEDEC ID and bulk erase
command to 50h instead of D8h. Also add AT25DF321A params per
datasheet.

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
---

 drivers/mtd/spi/sf_internal.h |  5 +++++
 drivers/mtd/spi/sf_params.c   | 17 +++++++++--------
 drivers/mtd/spi/sf_probe.c    |  4 ++++
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 785f7a9..8010fc5 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -106,6 +106,11 @@ enum {
 #define SPI_FLASH_PAGE_ERASE_TIMEOUT		(5 * CONFIG_SYS_HZ)
 #define SPI_FLASH_SECTOR_ERASE_TIMEOUT	(10 * CONFIG_SYS_HZ)
 
+/* Atmel specific */
+#ifdef CONFIG_SPI_FLASH_ATMEL
+# define CMD_ATMEL_BLK_ERASE	0x50
+#endif
+
 /* SST specific */
 #ifdef CONFIG_SPI_FLASH_SST
 # define CMD_SST_BP		0x02    /* Byte Program */
diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c
index 5482700..cc4cd60 100644
--- a/drivers/mtd/spi/sf_params.c
+++ b/drivers/mtd/spi/sf_params.c
@@ -15,14 +15,15 @@
 /* SPI/QSPI flash device params structure */
 const struct spi_flash_params spi_flash_params_table[] = {
 #ifdef CONFIG_SPI_FLASH_ATMEL		/* ATMEL */
-	{"AT45DB011D",	   0x1f2200, 0x0,	64 * 1024,     4, RD_NORM,		    SECT_4K},
-	{"AT45DB021D",	   0x1f2300, 0x0,	64 * 1024,     8, RD_NORM,		    SECT_4K},
-	{"AT45DB041D",	   0x1f2400, 0x0,	64 * 1024,     8, RD_NORM,		    SECT_4K},
-	{"AT45DB081D",	   0x1f2500, 0x0,	64 * 1024,    16, RD_NORM,		    SECT_4K},
-	{"AT45DB161D",	   0x1f2600, 0x0,	64 * 1024,    32, RD_NORM,		    SECT_4K},
-	{"AT45DB321D",	   0x1f2700, 0x0,	64 * 1024,    64, RD_NORM,		    SECT_4K},
-	{"AT45DB641D",	   0x1f2800, 0x0,	64 * 1024,   128, RD_NORM,		    SECT_4K},
-	{"AT25DF321",      0x1f4701, 0x0,	64 * 1024,    64, RD_NORM,		    SECT_4K},
+	{"AT45DB011D",	   0x1f2200, 0x0,	 2 * 1024,    64, RD_NORM,		          0},
+	{"AT45DB021D",	   0x1f2300, 0x0,	 2 * 1024,   128, RD_NORM,		          0},
+	{"AT45DB041D",	   0x1f2400, 0x0,	 2 * 1024,   256, RD_NORM,		          0},
+	{"AT45DB081D",	   0x1f2500, 0x0,	 2 * 1024,   512, RD_NORM,		          0},
+	{"AT45DB161D",	   0x1f2600, 0x0,	 4 * 1024,   512, RD_NORM,		          0},
+	{"AT45DB321D",	   0x1f2700, 0x0,	 4 * 1024,  1024, RD_NORM,		          0},
+	{"AT45DB641D",	   0x1f2800, 0x0,	 2 * 1024,  4096, RD_NORM,		          0},
+	{"AT25DF321",      0x1f4700, 0x0,	 4 * 1024,  1024, RD_NORM,		    SECT_4K},
+	{"AT25DF321A",     0x1f4701, 0x0,	 4 * 1024,  1024, RD_NORM,		    SECT_4K},
 #endif
 #ifdef CONFIG_SPI_FLASH_EON		/* EON */
 	{"EN25Q32B",	   0x1c3016, 0x0,	64 * 1024,    64, RD_NORM,			  0},
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index ce9987f..13fda44 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -179,7 +179,11 @@ static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode,
 		flash->erase_cmd = CMD_ERASE_32K;
 		flash->erase_size = 32768 << flash->shift;
 	} else {
+#ifdef CONFIG_SPI_FLASH_ATMEL
+		flash->erase_cmd = CMD_ATMEL_BLK_ERASE;
+#else
 		flash->erase_cmd = CMD_ERASE_64K;
+#endif
 		flash->erase_size = flash->sector_size;
 	}
 
-- 
1.8.2.1



More information about the U-Boot mailing list