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/Marvell.dec | 2 ++
Silicon/Marvell/Documentation/PortingGuide.txt | 11 ++++++-----
4 files changed, 15 insertions(+), 6 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..887b9a5 100644
--- a/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.inf
+++ b/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.inf
@@ -65,7 +65,9 @@
FileHandleLib
[Pcd]
+ gMarvellTokenSpaceGuid.PcdSpiFlashCs
gMarvellTokenSpaceGuid.PcdSpiFlashId
+ gMarvellTokenSpaceGuid.PcdSpiFlashMode
[Protocols]
gMarvellSpiFlashProtocolGuid
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
diff --git a/Silicon/Marvell/Documentation/PortingGuide.txt b/Silicon/Marvell/Documentation/PortingGuide.txt
index aa53329..2be658e 100644
--- a/Silicon/Marvell/Documentation/PortingGuide.txt
+++ b/Silicon/Marvell/Documentation/PortingGuide.txt
@@ -285,11 +285,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
- edk2-platforms/Platform/Marvell/Drivers/Spi/MvSpi.h) )
-
-
SpiFlash configuration
======================
Folowing PCDs for spi flash driver configuration must be set properly:
@@ -309,6 +304,12 @@ 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
+ edk2-platforms/Platform/Marvell/Drivers/Spi/MvSpi.h))
+
+ - gMarvellTokenSpaceGuid.PcdSpiFlashCs
+ (Chip select used for communication with the Flash)
MPP configuration
=================
--
1.8.3.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel