summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-04-25 06:59:53 +0000
committerWolfgang Denk <wd@denx.de>2011-07-26 16:32:15 +0200
commit66ecb7cdb03d451ddc87bc026050f5a539877bf1 (patch)
treef70b0f37d867f5354bfc36ba4ec89a536f3a27fb /drivers/mtd
parentfba2c44e464a610f293ff1a381a16e8442953dd3 (diff)
downloadu-boot-imx-66ecb7cdb03d451ddc87bc026050f5a539877bf1.zip
u-boot-imx-66ecb7cdb03d451ddc87bc026050f5a539877bf1.tar.gz
u-boot-imx-66ecb7cdb03d451ddc87bc026050f5a539877bf1.tar.bz2
sf: unify write disable commands
Every spi flash uses the same write disable command, so unify this in the common code. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Fixed commit message. Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/spi/spi_flash_internal.h9
-rw-r--r--drivers/mtd/spi/sst.c2
2 files changed, 10 insertions, 1 deletions
diff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h
index f80f717..91e036a 100644
--- a/drivers/mtd/spi/spi_flash_internal.h
+++ b/drivers/mtd/spi/spi_flash_internal.h
@@ -20,6 +20,7 @@
#define CMD_READ_ARRAY_LEGACY 0xe8
#define CMD_PAGE_PROGRAM 0x02
+#define CMD_WRITE_DISABLE 0x04
#define CMD_READ_STATUS 0x05
#define CMD_WRITE_ENABLE 0x06
@@ -62,6 +63,14 @@ static inline int spi_flash_cmd_write_enable(struct spi_flash *flash)
}
/*
+ * Disable writing on the SPI flash.
+ */
+static inline int spi_flash_cmd_write_disable(struct spi_flash *flash)
+{
+ return spi_flash_cmd(flash->spi, CMD_WRITE_DISABLE, NULL, 0);
+}
+
+/*
* Same as spi_flash_cmd_read() except it also claims/releases the SPI
* bus. Used as common part of the ->read() operation.
*/
diff --git a/drivers/mtd/spi/sst.c b/drivers/mtd/spi/sst.c
index 6691c1d..d1e8a93 100644
--- a/drivers/mtd/spi/sst.c
+++ b/drivers/mtd/spi/sst.c
@@ -105,7 +105,7 @@ sst_enable_writing(struct spi_flash *flash)
static int
sst_disable_writing(struct spi_flash *flash)
{
- int ret = spi_flash_cmd(flash->spi, CMD_SST_WRDI, NULL, 0);
+ int ret = spi_flash_cmd_write_disable(flash);
if (ret)
debug("SF: Disabling Write failed\n");
return ret;