diff options
author | Marcin Wojtas <mw@semihalf.com> | 2017-09-24 16:03:18 +0200 |
---|---|---|
committer | Marcin Wojtas <mw@semihalf.com> | 2017-10-05 16:42:08 +0200 |
commit | 04e44721efc7658ccdc291c80f2f4b73be190383 (patch) | |
tree | a72934c970c72cfa94e4d9149696380b7ce5d303 /Platform | |
parent | 236366b1aeaaf8a72bc032522e028bc2061e757d (diff) | |
download | edk2-platforms-04e44721efc7658ccdc291c80f2f4b73be190383.tar.xz |
Marvell/Applications/SpiTool: Enable configurable CS and SCLK mode
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>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'Platform')
-rw-r--r-- | Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c | 6 | ||||
-rw-r--r-- | Platform/Marvell/Applications/SpiTool/SpiFlashCmd.inf | 2 | ||||
-rw-r--r-- | Platform/Marvell/Marvell.dec | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c b/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.c index 184e3d7f54..b6dc54f53b 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 41b7b7cd85..887b9a5514 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 4e2dd6d6b4..869e376861 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
|