提交 66ecb7cd 编写于 作者: M Mike Frysinger 提交者: Wolfgang Denk

sf: unify write disable commands

Every spi flash uses the same write disable command, so unify this in
the common code.
Signed-off-by: NMike Frysinger <vapier@gentoo.org>
Fixed commit message.
Signed-off-by: NWolfgang Denk <wd@denx.de>
上级 fba2c44e
......@@ -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.
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册