From patchwork Wed May 9 08:50:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Abraham X-Patchwork-Id: 135223 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp5374266lji; Wed, 9 May 2018 01:50:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqPqE4Vga0v1VU/M10qyz/BC3SBTb3Er3dQGR7h3DKrh/NUYQcOK9gi4rJy0Mmuh1ooZ539 X-Received: by 2002:a17:902:aa98:: with SMTP id d24-v6mr19226254plr.185.1525855831470; Wed, 09 May 2018 01:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525855831; cv=none; d=google.com; s=arc-20160816; b=qf5tIDDu78Sqp+j2K0XSbrj8woW6y5llfHQmW9cW274B9EAFwPILABgmfovxBsFm+v YnkTNiSLX6J2bUvly2SQxvStWNKMOs+XWkL0bf+qNaXJ+EVbEdUaM0aL7s5cy6fcelFr C5XgH6aOAjYKsa8QD3vVCC1GQ5CipFWsyg2jfMoStqUtTaqKXzLNEPZj//jWdC+eLsFx tK1wFQRdgTTQqUjZFOff+z/DxDuQFT7cKOD0tbXl9Qh+eQu5+yA0hL0AodIAhzhKV5x9 SrEf2HUaASJJswgVIv11PonOWZhujSUxlQRYdFNJAVpR9Yrja4wb8+P4cD770UNAmD0J J/SA== 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=ijotDkbr8309s1bWfYp4neMiT9Nkya7+KcQtcJkhrfw=; b=zRIbzL62tGcKntUx3C3zmWgM7DT64J/wiQzg/59zLpuOkk7e0bNior2tJKvQTFv3vi kBOdwMxWeI2/SrHfwXIaIcJr/neQ79rmMUw5vtHGqDnKSqe2nxjfodJq0vzUvLcClt9u EJ9xQAa/e14W6DDwWPNWSTnvm+M3QAkBR3HcuqIZChOROdYTOARNuLJjPi/B/5xkQU23 Eq0sHTciQMM+Re6rnpg4nzmkvRnwdOyIzn7oNzC/1T+rPtTW1gMydw50U64HtT9GWuIa Rvnu22gBI8RTPx17MwXJhsE8ekzn25jgy5hIEdNQ6VUCxW4luUIZg1sBtkLoSCTBU3vT UUig== 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 t22-v6si1053716pgo.686.2018.05.09.01.50.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 01:50:31 -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 70B11203B85B4; Wed, 9 May 2018 01:50:28 -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 B4B9B203B85A9 for ; Wed, 9 May 2018 01:50:27 -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 895DF1529; Wed, 9 May 2018 01:50:27 -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 6DB1A3F318; Wed, 9 May 2018 01:50:26 -0700 (PDT) From: Thomas Abraham To: edk2-devel@lists.01.org Date: Wed, 9 May 2018 14:20:07 +0530 Message-Id: <1525855811-10208-3-git-send-email-thomas.abraham@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525855811-10208-1-git-send-email-thomas.abraham@arm.com> References: <1525855811-10208-1-git-send-email-thomas.abraham@arm.com> Subject: [edk2] [PATCH edk2-platforms v3 2/6] 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 --- Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlash.c | 66 ++++++++++++++++++++++ .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf | 34 +++++++++++ 2 files changed, 100 insertions(+) create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlash.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/NorFlash.c b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlash.c new file mode 100644 index 0000000..9b4981f --- /dev/null +++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlash.c @@ -0,0 +1,66 @@ +/** @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; + if ((MmioRead32 (SysRegFlash) & SGI_SYSPH_SYS_REG_FLASH_RWEN) == 0) { + MmioWrite32 (SysRegFlash, 1); + } + + 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..4db2fd8 --- /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] + NorFlash.c + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Platform/ARM/SgiPkg/SgiPlatform.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib