From b8117b062266eda6b8ac9a8b60881a99f0323a48 Mon Sep 17 00:00:00 2001 From: Zheng Bao Date: Tue, 27 Nov 2012 18:08:53 +0800 Subject: 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 Signed-off-by: zbao Reviewed-on: http://review.coreboot.org/1919 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Patrick Georgi --- src/drivers/spi/sst.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/drivers') diff --git a/src/drivers/spi/sst.c b/src/drivers/spi/sst.c index 8245f726a7..ebeb441d1e 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 */ @@ -100,6 +101,15 @@ sst_enable_writing(struct spi_flash *flash) 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 sst_disable_writing(struct spi_flash *flash) { @@ -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; -- cgit v1.2.3