summaryrefslogtreecommitdiff
path: root/Platform/Marvell
diff options
context:
space:
mode:
authorMarcin Wojtas <mw@semihalf.com>2017-06-26 10:39:38 +0200
committerLeif Lindholm <leif.lindholm@linaro.org>2017-11-07 17:20:27 +0000
commit55bf4582aff4ff2d2e155c9650c253134962bbd2 (patch)
tree64bf35613efd525aefb1b67ba7ac9673ee79929d /Platform/Marvell
parentfedad0018dff31e6581875f9039810cc0319c782 (diff)
downloadedk2-platforms-55bf4582aff4ff2d2e155c9650c253134962bbd2.tar.xz
Marvell/Drivers: MvSpiFlash: Fix bank selection for Spansion
Spansion SPI flash devices use different command for bank selection. Update it, basing on the first byte of flash ID. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas <mw@semihalf.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'Platform/Marvell')
-rwxr-xr-xPlatform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c5
-rwxr-xr-xPlatform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c b/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c
index 4a97ba9283..456d9f9bd7 100755
--- a/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c
+++ b/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c
@@ -150,6 +150,11 @@ SpiFlashCmdBankaddrWrite (
{
UINT8 Cmd = CMD_BANK_WRITE;
+ /* Update bank selection command for Spansion */
+ if (Slave->Info->Id[0] == NOR_FLASH_ID_SPANSION) {
+ Cmd = CMD_BANKADDR_BRWR;
+ }
+
MvSpiFlashWriteCommon (Slave, &Cmd, 1, &BankSel, 1);
}
diff --git a/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h b/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h
index 2583484afe..f09ff506b4 100755
--- a/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h
+++ b/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h
@@ -57,6 +57,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define CMD_READ_ARRAY_FAST 0x0b
#define CMD_PAGE_PROGRAM 0x02
#define CMD_BANK_WRITE 0xc5
+#define CMD_BANKADDR_BRWR 0x17
#define CMD_ERASE_4K 0x20
#define CMD_ERASE_32K 0x52
#define CMD_ERASE_64K 0xd8