diff options
author | Zheng Bao <fishbaozi@gmail.com> | 2012-11-27 18:08:53 +0800 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2012-11-27 11:03:52 +0100 |
commit | b8117b062266eda6b8ac9a8b60881a99f0323a48 (patch) | |
tree | c89c3f217e8e6c93a468876600e2993fe5ae3af0 /src/drivers/spi/sst.c | |
parent | 1a5301dd3373e7def334fc34787f79073f49029a (diff) | |
download | coreboot-b8117b062266eda6b8ac9a8b60881a99f0323a48.tar.gz coreboot-b8117b062266eda6b8ac9a8b60881a99f0323a48.tar.bz2 coreboot-b8117b062266eda6b8ac9a8b60881a99f0323a48.zip |
SPI/SST: Add OpCode Enable-Write-Status-Register (EWSR)
For SST chips, the Write-Status-Register instruction must be
executed immediately after the execution of the
Enable-Write-Status-Register instruction, instead of Write-Enable.
Change-Id: I4b3473cd671829def3bd1641ececcf8d9dad4a56
Signed-off-by: Zheng Bao <zheng.bao@amd.com>
Signed-off-by: zbao <fishbaozi@gmail.com>
Reviewed-on: http://review.coreboot.org/1919
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'src/drivers/spi/sst.c')
-rw-r--r-- | src/drivers/spi/sst.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/drivers/spi/sst.c b/src/drivers/spi/sst.c index 8245f726a77b..ebeb441d1e29 100644 --- a/src/drivers/spi/sst.c +++ b/src/drivers/spi/sst.c @@ -20,6 +20,7 @@ #define CMD_SST_WRDI 0x04 /* Write Disable */ #define CMD_SST_RDSR 0x05 /* Read Status Register */ #define CMD_SST_WRSR 0x01 /* Write Status Register */ +#define CMD_SST_EWSR 0x50 /* Enable Write Status Register */ #define CMD_SST_READ 0x03 /* Read Data Bytes */ #define CMD_SST_FAST_READ 0x0b /* Read Data Bytes at Higher Speed */ #define CMD_SST_BP 0x02 /* Byte Program */ @@ -101,6 +102,15 @@ sst_enable_writing(struct spi_flash *flash) } static int +sst_enable_writing_status(struct spi_flash *flash) +{ + int ret = spi_flash_cmd(flash->spi, CMD_SST_EWSR, NULL, 0); + if (ret) + printk(BIOS_WARNING, "SF: Enabling Write Status failed\n"); + return ret; +} + +static int sst_disable_writing(struct spi_flash *flash) { int ret = spi_flash_cmd(flash->spi, CMD_SST_WRDI, NULL, 0); @@ -212,7 +222,7 @@ sst_unlock(struct spi_flash *flash) int ret; u8 cmd, status; - ret = sst_enable_writing(flash); + ret = sst_enable_writing_status(flash); if (ret) return ret; |