From nobody Fri Dec 27 02:56:07 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1504271078911686.1023187328768; Fri, 1 Sep 2017 06:04:38 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 486A321D2E62B; Fri, 1 Sep 2017 06:01:46 -0700 (PDT) Received: from mail-lf0-x22d.google.com (mail-lf0-x22d.google.com [IPv6:2a00:1450:4010:c07::22d]) (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 5BA2D21EB88EC for ; Fri, 1 Sep 2017 06:01:44 -0700 (PDT) Received: by mail-lf0-x22d.google.com with SMTP id g18so621872lfl.2 for ; Fri, 01 Sep 2017 06:04:28 -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 m129sm21754lfg.26.2017.09.01.06.04.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 06:04:26 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org 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=dpT/r35YYtFV1X6i+UbdOUlFPyiv567nh8DDi1pM87U=; b=LHWXnmlaiO0XzTsGVXmNH3qcqlA9La/HCwQFHHfZ1865fZAwrQi3TNzv0c5KOcxNrk MRhE5hySgHzr7h8XhXv3+jtvCGJ7FWsZMR4AqfG6k36rnSoGDm31QmZUk0dSDbXSWmrM WfxdcBI5z95vTLNSi01zOJFFY7HteuTUrPSXinfN0kRi/Nyq5qHgbgAu16FZ2SJ38GCX KmFvEtFLZYVXEan9zgIimvLjqHU4EsJzXeRNJrRkvD9wVAjAUYWyXQbQJW8m38vy53FQ gZzaaDpE0UM4BEOPcCFhjPkTexQUsR/CCKuqlwTLaaIhMSNRN2BA8gRTNoIJy4R3YEUP bN2A== 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=dpT/r35YYtFV1X6i+UbdOUlFPyiv567nh8DDi1pM87U=; b=IWLRZtBcnEEKUHqkhO9RbBVQCZIlWcRMAAdKN8SVJgbLkdfFEB2vCtvvU4ZaW10YlD dcErHcBx4TjTid3ZCFAhx3xVjNh+vZAHKZrRa0/gBpzyEZmQsQiCO5GG9YAMyTdmj7fK wL+xqjq8rCL5yjXUY6OaAc9yyK7QDUNH5p83JZJWJDP1UbMpqHCVRZVoUDccYnq3pOOD 7f4t7JAO8Zn4Zb73YsZnXqx8cqI7pnO1Vemtj3ckjlZuR3c+hGMorbj2iETc07+j4ZE2 W+QNXNsJPWD0wr45W0E1j9wqAZ45EtVHvjkN07tqRTpyyl7tjpeAkLU9IJzVZ4nC6ML3 MbrA== X-Gm-Message-State: AHPjjUhXZvd+N4d39A4cS6xC7WSIs2GJZlckOtEer5g6UUqFU2JBEawv m3rv0at3bMLeocnIYFx8NA== X-Google-Smtp-Source: ADKCNb5CkFRRHcqOvdimelEtBDZYbj/w/LCHDnkIhFMFDY7c9iZvEMj4xpvdbvnlZ5drgZYDvZyqiw== X-Received: by 10.25.72.3 with SMTP id v3mr895854lfa.102.1504271066949; Fri, 01 Sep 2017 06:04:26 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Date: Fri, 1 Sep 2017 15:08:16 +0200 Message-Id: <1504271303-1782-5-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1504271303-1782-1-git-send-email-mw@semihalf.com> References: <1504271303-1782-1-git-send-email-mw@semihalf.com> Subject: [edk2] [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: , Cc: jinghua@marvell.com, ard.biesheuvel@linaro.org, agraf@suse.de, leif.lindholm@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 =3D NULL, *FileStr =3D NULL; BOOLEAN AddrFlag =3D FALSE, LengthFlag =3D TRUE, FileFlag = =3D FALSE; UINT8 Flag =3D 0, CheckFlag =3D 0; + UINT8 Mode, Cs; =20 Status =3D gBS->LocateProtocol ( &gMarvellSpiFlashProtocolGuid, @@ -283,8 +284,11 @@ EFI_STATUS Status; } } =20 + Mode =3D PcdGet32 (PcdSpiFlashMode); + Cs =3D PcdGet32 (PcdSpiFlashCs); + // Setup new spi device - Slave =3D SpiMasterProtocol->SetupDevice (SpiMasterProtocol, 0, 0); + Slave =3D SpiMasterProtocol->SetupDevice (SpiMasterProtocol, Cs, Mode); if (Slave =3D=3D NULL) { Print(L"sf: Cannot allocate SPI device!\n"); return SHELL_ABORTED; diff --git a/Platform/Marvell/Applications/SpiTool/SpiFlashCmd.inf b/Platfo= rm/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 @@ =20 [Pcd] gMarvellTokenSpaceGuid.PcdSpiFlashId + gMarvellTokenSpaceGuid.PcdSpiFlashCs + gMarvellTokenSpaceGuid.PcdSpiFlashMode =20 [Protocols] gMarvellSpiFlashProtocolGuid diff --git a/Platform/Marvell/Documentation/PortingGuide.txt b/Platform/Mar= vell/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) ) =20 - - gMarvellTokenSpaceGuid.PcdSpiDefaultMode - (default SCLK mode (see SPI_MODE enum in file OpenPlatformPkg/Drivers/Spi= /MvSpi.h) ) - - SpiFlash configuration =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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) =20 + - 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) =20 MPP configuration =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =20 #ComPhy gMarvellTokenSpaceGuid.PcdComPhyDevices|{ 0x0 }|VOID*|0x30000098 --=20 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel