[U-Boot] [PATCH v2 05/12] sf: Update Atmel flash params
Bin Meng
bmeng.cn at gmail.com
Sat Nov 1 09:54:18 CET 2014
Explicitly list supported read commands in the flash prarmas table
for Atmel flash parts. 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 157665c..c1b4033 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -101,6 +101,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 SST_WP 0x01 /* Supports AAI word program */
diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c
index d0ead65..6ccb10f 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, 0, SECT_4K},
- {"AT45DB021D", 0x1f2300, 0x0, 64 * 1024, 8, 0, SECT_4K},
- {"AT45DB041D", 0x1f2400, 0x0, 64 * 1024, 8, 0, SECT_4K},
- {"AT45DB081D", 0x1f2500, 0x0, 64 * 1024, 16, 0, SECT_4K},
- {"AT45DB161D", 0x1f2600, 0x0, 64 * 1024, 32, 0, SECT_4K},
- {"AT45DB321D", 0x1f2700, 0x0, 64 * 1024, 64, 0, SECT_4K},
- {"AT45DB641D", 0x1f2800, 0x0, 64 * 1024, 128, 0, SECT_4K},
- {"AT25DF321", 0x1f4701, 0x0, 64 * 1024, 64, 0, SECT_4K},
+ {"AT45DB011D", 0x1f2200, 0x0, 2 * 1024, 64, RD_BASC, 0},
+ {"AT45DB021D", 0x1f2300, 0x0, 2 * 1024, 128, RD_BASC, 0},
+ {"AT45DB041D", 0x1f2400, 0x0, 2 * 1024, 256, RD_BASC, 0},
+ {"AT45DB081D", 0x1f2500, 0x0, 2 * 1024, 512, RD_BASC, 0},
+ {"AT45DB161D", 0x1f2600, 0x0, 4 * 1024, 512, RD_BASC, 0},
+ {"AT45DB321D", 0x1f2700, 0x0, 4 * 1024, 1024, RD_BASC, 0},
+ {"AT45DB641D", 0x1f2800, 0x0, 2 * 1024, 4096, RD_BASC, 0},
+ {"AT25DF321", 0x1f4700, 0x0, 4 * 1024, 1024, RD_BASC, SECT_4K},
+ {"AT25DF321A", 0x1f4701, 0x0, 4 * 1024, 1024, RD_BASC, SECT_4K},
#endif
#ifdef CONFIG_SPI_FLASH_EON /* EON */
{"EN25Q32B", 0x1c3016, 0x0, 64 * 1024, 64, 0, 0},
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index b7ff63f..11e5ee7 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -178,7 +178,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