spi_flash_ids.c is more meaningful name as the flash_info
table structure spi_flash_info has spi_flash_ids instance.
Cc: Simon Glass
Cc: Bin Meng
Cc: York Sun
Cc: Vignesh R
Cc: Mugunthan V N
Cc: Michal Simek
Cc: Siva Durga Prasad Paladugu
Signed-off-by: Jagan Teki
---
drivers/mtd/spi/Makefile| 2 +-
drivers/mtd/spi/spi_flash_ids.c | 176
2 files changed, 177 insertions(+), 1 deletion(-)
create mode 100644 drivers/mtd/spi/spi_flash_ids.c
diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
index f3dc409..fcda023 100644
--- a/drivers/mtd/spi/Makefile
+++ b/drivers/mtd/spi/Makefile
@@ -12,7 +12,7 @@ obj-$(CONFIG_SPL_SPI_BOOT)+= fsl_espi_spl.o
obj-$(CONFIG_SPL_SPI_SUNXI)+= sunxi_spi_spl.o
endif
-obj-$(CONFIG_SPI_FLASH) += sf_probe.o spi_flash.o sf_params.o sf.o
+obj-$(CONFIG_SPI_FLASH) += sf_probe.o spi_flash.o spi_flash_ids.o sf.o
obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o
obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
diff --git a/drivers/mtd/spi/spi_flash_ids.c b/drivers/mtd/spi/spi_flash_ids.c
new file mode 100644
index 000..3648608
--- /dev/null
+++ b/drivers/mtd/spi/spi_flash_ids.c
@@ -0,0 +1,176 @@
+/*
+ * SPI Flash ID's.
+ *
+ * Copyright (C) 2016 Jagan Teki
+ * Copyright (C) 2013 Jagannadha Sutradharudu Teki, Xilinx Inc.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include "sf_internal.h"
+
+/* Used when the "_ext_id" is two bytes at most */
+#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \
+ .id = { \
+ ((_jedec_id) >> 16) & 0xff, \
+ ((_jedec_id) >> 8) & 0xff, \
+ (_jedec_id) & 0xff, \
+ ((_ext_id) >> 8) & 0xff,\
+ (_ext_id) & 0xff, \
+ }, \
+ .id_len = (!(_jedec_id) ? 0 : (3 + ((_ext_id) ? 2 : 0))),
\
+ .sector_size = (_sector_size), \
+ .n_sectors = (_n_sectors), \
+ .page_size = 256, \
+ .flags = (_flags),
+
+#define INFO6(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)\
+ .id = { \
+ ((_jedec_id) >> 16) & 0xff, \
+ ((_jedec_id) >> 8) & 0xff, \
+ (_jedec_id) & 0xff, \
+ ((_ext_id) >> 16) & 0xff, \
+ ((_ext_id) >> 8) & 0xff,\
+ (_ext_id) & 0xff, \
+ }, \
+ .id_len = 6,\
+ .sector_size = (_sector_size), \
+ .n_sectors = (_n_sectors), \
+ .page_size = 256, \
+ .flags = (_flags),
+
+const struct spi_flash_info spi_flash_ids[] = {
+#ifdef CONFIG_SPI_FLASH_ATMEL /* ATMEL */
+ {"AT45DB011D", INFO(0x1f2200, 0x0, 64 * 1024, 4, SECT_4K) },
+ {"AT45DB021D", INFO(0x1f2300, 0x0, 64 * 1024, 8, SECT_4K) },
+ {"AT45DB041D", INFO(0x1f2400, 0x0, 64 * 1024, 8, SECT_4K) },
+ {"AT45DB081D", INFO(0x1f2500, 0x0, 64 * 1024,16, SECT_4K) },
+ {"AT45DB161D", INFO(0x1f2600, 0x0, 64 * 1024,32, SECT_4K) },
+ {"AT45DB321D", INFO(0x1f2700, 0x0, 64 * 1024,64, SECT_4K) },
+ {"AT45DB641D", INFO(0x1f2800, 0x0, 64 * 1024, 128, SECT_4K) },
+ {"AT25DF321A", INFO(0x1f4701, 0x0, 64 * 1024,64, SECT_4K) },
+ {"AT25DF321", INFO(0x1f4700, 0x0, 64 * 1024,64, SECT_4K) },
+ {"AT26DF081A", INFO(0x1f4501, 0x0, 64 * 1024,16, SECT_4K) },
+#endif
+#ifdef CONFIG_SPI_FLASH_EON/* EON */
+ {"EN25Q32B", INFO(0x1c3016, 0x0, 64 * 1024,64, 0) },
+ {"EN25Q64",INFO(0x1c3017, 0x0, 64 * 1024, 128, SECT_4K) },
+ {"EN25Q128B", INFO(0x1c3018, 0x0, 64 * 1024, 256, 0) },
+ {"EN25S64",INFO(0x1c3817, 0x0, 64 * 1024, 128, 0) },
+#endif
+#ifdef CONFIG_SPI_FLASH_GIGADEVICE /* GIGADEVICE */
+ {"GD25Q64B", INFO(0xc84017, 0x0, 64 * 1024, 128, SECT_4K) },
+