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>
This commit is contained in:
Zheng Bao 2012-11-27 18:08:53 +08:00 committed by Patrick Georgi
parent 1a5301dd33
commit b8117b0622
1 changed files with 11 additions and 1 deletions

View File

@ -20,6 +20,7 @@
#define CMD_SST_WRDI 0x04 /* Write Disable */ #define CMD_SST_WRDI 0x04 /* Write Disable */
#define CMD_SST_RDSR 0x05 /* Read Status Register */ #define CMD_SST_RDSR 0x05 /* Read Status Register */
#define CMD_SST_WRSR 0x01 /* Write 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_READ 0x03 /* Read Data Bytes */
#define CMD_SST_FAST_READ 0x0b /* Read Data Bytes at Higher Speed */ #define CMD_SST_FAST_READ 0x0b /* Read Data Bytes at Higher Speed */
#define CMD_SST_BP 0x02 /* Byte Program */ #define CMD_SST_BP 0x02 /* Byte Program */
@ -100,6 +101,15 @@ sst_enable_writing(struct spi_flash *flash)
return ret; return ret;
} }
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 static int
sst_disable_writing(struct spi_flash *flash) sst_disable_writing(struct spi_flash *flash)
{ {
@ -212,7 +222,7 @@ sst_unlock(struct spi_flash *flash)
int ret; int ret;
u8 cmd, status; u8 cmd, status;
ret = sst_enable_writing(flash); ret = sst_enable_writing_status(flash);
if (ret) if (ret)
return ret; return ret;