From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (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 3171E21EB88ED for ; Fri, 1 Sep 2017 07:44:41 -0700 (PDT) Received: by mail-wm0-x234.google.com with SMTP id u26so2857626wma.0 for ; Fri, 01 Sep 2017 07:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=L552oY2lXEUKwCVwU5/5Ach9zxmW8TlsIIdptokPtJQ=; b=DrB1de3yieiGI0NYW9V+Kx/xQPvuwUvUsdJPMMGVTx0SQH2q6rgMDz3SheR6mD2Qwd QkwBbnzuGn7Mo1QL+4jdwnWiemO+SZJ6ep5IJCyrwe7BpQLo2SblE8gOzkL9j7oNarfV c6KZxPrwOfiIbkwbQUJbPlWQOoBevTT0mdm3M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=L552oY2lXEUKwCVwU5/5Ach9zxmW8TlsIIdptokPtJQ=; b=RW/TVD049qRB/xhu17G1/R+Ge0XNIEj/QWRkydxRA4xOfueUb7N5lDbqIpSAWU99+I p+xRWxi3jaw8/eidNV/kndJmGCgvIvkqUR/0pNn7UYR72UzvCpKCDE8NX9O2EUPMOReK /Lwer+95q7LQw+TY1jO4ocNUcgRd8LzSACoi/RfGoCT97VPvW9RIhFhAlIS1XAfYb5vi PVywV0K2opkv4UI2RFKodDKfwDGeiXs2fCI9TRaHr8zuXJyjQBefyLwl8jP8hBFhlU+Z REq4j6Tms3gRWsq+27CGFeSqtCEzHLKJ+M+Bo021FnbBz3jY3d2ymv0bS/JXutl8rgNh IX9Q== X-Gm-Message-State: AHPjjUgUSt9KS8a7z22OhDdUeGPmjCO+EakXbnR07/GKXYklHjBvxynY Wv+JU4Sq6c5rM+rn X-Google-Smtp-Source: ADKCNb69Cnx7Zz8zkZ/mDXfSAKKeoU8JZKlVETutD3cquu58rnw1ysegpGiZ1LVEe8iz9tgxanXxBQ== X-Received: by 10.28.19.210 with SMTP id 201mr583222wmt.171.1504277244306; Fri, 01 Sep 2017 07:47:24 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id b125sm195261wma.28.2017.09.01.07.47.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2017 07:47:23 -0700 (PDT) Date: Fri, 1 Sep 2017 15:47:21 +0100 From: Leif Lindholm To: Marcin Wojtas Cc: edk2-devel@lists.01.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com, jinghua@marvell.com, agraf@suse.de, jsd@semihalf.com Message-ID: <20170901144721.rjq7t7zuvrxtfem3@bivouac.eciton.net> References: <1504271303-1782-1-git-send-email-mw@semihalf.com> <1504271303-1782-5-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1504271303-1782-5-git-send-email-mw@semihalf.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [platforms: PATCH 04/11] 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: Fri, 01 Sep 2017 14:44:41 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Sep 01, 2017 at 03:08:16PM +0200, Marcin Wojtas wrote: > 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/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 Alphabetically sorted, please. > > [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 >