summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2015-07-01 15:38:12 -0400
committerTom Rini <trini@konsulko.com>2015-07-01 15:38:12 -0400
commit891b487098ee2169a16b1bbb354aaef28aa90630 (patch)
treedac06e8de18355c574eaf47fe29d75873ce0fda6 /drivers/mtd/spi
parent6762ae68887d962e1a4be193672005bdefd3ee32 (diff)
parent8aa5f1d971df0f668144759991e19b5195606a32 (diff)
Merge branch 'master' of git://git.denx.de/u-boot-spi
Diffstat (limited to 'drivers/mtd/spi')
-rw-r--r--drivers/mtd/spi/Kconfig55
-rw-r--r--drivers/mtd/spi/Makefile2
-rw-r--r--drivers/mtd/spi/sf_dataflash.c10
-rw-r--r--drivers/mtd/spi/sf_internal.h18
-rw-r--r--drivers/mtd/spi/sf_params.c2
5 files changed, 58 insertions, 29 deletions
diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
index 40a7981bd5..4f0c040214 100644
--- a/drivers/mtd/spi/Kconfig
+++ b/drivers/mtd/spi/Kconfig
@@ -1,11 +1,4 @@
-config SPI_FLASH
- bool "Enable SPI Flash support"
- help
- Enable the legacy SPI flash support. This will include basic
- standard support for things like probing, read / write, and
- erasing through the MTD layer.
-
- If unsure, say N
+menu "SPI Flash Support"
config DM_SPI_FLASH
bool "Enable Driver Model for SPI flash"
@@ -31,3 +24,49 @@ config SPI_FLASH_SANDBOX
bus (see CONFIG_SANDBOX_SPI) and SPI traffic will be routed to this
device. Typically the contents of the emulated SPI flash device is
stored in a file on the host filesystem.
+
+config SPI_FLASH
+ bool "Legacy SPI Flash Interface support"
+ help
+ Enable the legacy SPI flash support. This will include basic
+ standard support for things like probing, read / write, and
+ erasing through cmd_sf interface.
+
+ If unsure, say N
+
+config SPI_FLASH_BAR
+ bool "SPI flash Bank/Extended address register support"
+ depends on SPI_FLASH
+ help
+ Enable the SPI flash Bank/Extended address register support.
+ Bank/Extended address registers are used to access the flash
+ which has size > 16MiB in 3-byte addressing.
+
+config SPI_FLASH_DATAFLASH
+ bool "AT45xxx DataFlash support"
+ depends on SPI_FLASH && DM_SPI_FLASH
+ help
+ Enable the access for SPI-flash-based AT45xxx DataFlash chips.
+ DataFlash is a kind of SPI flash. Most AT45 chips have two buffers
+ in each chip, which may be used for double buffered I/O; but this
+ driver doesn't (yet) use these for any kind of i/o overlap or prefetching.
+
+ Sometimes DataFlash is packaged in MMC-format cards, although the
+ MMC stack can't (yet?) distinguish between MMC and DataFlash
+ protocols during enumeration.
+
+ If unsure, say N
+
+config SPI_FLASH_MTD
+ bool "SPI Flash MTD support"
+ depends on SPI_FLASH
+ help
+ Enable the MTD support for spi flash layer, this adapter is for
+ translating mtd_read/mtd_write commands into spi_flash_read/write
+ commands. It is not intended to use it within sf_cmd or the SPI
+ flash subsystem. Such an adapter is needed for subsystems like
+ UBI which can only operate on top of the MTD layer.
+
+ If unsure, say N
+
+endmenu # menu "SPI Flash Support"
diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
index ed46648aa3..ff48b25f6f 100644
--- a/drivers/mtd/spi/Makefile
+++ b/drivers/mtd/spi/Makefile
@@ -15,9 +15,9 @@ endif
#ifndef CONFIG_DM_SPI
obj-$(CONFIG_SPI_FLASH) += sf_probe.o
#endif
-obj-$(CONFIG_SF_DATAFLASH) += sf_dataflash.o
obj-$(CONFIG_CMD_SF) += sf.o
obj-$(CONFIG_SPI_FLASH) += sf_ops.o sf_params.o
+obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o
obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
obj-$(CONFIG_SPI_M95XXX) += eeprom_m95xxx.o
diff --git a/drivers/mtd/spi/sf_dataflash.c b/drivers/mtd/spi/sf_dataflash.c
index d287db8b4c..3111f4fd12 100644
--- a/drivers/mtd/spi/sf_dataflash.c
+++ b/drivers/mtd/spi/sf_dataflash.c
@@ -19,16 +19,6 @@
#include "sf_internal.h"
-/*
- * DataFlash is a kind of SPI flash. Most AT45 chips have two buffers in
- * each chip, which may be used for double buffered I/O; but this driver
- * doesn't (yet) use these for any kind of i/o overlap or prefetching.
- *
- * Sometimes DataFlash is packaged in MMC-format cards, although the
- * MMC stack can't (yet?) distinguish between MMC and DataFlash
- * protocols during enumeration.
- */
-
/* reads can bypass the buffers */
#define OP_READ_CONTINUOUS 0xE8
#define OP_READ_PAGE 0xD2
diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 81eea8ce9d..9fb555707c 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -31,9 +31,9 @@ enum spi_read_cmds {
};
/* Normal - Extended - Full command set */
-#define RD_NORM (ARRAY_SLOW | ARRAY_FAST)
-#define RD_EXTN (RD_NORM | DUAL_OUTPUT_FAST | DUAL_IO_FAST)
-#define RD_FULL (RD_EXTN | QUAD_OUTPUT_FAST | QUAD_IO_FAST)
+#define RD_NORM (ARRAY_SLOW | ARRAY_FAST)
+#define RD_EXTN (RD_NORM | DUAL_OUTPUT_FAST | DUAL_IO_FAST)
+#define RD_FULL (RD_EXTN | QUAD_OUTPUT_FAST | QUAD_IO_FAST)
/* sf param flags */
enum {
@@ -67,12 +67,12 @@ enum {
#define CMD_WRITE_STATUS 0x01
#define CMD_PAGE_PROGRAM 0x02
#define CMD_WRITE_DISABLE 0x04
-#define CMD_READ_STATUS 0x05
+#define CMD_READ_STATUS 0x05
#define CMD_QUAD_PAGE_PROGRAM 0x32
#define CMD_READ_STATUS1 0x35
#define CMD_WRITE_ENABLE 0x06
-#define CMD_READ_CONFIG 0x35
-#define CMD_FLAG_STATUS 0x70
+#define CMD_READ_CONFIG 0x35
+#define CMD_FLAG_STATUS 0x70
/* Read commands */
#define CMD_READ_ARRAY_SLOW 0x03
@@ -99,13 +99,13 @@ enum {
/* Flash timeout values */
#define SPI_FLASH_PROG_TIMEOUT (2 * CONFIG_SYS_HZ)
-#define SPI_FLASH_PAGE_ERASE_TIMEOUT (5 * CONFIG_SYS_HZ)
+#define SPI_FLASH_PAGE_ERASE_TIMEOUT (5 * CONFIG_SYS_HZ)
#define SPI_FLASH_SECTOR_ERASE_TIMEOUT (10 * CONFIG_SYS_HZ)
/* SST specific */
#ifdef CONFIG_SPI_FLASH_SST
# define CMD_SST_BP 0x02 /* Byte Program */
-# define CMD_SST_AAI_WP 0xAD /* Auto Address Incr Word Program */
+# define CMD_SST_AAI_WP 0xAD /* Auto Address Incr Word Program */
int sst_write_wp(struct spi_flash *flash, u32 offset, size_t len,
const void *buf);
@@ -121,7 +121,7 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, size_t len,
* @ext_jedec: Device ext_jedec ID
* @sector_size: Isn't necessarily a sector size from vendor,
* the size listed here is what works with CMD_ERASE_64K
- * @nr_sectors: No.of sectors on this device
+ * @nr_sectors: No.of sectors on this device
* @e_rd_cmd: Enum list for read commands
* @flags: Important param, for flash specific behaviour
*/
diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c
index c12e8c6fe7..4a4a3afc92 100644
--- a/drivers/mtd/spi/sf_params.c
+++ b/drivers/mtd/spi/sf_params.c
@@ -100,7 +100,7 @@ const struct spi_flash_params spi_flash_params_table[] = {
{"SST25WF010", 0xbf2502, 0x0, 64 * 1024, 2, RD_NORM, SECT_4K | SST_WR},
{"SST25WF020", 0xbf2503, 0x0, 64 * 1024, 4, RD_NORM, SECT_4K | SST_WR},
{"SST25WF040", 0xbf2504, 0x0, 64 * 1024, 8, RD_NORM, SECT_4K | SST_WR},
- {"SST25WF040B", 0x621613, 0x0, 64 * 1024, 8, RD_NORM, SECT_4K | SST_WR},
+ {"SST25WF040B", 0x621613, 0x0, 64 * 1024, 8, RD_NORM, SECT_4K},
{"SST25WF080", 0xbf2505, 0x0, 64 * 1024, 16, RD_NORM, SECT_4K | SST_WR},
#endif
#ifdef CONFIG_SPI_FLASH_WINBOND /* WINBOND */