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, agraf@suse.de, mw@semihalf.com,
	jsd@semihalf.com
Subject: [platforms: PATCH 04/11] Applications/SpiTool: Enable configurable CS and SCLK mode
Date: Fri,  1 Sep 2017 15:08:16 +0200	[thread overview]
Message-ID: <1504271303-1782-5-git-send-email-mw@semihalf.com> (raw)
In-Reply-To: <1504271303-1782-1-git-send-email-mw@semihalf.com>

Until now transfer SCLK mode and CS were fixed, when using
shell 'sf' command. This patch enables their configuration.
Update porting guide accordingly.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
 Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c   | 6 +++++-
 Platform/Marvell/Applications/SpiTool/SpiFlashCmd.inf | 2 ++
 Platform/Marvell/Documentation/PortingGuide.txt       | 9 +++++----
 Platform/Marvell/Marvell.dec                          | 2 ++
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c b/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c
index 184e3d7..b6dc54f 100644
--- a/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c
+++ b/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c
@@ -218,6 +218,7 @@ EFI_STATUS              Status;
   CONST CHAR16          *LengthStr = NULL, *FileStr = NULL;
   BOOLEAN               AddrFlag = FALSE, LengthFlag = TRUE, FileFlag = FALSE;
   UINT8                 Flag = 0, CheckFlag = 0;
+  UINT8                 Mode, Cs;
 
   Status = gBS->LocateProtocol (
     &gMarvellSpiFlashProtocolGuid,
@@ -283,8 +284,11 @@ EFI_STATUS              Status;
     }
   }
 
+  Mode = PcdGet32 (PcdSpiFlashMode);
+  Cs = PcdGet32 (PcdSpiFlashCs);
+
   // Setup new spi device
-  Slave = SpiMasterProtocol->SetupDevice (SpiMasterProtocol, 0, 0);
+  Slave = SpiMasterProtocol->SetupDevice (SpiMasterProtocol, Cs, Mode);
     if (Slave == NULL) {
       Print(L"sf: Cannot allocate SPI device!\n");
       return SHELL_ABORTED;
diff --git a/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.inf b/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.inf
index 41b7b7c..c1ab770 100644
--- a/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.inf
+++ b/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.inf
@@ -66,6 +66,8 @@
 
 [Pcd]
  gMarvellTokenSpaceGuid.PcdSpiFlashId
+ gMarvellTokenSpaceGuid.PcdSpiFlashCs
+ gMarvellTokenSpaceGuid.PcdSpiFlashMode
 
 [Protocols]
  gMarvellSpiFlashProtocolGuid
diff --git a/Platform/Marvell/Documentation/PortingGuide.txt b/Platform/Marvell/Documentation/PortingGuide.txt
index 8c3579e..3b79bd2 100644
--- a/Platform/Marvell/Documentation/PortingGuide.txt
+++ b/Platform/Marvell/Documentation/PortingGuide.txt
@@ -284,10 +284,6 @@ Following PCDs are available for configuration of spi driver:
   - gMarvellTokenSpaceGuid.PcdSpiMaxFrequency
 	(Max SCLK line frequency (in Hz) (max transfer frequency) )
 
-  - gMarvellTokenSpaceGuid.PcdSpiDefaultMode
-	(default SCLK mode (see SPI_MODE enum in file OpenPlatformPkg/Drivers/Spi/MvSpi.h) )
-
-
 SpiFlash configuration
 ======================
 Folowing PCDs for spi flash driver configuration must be set properly:
@@ -307,6 +303,11 @@ Folowing PCDs for spi flash driver configuration must be set properly:
   - gMarvellTokenSpaceGuid.PcdSpiFlashPollCmd
 	(Spi flash polling flag)
 
+  - gMarvellTokenSpaceGuid.PcdSpiFlashMode
+	(Default SCLK mode (see SPI_MODE enum in file OpenPlatformPkg/Drivers/Spi/MvSpi.h))
+
+  - gMarvellTokenSpaceGuid.PcdSpiFlashCs
+	(Chip select used for communication with the Flash)
 
 MPP configuration
 =================
diff --git a/Platform/Marvell/Marvell.dec b/Platform/Marvell/Marvell.dec
index 4e2dd6d..869e376 100644
--- a/Platform/Marvell/Marvell.dec
+++ b/Platform/Marvell/Marvell.dec
@@ -128,6 +128,8 @@
   gMarvellTokenSpaceGuid.PcdSpiFlashEraseSize|0|UINT64|0x3000054
   gMarvellTokenSpaceGuid.PcdSpiFlashPageSize|0|UINT32|0x3000055
   gMarvellTokenSpaceGuid.PcdSpiFlashId|0|UINT32|0x3000056
+  gMarvellTokenSpaceGuid.PcdSpiFlashCs|0|UINT32|0x3000057
+  gMarvellTokenSpaceGuid.PcdSpiFlashMode|0|UINT32|0x3000058
 
 #ComPhy
   gMarvellTokenSpaceGuid.PcdComPhyDevices|{ 0x0 }|VOID*|0x30000098
-- 
1.8.3.1



  parent reply	other threads:[~2017-09-01 13:01 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01 13:08 [platforms: PATCH 00/11] Armada 70x0/80x0 SPI improvements Marcin Wojtas
2017-09-01 13:08 ` [platforms: PATCH 01/11] Platform/Marvell/Documentation: Refactor PortingGuide Marcin Wojtas
2017-09-01 14:36   ` Leif Lindholm
2017-09-01 15:08     ` Marcin Wojtas
2017-09-01 15:45       ` Leif Lindholm
2017-09-01 15:56         ` Marcin Wojtas
2017-09-01 13:08 ` [platforms: PATCH 02/11] Drivers/Spi/MvSpiDxe: Log and return correct error Marcin Wojtas
2017-09-01 14:05   ` Ard Biesheuvel
2017-09-01 13:08 ` [platforms: PATCH 03/11] Drivers/Spi/MvSpiDxe: Fix write bug Marcin Wojtas
2017-09-01 14:44   ` Leif Lindholm
2017-09-01 13:08 ` Marcin Wojtas [this message]
2017-09-01 14:47   ` [platforms: PATCH 04/11] Applications/SpiTool: Enable configurable CS and SCLK mode Leif Lindholm
2017-09-01 13:08 ` [platforms: PATCH 05/11] Platform/Marvell/Armada70x0: set CS and SCLK Mode for SPI flash Marcin Wojtas
2017-09-01 14:48   ` Leif Lindholm
2017-09-01 13:08 ` [platforms: PATCH 06/11] Applications/SpiTool: Fix bug in error test Marcin Wojtas
2017-09-01 14:48   ` Leif Lindholm
2017-09-01 13:08 ` [platforms: PATCH 07/11] Applications/FirmwareUpdate: Fix 32-bit issues Marcin Wojtas
2017-09-01 14:54   ` Leif Lindholm
2017-09-01 15:16     ` Ard Biesheuvel
2017-09-01 15:51       ` Leif Lindholm
2017-09-01 13:08 ` [platforms: PATCH 08/11] Applications/SpiTool: " Marcin Wojtas
2017-09-01 14:56   ` Leif Lindholm
2017-09-01 13:08 ` [platforms: PATCH 09/11] Drivers/Spi/Devices/MvSpiFlash: Fix usage of erase size parameter Marcin Wojtas
2017-09-01 15:21   ` Leif Lindholm
2017-09-01 15:25     ` Marcin Wojtas
2017-09-01 15:51       ` Leif Lindholm
2017-09-01 13:08 ` [platforms: PATCH 10/11] Drivers/Spi/Devices/MvSpiFlash: Enable dynamic SPI Flash detection Marcin Wojtas
2017-09-01 15:33   ` Leif Lindholm
2017-09-01 17:20     ` Marcin Wojtas
2017-09-01 22:03       ` Leif Lindholm
2017-09-01 13:08 ` [platforms: PATCH 11/11] Drivers/Spi/Devices/MvSpiFlash: Fix bank selection for Spansion Marcin Wojtas
2017-09-01 15:34   ` 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=1504271303-1782-5-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