public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 edk-platforms 3/4] Platform/Hisilicon/HiKey: add gpio platform driver
@ 2018-03-08 13:30 Haojian Zhuang
  2018-05-02 15:24 ` Leif Lindholm
  0 siblings, 1 reply; 3+ messages in thread
From: Haojian Zhuang @ 2018-03-08 13:30 UTC (permalink / raw)
  To: edk2-devel; +Cc: Leif Lindholm, Ard Biesheuvel

Add gpio platform driver to enable GPIO in HiKey platform.

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf | 36 +++++++++++
 Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c   | 68 ++++++++++++++++++++
 2 files changed, 104 insertions(+)

diff --git a/Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf b/Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf
new file mode 100644
index 000000000000..272ed1c0cea2
--- /dev/null
+++ b/Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf
@@ -0,0 +1,36 @@
+#
+#  Copyright (c) 2018, Linaro. 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                    = 0x00010019
+  BASE_NAME                      = HiKeyGpio
+  FILE_GUID                      = b51a851c-7bf7-463f-b261-cfb158b7f699
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = HiKeyGpioEntryPoint
+
+[Sources.common]
+  HiKeyGpioDxe.c
+
+[Packages]
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  DebugLib
+  UefiDriverEntryPoint
+
+[Protocols]
+  gPlatformGpioProtocolGuid
+
+[Depex]
+  TRUE
diff --git a/Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c b/Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c
new file mode 100644
index 000000000000..543f65d7b12d
--- /dev/null
+++ b/Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c
@@ -0,0 +1,68 @@
+/** @file
+*
+*  Copyright (c) 2018, Linaro. 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 <Library/UefiBootServicesTableLib.h>
+
+#include <Protocol/EmbeddedGpio.h>
+
+GPIO_CONTROLLER gGpioDevice[]= {
+  { 0xf8011000, 0, 8 },    // GPIO0
+  { 0xf8012000, 8, 8 },    // GPIO1
+  { 0xf8013000, 16, 8 },   // GPIO2
+  { 0xf8014000, 24, 8 },   // GPIO3
+  { 0xf7020000, 32, 8 },   // GPIO4
+  { 0xf7021000, 40, 8 },   // GPIO5
+  { 0xf7022000, 48, 8 },   // GPIO6
+  { 0xf7023000, 56, 8 },   // GPIO7
+  { 0xf7024000, 64, 8 },   // GPIO8
+  { 0xf7025000, 72, 8 },   // GPIO9
+  { 0xf7026000, 80, 8 },   // GPIO10
+  { 0xf7027000, 88, 8 },   // GPIO11
+  { 0xf7028000, 96, 8 },   // GPIO12
+  { 0xf7029000, 104, 8 },  // GPIO13
+  { 0xf702a000, 112, 8 },  // GPIO14
+  { 0xf702b000, 120, 8 },  // GPIO15
+  { 0xf702c000, 128, 8 },  // GPIO16
+  { 0xf702d000, 136, 8 },  // GPIO17
+  { 0xf702e000, 144, 8 },  // GPIO18
+  { 0xf702f000, 152, 8 }   // GPIO19
+};
+
+PLATFORM_GPIO_CONTROLLER gPlatformGpioDevice = {
+  160, 20, gGpioDevice
+};
+
+EFI_STATUS
+EFIAPI
+HiKeyGpioEntryPoint (
+  IN EFI_HANDLE         ImageHandle,
+  IN EFI_SYSTEM_TABLE   *SystemTable
+  )
+{
+  EFI_STATUS  Status;
+  EFI_HANDLE  Handle;
+
+  // Install the Embedded Platform GPIO Protocol onto a new handle
+  Handle = NULL;
+  Status = gBS->InstallMultipleProtocolInterfaces(
+                  &Handle,
+                  &gPlatformGpioProtocolGuid, &gPlatformGpioDevice,
+                  NULL
+                 );
+  if (EFI_ERROR(Status)) {
+    Status = EFI_OUT_OF_RESOURCES;
+  }
+
+  return Status;
+}
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH v2 edk-platforms 0/4] enable virtual keyboards on hikey
@ 2018-03-08 13:35 Haojian Zhuang
  2018-03-08 13:35 ` [PATCH v2 edk-platforms 3/4] Platform/Hisilicon/HiKey: add gpio platform driver Haojian Zhuang
  0 siblings, 1 reply; 3+ messages in thread
From: Haojian Zhuang @ 2018-03-08 13:35 UTC (permalink / raw)
  To: edk2-devel; +Cc: Haojian Zhuang

Changelog:
v2:
  * Remove VirtualKeyboardDxe.dec from INF files.

Haojian Zhuang (4):
  Platform/Hisilicon/HiKey960: add gpio platform driver
  Platform/Hisilicon/HiKey960: enable virtual keyboard
  Platform/Hisilicon/HiKey: add gpio platform driver
  Platform/Hisilicon/HiKey: enable virtual keyboard

 Platform/Hisilicon/HiKey/HiKey.dsc                              |   8 +
 Platform/Hisilicon/HiKey960/HiKey960.dsc                        |  11 +
 Platform/Hisilicon/HiKey/HiKey.fdf                              |   8 +
 Platform/Hisilicon/HiKey960/HiKey960.fdf                        |   8 +
 Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf                  |  57 +++
 Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf          |  36 ++
 Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf         |  54 +++
 Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf |  35 ++
 Silicon/Hisilicon/Hi3660/Include/Hi3660.h                       | 147 ++++++
 Silicon/Hisilicon/Hi3660/Include/Hkadc.h                        |  66 +++
 Silicon/Hisilicon/Hi6220/Include/Hi6220RegsPeri.h               |  48 ++
 Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c                    | 229 +++++++++
 Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c            |  68 +++
 Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c           | 491 ++++++++++++++++++++
 Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c   |  77 +++
 15 files changed, 1343 insertions(+)
 create mode 100644 Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
 create mode 100644 Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf
 create mode 100644 Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
 create mode 100644 Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
 create mode 100644 Silicon/Hisilicon/Hi3660/Include/Hi3660.h
 create mode 100644 Silicon/Hisilicon/Hi3660/Include/Hkadc.h
 create mode 100644 Silicon/Hisilicon/Hi6220/Include/Hi6220RegsPeri.h
 create mode 100644 Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c
 create mode 100644 Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c
 create mode 100644 Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
 create mode 100644 Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c

-- 
2.7.4



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-02 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-08 13:30 [PATCH v2 edk-platforms 3/4] Platform/Hisilicon/HiKey: add gpio platform driver Haojian Zhuang
2018-05-02 15:24 ` Leif Lindholm
  -- strict thread matches above, loose matches on Subject: below --
2018-03-08 13:35 [PATCH v2 edk-platforms 0/4] enable virtual keyboards on hikey Haojian Zhuang
2018-03-08 13:35 ` [PATCH v2 edk-platforms 3/4] Platform/Hisilicon/HiKey: add gpio platform driver Haojian Zhuang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox