public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Thomas Abraham <thomas.abraham@arm.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	 Vishwanatha HG <vishwanatha.hg@arm.com>
Subject: Re: [PATCH edk2-platforms v4 2/9] Platform/ARM/Sgi: add NOR flash platform library implementation
Date: Mon, 21 May 2018 10:53:29 +0200	[thread overview]
Message-ID: <CAKv+Gu976O_4bPpBzJWeS2m=_kRvB8q0B2TO22999WE6fgq1KQ@mail.gmail.com> (raw)
In-Reply-To: <1526891152-18739-3-git-send-email-thomas.abraham@arm.com>

On 21 May 2018 at 10:25, Thomas Abraham <thomas.abraham@arm.com> wrote:
> From: Vishwanatha HG <vishwanatha.hg@arm.com>
>
> 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 <vishwanatha.hg@arm.com>
> Signed-off-by: Thomas Abraham <thomas.abraham@arm.com>
> ---
>  .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c   | 66 ++++++++++++++++++++++
>  .../ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf | 34 +++++++++++
>  2 files changed, 100 insertions(+)
>  create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
>  create mode 100644 Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.inf
>
> diff --git a/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.c
> new file mode 100644
> index 0000000..9b4981f
> --- /dev/null
> +++ b/Platform/ARM/SgiPkg/Library/NorFlashLib/NorFlashLib.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 <PiDxe.h>
> +#include <Library/DebugLib.h>
> +#include <Library/IoLib.h>
> +#include <Library/NorFlashPlatformLib.h>
> +#include <SgiPlatform.h>
> +
> +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 } }

Please use consistent whitespace in these GUID definitions.

> +  },
> +};
> +
> +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);

SGI_SYSPH_SYS_REG_FLASH_RWEN?

Should you use MmioOr32() here? (I can't tell, I don't have the docs)

> +  }
> +
> +  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
> --
> 2.7.4
>


  reply	other threads:[~2018-05-21  8:53 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21  8:25 [PATCH edk2-platforms v4 0/9] Platform/ARM/Sgi: Add Arm's SGI platform support Thomas Abraham
2018-05-21  8:25 ` [PATCH edk2-platforms v4 1/9] Platform/ARM/Sgi: Add Platform library implementation Thomas Abraham
2018-05-21  8:50   ` Ard Biesheuvel
2018-05-21  8:25 ` [PATCH edk2-platforms v4 2/9] Platform/ARM/Sgi: add NOR flash platform " Thomas Abraham
2018-05-21  8:53   ` Ard Biesheuvel [this message]
2018-05-23  4:07     ` Thomas Abraham
2018-05-21  8:25 ` [PATCH edk2-platforms v4 3/9] Platform/ARM/Sgi: add initial platform dxe driver implementation Thomas Abraham
2018-05-21  8:55   ` Ard Biesheuvel
2018-05-23  4:08     ` Thomas Abraham
2018-05-21  8:25 ` [PATCH edk2-platforms v4 4/9] Platform/ARM/Sgi: add support for virtio block device Thomas Abraham
2018-05-21  8:58   ` Ard Biesheuvel
2018-05-23  4:09     ` Thomas Abraham
2018-05-21  8:25 ` [PATCH edk2-platforms v4 5/9] Platform/ARM/Sgi: add the initial set of acpi tables Thomas Abraham
2018-05-21  8:48   ` Alexei Fedorov
2018-05-23  4:20     ` Thomas Abraham
2018-05-21  9:06   ` Ard Biesheuvel
2018-05-21 10:09     ` Alexei Fedorov
2018-05-23  4:23     ` Thomas Abraham
2018-05-21  8:25 ` [PATCH edk2-platforms v4 6/9] Platform/ARM/Sgi: add initial support for ARM SGI platform Thomas Abraham
2018-05-21  9:08   ` Ard Biesheuvel
2018-05-21  8:25 ` [PATCH edk2-platforms v4 7/9] Platform/ARM/Sgi: add support for smsc91x ethernet controller Thomas Abraham
2018-05-21  9:09   ` Ard Biesheuvel
2018-05-23  4:11     ` Thomas Abraham
2018-05-21  8:25 ` [PATCH edk2-platforms v4 8/9] Platform/ARM/Sgi: implement PciHostBridgeLib support Thomas Abraham
2018-05-21  9:16   ` Ard Biesheuvel
2018-05-23  4:14     ` Thomas Abraham
2018-05-21  8:25 ` [PATCH edk2-platforms v4 9/9] Platform/ARM/Sgi: Add Ssdt, Iort and Mcfg tables Thomas Abraham
2018-05-21  9:29   ` Ard Biesheuvel
2018-05-23  4:19     ` Thomas Abraham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKv+Gu976O_4bPpBzJWeS2m=_kRvB8q0B2TO22999WE6fgq1KQ@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox