public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Marcin Wojtas <mw@semihalf.com>
To: edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org,
	nadavh@marvell.com, neta@marvell.com, kostap@marvell.com,
	jinghua@marvell.com, mw@semihalf.com, jsd@semihalf.com
Subject: [platforms: PATCH 5/6] Marvell/Drivers: MvSpiFlash: Fix bank selection for Spansion
Date: Tue, 31 Oct 2017 04:59:34 +0100	[thread overview]
Message-ID: <1509422375-20198-6-git-send-email-mw@semihalf.com> (raw)
In-Reply-To: <1509422375-20198-1-git-send-email-mw@semihalf.com>

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>
---
 Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c | 5 +++++
 Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c b/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c
index 703994c..a00fc305 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] == SPI_FLASH_MFR_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 2583484..00af188 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
@@ -72,6 +73,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #define SPI_FLASH_16MB_BOUN             0x1000000
 
+/* Manufacturer ID's */
+#define SPI_FLASH_MFR_SPANSION          0x01
+
 typedef enum {
   SPI_FLASH_READ_ID,
   SPI_FLASH_READ, // Read from SPI flash with address
-- 
2.7.4



  parent reply	other threads:[~2017-10-31  3:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31  3:59 [platforms: PATCH 0/6] Armada 7k/8k SPI improvements pt 2 Marcin Wojtas
2017-10-31  3:59 ` [platforms: PATCH 1/6] Marvell/Drivers: MvSpiFlash: Improve ReadId Marcin Wojtas
2017-10-31  9:07   ` Leif Lindholm
2017-10-31  9:22     ` Marcin Wojtas
2017-11-01  3:14       ` Leif Lindholm
2017-11-01 16:28         ` Marcin Wojtas
2017-10-31  3:59 ` [platforms: PATCH 2/6] Marvell/Drivers: MvSpiFlash: Enable dynamic SPI Flash detection Marcin Wojtas
2017-11-01  3:25   ` Leif Lindholm
2017-11-01 16:35     ` Marcin Wojtas
2017-10-31  3:59 ` [platforms: PATCH 3/6] Marvell/Drivers: MvSpiFlash: Remove duplicated macros Marcin Wojtas
2017-11-01  3:27   ` Leif Lindholm
2017-11-01 16:36     ` Marcin Wojtas
2017-10-31  3:59 ` [platforms: PATCH 4/6] Marvell/Applications: SpiTool: Do not override existing slave device Marcin Wojtas
2017-11-01  3:45   ` Leif Lindholm
2017-11-01 16:40     ` Marcin Wojtas
2017-11-01 17:15       ` Ard Biesheuvel
2017-10-31  3:59 ` Marcin Wojtas [this message]
2017-11-01  3:50   ` [platforms: PATCH 5/6] Marvell/Drivers: MvSpiFlash: Fix bank selection for Spansion Leif Lindholm
2017-11-01 16:41     ` Marcin Wojtas
2017-10-31  3:59 ` [platforms: PATCH 6/6] Marvell/Drivers: MvSpiDxe: Keep data in SPI_DEVICE structure Marcin Wojtas
2017-11-01  3:54   ` Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1509422375-20198-6-git-send-email-mw@semihalf.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox