From patchwork Wed May 23 05:45:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Abraham X-Patchwork-Id: 136620 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp467948lji; Tue, 22 May 2018 22:45:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrU2HFgdpp359qf9dIglzfGliI20O1fW/iHW5pHocR0MlA87veel+RtkbIz8mw8e9oscvdT X-Received: by 2002:a17:902:aa83:: with SMTP id d3-v6mr1548768plr.323.1527054356216; Tue, 22 May 2018 22:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527054356; cv=none; d=google.com; s=arc-20160816; b=ZGW9cry1G/Izowr6rCzJoM8KEgfXrwZZPqWa5ngnIg3yGDo4SJaJ+tlzkbPfaz6/EZ y441i5sSaSuGo+acT0oI/74RaCFZOmTlOsAFiHp7Ux7TbISLDPwMcxvZIUJwo7eiiGIK mf+o/TLlCf0cebElM+sTcgFBF+BdQnfrR7pyVrhwf6V6I7nGl/Fu4NkeruWUs9eNH2RP APJ27zz1hfV30+/GVVHuxZZPOnyMDsoCd3+Cpo1mO0OC6jSv+o5dj5i+533rX9LAKu+0 i8ObaYiQ7OIUfApyh9colVU39nNV/FxHKZybdMrLh4b3fogzui3bg60bs6SG+G37jJDI 3NMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=PZU++PMVGoc2V9tZLKeCr/J8RUHNIUrWLsNCF7Zs2Ks=; b=LW4lD3OSkqMJpDoPrSfW2TESr7oCHfzMPdQE3ARqXx3z0Dd6BZJj47FEXIrmhxaLmc JKkaJyfbqJqmZNWt01HwIrltjilZJiVovlZVl61yw5XkR8jfsZX0xIkyEfmElIqx5xDB UGm9wsIY33xrnrEloE7Pq0Lg2TUbqSZLL5X7bBDiKlB3sOfxnv9zKsXMJ6Nj7TRrHcJT 3OSLOWTS5AgXMRG6oFy+WMPz0AnxCr40pCspa4PGVhiiQG+4j8P2yiZCKtlhxaplN0zf J0bsk0EKHZmqCb4QfD0/8xoLGPYaKuUyFmxvYdd//PTFHllTfEuthMxSQFE+kpvRV6zb Bhug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id e184-v6si14433348pgc.475.2018.05.22.22.45.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 22:45:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 536E9207E36D7; Tue, 22 May 2018 22:45:54 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=thomas.abraham@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 444C5207E36D4 for ; Tue, 22 May 2018 22:45:53 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1923480D; Tue, 22 May 2018 22:45:53 -0700 (PDT) Received: from usa.arm.com (a74716-lin.blr.arm.com [10.162.4.145]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F048B3F25D; Tue, 22 May 2018 22:45:51 -0700 (PDT) From: Thomas Abraham To: edk2-devel@lists.01.org Date: Wed, 23 May 2018 11:15:36 +0530 Message-Id: <1527054343-2125-3-git-send-email-thomas.abraham@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527054343-2125-1-git-send-email-thomas.abraham@arm.com> References: <1527054343-2125-1-git-send-email-thomas.abraham@arm.com> Subject: [edk2] [PATCH edk2-platforms v6 2/9] Platform/ARM/Sgi: add NOR flash platform library implementation X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" From: Vishwanatha HG Add a initial NOR flash driver platform wrapper as part of the platform library. Access to NOR flash devices connected to CS0 and CS1 is enabled in this initial implementation. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Vishwanatha HG Signed-off-by: Thomas Abraham --- .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c | 63 ++++++++++++++++++++++ .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf | 34 ++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c new file mode 100644 index 0000000..3ab296a --- /dev/null +++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c @@ -0,0 +1,63 @@ +/** @file + + Copyright (c) 2018, ARM Ltd. All rights reserved. + + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + **/ + +#include +#include +#include +#include +#include + +STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { + { + SGI_EXP_SMC_CS0_BASE, + SGI_EXP_SMC_CS0_BASE, + SIZE_256KB * 256, + SIZE_256KB, + { 0xEBF0B9DF, 0x17d0, 0x4812, { 0xA9, 0x59, 0xCF, 0xD7, 0x92, 0xEE, 0x31, 0x13 } } + }, + { + SGI_EXP_SMC_CS1_BASE, + SGI_EXP_SMC_CS1_BASE, + SIZE_256KB * 256, + SIZE_256KB, + { 0x1F15DA3C, 0x37FF, 0x4070, { 0xB4, 0x71, 0xBB, 0x4A, 0xF1, 0x2A, 0x72, 0x4A } } + }, +}; + +EFI_STATUS +NorFlashPlatformInitialization ( + VOID + ) +{ + UINT64 SysRegFlash; + + SysRegFlash = SGI_EXP_SYSPH_SYSTEM_REGISTERS + SGI_SYSPH_SYS_REG_FLASH; + MmioOr32 (SysRegFlash, SGI_SYSPH_SYS_REG_FLASH_RWEN); + return EFI_SUCCESS; +} + +EFI_STATUS +NorFlashPlatformGetDevices ( + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices, + OUT UINT32 *Count + ) +{ + if ((NorFlashDevices == NULL) || (Count == NULL)) { + return EFI_INVALID_PARAMETER; + } + + *NorFlashDevices = mNorFlashDevices; + *Count = ARRAY_SIZE (mNorFlashDevices); + return EFI_SUCCESS; +} diff --git a/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf new file mode 100644 index 0000000..3a6b33b --- /dev/null +++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf @@ -0,0 +1,34 @@ +#/** @file +# +# Copyright (c) 2018, ARM Ltd. All rights reserved. + +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#**/ + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = NorFlashSgiLib + FILE_GUID = 3f021755-6d74-4065-9ee4-98225267b36e + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = NorFlashPlatformLib + +[Sources.common] + NorFlashLib.c + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Platform/ARM/SgiPkg/SgiPlatform.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib