From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:400c:c0c::235; helo=mail-wr0-x235.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com [IPv6:2a00:1450:400c:c0c::235]) (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 B7CCA20945B97 for ; Sun, 24 Sep 2017 18:42:56 -0700 (PDT) Received: by mail-wr0-x235.google.com with SMTP id o42so5214207wrb.3 for ; Sun, 24 Sep 2017 18:46:07 -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=6ez1chFyWGPdQHjnS9+SHPS9EYc5nWsONZk4QGL9Tfc=; b=WypGc4Ybb7g6CmP3DIXN0kqnvQynw0GDJ5up6tOnwAgMlxwO5ErvJUT9KFJUR+PqGJ NsKBjmF1ez1gv0466o9cbXyECpyh9gU67HkrtYqD+HxSvWSvQ4xrnvyzmr2r2cYWKSwC mwhpt+3yFEn6wrAPArOxgarQjP8UAyN/s9RPIOACWkfNV0PCZ24piMeD+WcaCrPlW1fC q1gq8BMJhNmlsbpGoMIlgQsK3yn0peGXa5un7oTLYF2n6QqGN/cnUuJbuBhzGv+zcSZb OqSj8E3IB8Iq4u+2Ku53JRWEZnonJCK/achHtQjj1uqIrz2dyAa7qV/+LWiAYZ6QnwZW N7Cg== 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=6ez1chFyWGPdQHjnS9+SHPS9EYc5nWsONZk4QGL9Tfc=; b=D3QLhXafT4BoT1AIRUoLmb4r+phG9gq/++SrNUBdqBDpPm3KA/ONGZu3HMeQE4xopi qMZtmrevgPV8bqB7ZqpU9v+/U9FYgn4UTmvEFatZDOwTA4lvQ7J1ujGc03SJnfDF07jt nl7akXX/YHbcRRqOY4a7vzIe5v46jZhddn21fSwbBiFwSuDiJd9cKP0X1gllGnzX6MDw QWXx+aSPBeGWUvHo+mO2x/CizVjldRs+iH+/VOClj2f10yEN9jI9lzQc242FCp2qaJ2A xs/9OIikY7a+hZsJDKonCWRwiS/KQLNLLEdNSMUcZ7hRUpzg2P2v+TDGTHNtsCKHYTgd vLXw== X-Gm-Message-State: AHPjjUiNA8TiHLOSvzKTaZckdwGaYPzuvBMB6vZH/z3LkNN1BFIfayYn k/7iOa5PtygFAX7yNpnOF956useKzQo= X-Google-Smtp-Source: AOwi7QCX1qTfiuJ1PPyDndWQFIBbJLSnlSamLzYMDruEf3qg4v5MQT1arQ5so4KnHTjVmm4vNo0aiA== X-Received: by 10.25.142.215 with SMTP id a84mr1952447lfl.25.1506303965944; Sun, 24 Sep 2017 18:46:05 -0700 (PDT) Received: from enkidu.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id f16sm809520lfe.66.2017.09.24.18.46.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Sep 2017 18:46:05 -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, agraf@suse.de, mw@semihalf.com, jsd@semihalf.com Date: Mon, 25 Sep 2017 03:51:53 +0200 Message-Id: <1506304319-8620-5-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1506304319-8620-1-git-send-email-mw@semihalf.com> References: <1506304319-8620-1-git-send-email-mw@semihalf.com> Subject: [platforms: PATCH 04/10] Marvell/Applications/SpiTool: Enable configurable CS and SCLK mode 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: Mon, 25 Sep 2017 01:42:57 -0000 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 --- 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