]> git.sur5r.net Git - u-boot/commitdiff
sf: unify write disable commands
authorMike Frysinger <vapier@gentoo.org>
Mon, 25 Apr 2011 06:59:53 +0000 (06:59 +0000)
committerWolfgang Denk <wd@denx.de>
Tue, 26 Jul 2011 14:32:15 +0000 (16:32 +0200)
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>
drivers/mtd/spi/spi_flash_internal.h
drivers/mtd/spi/sst.c

index f80f71771c1f91a10825413fb82475a61e144dd8..91e036a4e7cb54abb608613ad7c8475f07e8033c 100644 (file)
@@ -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
 
@@ -61,6 +62,14 @@ static inline int spi_flash_cmd_write_enable(struct spi_flash *flash)
        return spi_flash_cmd(flash->spi, CMD_WRITE_ENABLE, NULL, 0);
 }
 
+/*
+ * 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.
index 6691c1de8d48a0043e6f1e707912219d050c2ade..d1e8a931e68e4bd428340a7d4f5e63df36ed6029 100644 (file)
@@ -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;