From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4010:c07::243; helo=mail-lf0-x243.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 08A8C202E5E70 for ; Fri, 3 Nov 2017 10:53:38 -0700 (PDT) Received: by mail-lf0-x243.google.com with SMTP id w21so4064086lfc.6 for ; Fri, 03 Nov 2017 10:57:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WBAZ7p8GvIMHhYUJbATgoQurxwgGRZPPImZqi0oww+Q=; b=oE3zpOCrdVJio2ePyaKlHBShHL/978hYDr3q/Vm+X+I5y1yj5KuAA2z6+WZq7Mipgl IlQOPJeoKoB2CupFbqvtYvpb+gX1rDMxkyVCzCf+GxqEFEJtNovKprwecCPh23GF2Gat aZkyRf6yJYZ468gtzR5K8cssomCs1VmDAUbQzszI36tfw07XUPg7c2dqsUOrBMLqxgZd XydOuuHNQz8VSgxdMH5QsnE7vIqC8AHWH29m2WT7TQ54SOODvCLzgkOtZBnYElOWmA48 rUbFg/JeNLWBp+Wxc5WXYsiJ1HHJig/yJ6unVAbL0GNWMkaonnyvwgPTqLeWtGJncm10 QXuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WBAZ7p8GvIMHhYUJbATgoQurxwgGRZPPImZqi0oww+Q=; b=qFiASNA9A3nd45YuNak1uNtpIiQ8xaAT9LA70K+gOlFaPWQk7F7PxLIJdhz5wty3er ew1Yy/eQ3xarnaKusBBryvoyH7LZQzc8JvkM3DRwwi+QaWSFT8evRPDsrrNXzlE18isi gddBaBX6gw1dePSoMuSB8W7sk2HulejHD/c/q/O+KT59uc+mhvugtd+Ga5rMsEOL7yri aGqZS1MiFaqiasckt4mQj1RlrN/XvQu/S1er/eefdQtqJWunD17/DD2xfX+jrrlS0cxg 02ITmN9XjNRBhbOe+tWbSj/s0uzEXXCP3DvwBRRD6vL2VE5xCpZO2SGpf4SLSoDRghuS 73hA== X-Gm-Message-State: AMCzsaUxBNofA82BrVVBzlM18Npcp6kauAbXVzJWWmAul5El6++2bOeE hN5RJW47QUSupS3pFdq7VaqmKh+xVkw= X-Google-Smtp-Source: ABhQp+RRWaMYrqIXPNjkVydhWKNBllQcTWzBO7NjbqM1ixhappcJfX01a+t0+JRsoygAZ4RKWjvHBQ== X-Received: by 10.46.4.85 with SMTP id 82mr3392478lje.4.1509731852479; Fri, 03 Nov 2017 10:57:32 -0700 (PDT) Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id g29sm1120441lfh.3.2017.11.03.10.57.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Nov 2017 10:57:31 -0700 (PDT) From: Marcin Wojtas 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 Date: Fri, 3 Nov 2017 18:57:14 +0100 Message-Id: <1509731835-5664-6-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509731835-5664-1-git-send-email-mw@semihalf.com> References: <1509731835-5664-1-git-send-email-mw@semihalf.com> Subject: [platforms: PATCH v2 5/6] Marvell/Drivers: MvSpiFlash: Fix bank selection for Spansion X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Nov 2017 17:53:39 -0000 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 --- Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c | 5 +++++ Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c b/Platform/Marvell/Drivers/Spi/Devices/MvSpiFlash.c index 4a97ba9..456d9f9 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 2583484..f09ff50 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 -- 2.7.4