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

Add gpio platform driver to enable GPIO in HiKey960 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/HiKey960/HiKey960.dsc                        |  1 +
 Platform/Hisilicon/HiKey960/HiKey960.fdf                        |  1 +
 Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf | 35 +++++++++
 Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c   | 77 ++++++++++++++++++++
 4 files changed, 114 insertions(+)

diff --git a/Platform/Hisilicon/HiKey960/HiKey960.dsc b/Platform/Hisilicon/HiKey960/HiKey960.dsc
index 36f43956ab40..3da1b8556321 100644
--- a/Platform/Hisilicon/HiKey960/HiKey960.dsc
+++ b/Platform/Hisilicon/HiKey960/HiKey960.dsc
@@ -179,6 +179,7 @@ [Components.common]
   #
   # GPIO
   #
+  Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
   ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
 
   #
diff --git a/Platform/Hisilicon/HiKey960/HiKey960.fdf b/Platform/Hisilicon/HiKey960/HiKey960.fdf
index 655032a36c53..162dbaaf2646 100644
--- a/Platform/Hisilicon/HiKey960/HiKey960.fdf
+++ b/Platform/Hisilicon/HiKey960/HiKey960.fdf
@@ -120,6 +120,7 @@ [FV.FvMain]
   #
   # GPIO
   #
+  INF Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
   INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
 
   #
diff --git a/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
new file mode 100644
index 000000000000..a16213f02520
--- /dev/null
+++ b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
@@ -0,0 +1,35 @@
+#
+#  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                      = HiKey960GpioDxe
+  FILE_GUID                      = 6aa12592-7e36-4aec-acf8-2ac2fd13815c
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = HiKey960GpioEntryPoint
+
+[Sources]
+  HiKey960GpioDxe.c
+
+[Packages]
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  UefiDriverEntryPoint
+
+[Protocols]
+  gPlatformGpioProtocolGuid
+
+[Depex]
+  TRUE
diff --git a/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c
new file mode 100644
index 000000000000..986feceea564
--- /dev/null
+++ b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c
@@ -0,0 +1,77 @@
+/** @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[]= {
+  { 0xe8a0b000, 0, 8 },    // GPIO0
+  { 0xe8a0c000, 8, 8 },    // GPIO1
+  { 0xe8a0d000, 16, 8 },   // GPIO2
+  { 0xe8a0e000, 24, 8 },   // GPIO3
+  { 0xe8a0f000, 32, 8 },   // GPIO4
+  { 0xe8a10000, 40, 8 },   // GPIO5
+  { 0xe8a11000, 48, 8 },   // GPIO6
+  { 0xe8a12000, 56, 8 },   // GPIO7
+  { 0xe8a13000, 64, 8 },   // GPIO8
+  { 0xe8a14000, 72, 8 },   // GPIO9
+  { 0xe8a15000, 80, 8 },   // GPIO10
+  { 0xe8a16000, 88, 8 },   // GPIO11
+  { 0xe8a17000, 96, 8 },   // GPIO12
+  { 0xe8a18000, 104, 8 },  // GPIO13
+  { 0xe8a19000, 112, 8 },  // GPIO14
+  { 0xe8a1a000, 120, 8 },  // GPIO15
+  { 0xe8a1b000, 128, 8 },  // GPIO16
+  { 0xe8a1c000, 136, 8 },  // GPIO17
+  { 0xff3b4000, 144, 8 },  // GPIO18
+  { 0xff3b5000, 152, 8 },  // GPIO19
+  { 0xe8a1f000, 160, 8 },  // GPIO20
+  { 0xe8a20000, 168, 8 },  // GPIO21
+  { 0xfff0b000, 176, 8 },  // GPIO22
+  { 0xfff0c000, 184, 8 },  // GPIO23
+  { 0xfff0d000, 192, 8 },  // GPIO24
+  { 0xfff0e000, 200, 8 },  // GPIO25
+  { 0xfff0f000, 208, 8 },  // GPIO26
+  { 0xfff10000, 216, 8 },  // GPIO27
+  { 0xfff1d000, 224, 8 },  // GPIO28
+};
+
+PLATFORM_GPIO_CONTROLLER gPlatformGpioDevice = {
+  232, 29, gGpioDevice
+};
+
+EFI_STATUS
+EFIAPI
+HiKey960GpioEntryPoint (
+  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] 5+ messages in thread

* [PATCH v2 edk-platforms 1/4] Platform/Hisilicon/HiKey960: add gpio platform driver
  2018-03-08 13:35 [PATCH v2 edk-platforms 0/4] enable virtual keyboards on hikey Haojian Zhuang
@ 2018-03-08 13:35 ` Haojian Zhuang
  0 siblings, 0 replies; 5+ messages in thread
From: Haojian Zhuang @ 2018-03-08 13:35 UTC (permalink / raw)
  To: edk2-devel; +Cc: Haojian Zhuang, Leif Lindholm, Ard Biesheuvel

Add gpio platform driver to enable GPIO in HiKey960 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/HiKey960/HiKey960.dsc                        |  1 +
 Platform/Hisilicon/HiKey960/HiKey960.fdf                        |  1 +
 Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf | 35 +++++++++
 Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c   | 77 ++++++++++++++++++++
 4 files changed, 114 insertions(+)

diff --git a/Platform/Hisilicon/HiKey960/HiKey960.dsc b/Platform/Hisilicon/HiKey960/HiKey960.dsc
index 36f43956ab40..3da1b8556321 100644
--- a/Platform/Hisilicon/HiKey960/HiKey960.dsc
+++ b/Platform/Hisilicon/HiKey960/HiKey960.dsc
@@ -179,6 +179,7 @@ [Components.common]
   #
   # GPIO
   #
+  Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
   ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
 
   #
diff --git a/Platform/Hisilicon/HiKey960/HiKey960.fdf b/Platform/Hisilicon/HiKey960/HiKey960.fdf
index 655032a36c53..162dbaaf2646 100644
--- a/Platform/Hisilicon/HiKey960/HiKey960.fdf
+++ b/Platform/Hisilicon/HiKey960/HiKey960.fdf
@@ -120,6 +120,7 @@ [FV.FvMain]
   #
   # GPIO
   #
+  INF Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
   INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
 
   #
diff --git a/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
new file mode 100644
index 000000000000..a16213f02520
--- /dev/null
+++ b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
@@ -0,0 +1,35 @@
+#
+#  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                      = HiKey960GpioDxe
+  FILE_GUID                      = 6aa12592-7e36-4aec-acf8-2ac2fd13815c
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = HiKey960GpioEntryPoint
+
+[Sources]
+  HiKey960GpioDxe.c
+
+[Packages]
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  UefiDriverEntryPoint
+
+[Protocols]
+  gPlatformGpioProtocolGuid
+
+[Depex]
+  TRUE
diff --git a/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c
new file mode 100644
index 000000000000..986feceea564
--- /dev/null
+++ b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c
@@ -0,0 +1,77 @@
+/** @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[]= {
+  { 0xe8a0b000, 0, 8 },    // GPIO0
+  { 0xe8a0c000, 8, 8 },    // GPIO1
+  { 0xe8a0d000, 16, 8 },   // GPIO2
+  { 0xe8a0e000, 24, 8 },   // GPIO3
+  { 0xe8a0f000, 32, 8 },   // GPIO4
+  { 0xe8a10000, 40, 8 },   // GPIO5
+  { 0xe8a11000, 48, 8 },   // GPIO6
+  { 0xe8a12000, 56, 8 },   // GPIO7
+  { 0xe8a13000, 64, 8 },   // GPIO8
+  { 0xe8a14000, 72, 8 },   // GPIO9
+  { 0xe8a15000, 80, 8 },   // GPIO10
+  { 0xe8a16000, 88, 8 },   // GPIO11
+  { 0xe8a17000, 96, 8 },   // GPIO12
+  { 0xe8a18000, 104, 8 },  // GPIO13
+  { 0xe8a19000, 112, 8 },  // GPIO14
+  { 0xe8a1a000, 120, 8 },  // GPIO15
+  { 0xe8a1b000, 128, 8 },  // GPIO16
+  { 0xe8a1c000, 136, 8 },  // GPIO17
+  { 0xff3b4000, 144, 8 },  // GPIO18
+  { 0xff3b5000, 152, 8 },  // GPIO19
+  { 0xe8a1f000, 160, 8 },  // GPIO20
+  { 0xe8a20000, 168, 8 },  // GPIO21
+  { 0xfff0b000, 176, 8 },  // GPIO22
+  { 0xfff0c000, 184, 8 },  // GPIO23
+  { 0xfff0d000, 192, 8 },  // GPIO24
+  { 0xfff0e000, 200, 8 },  // GPIO25
+  { 0xfff0f000, 208, 8 },  // GPIO26
+  { 0xfff10000, 216, 8 },  // GPIO27
+  { 0xfff1d000, 224, 8 },  // GPIO28
+};
+
+PLATFORM_GPIO_CONTROLLER gPlatformGpioDevice = {
+  232, 29, gGpioDevice
+};
+
+EFI_STATUS
+EFIAPI
+HiKey960GpioEntryPoint (
+  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] 5+ messages in thread

* Re: [PATCH v2 edk-platforms 1/4] Platform/Hisilicon/HiKey960: add gpio platform driver
  2018-03-08 13:29 [PATCH v2 edk-platforms 1/4] Platform/Hisilicon/HiKey960: add gpio platform driver Haojian Zhuang
@ 2018-05-02 15:14 ` Leif Lindholm
  2018-05-04  3:29   ` Haojian Zhuang
  0 siblings, 1 reply; 5+ messages in thread
From: Leif Lindholm @ 2018-05-02 15:14 UTC (permalink / raw)
  To: Haojian Zhuang; +Cc: edk2-devel, Ard Biesheuvel

On Thu, Mar 08, 2018 at 09:29:50PM +0800, Haojian Zhuang wrote:
> Add gpio platform driver to enable GPIO in HiKey960 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/HiKey960/HiKey960.dsc                        |  1 +
>  Platform/Hisilicon/HiKey960/HiKey960.fdf                        |  1 +
>  Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf | 35 +++++++++
>  Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c   | 77 ++++++++++++++++++++
>  4 files changed, 114 insertions(+)
> 
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960.dsc b/Platform/Hisilicon/HiKey960/HiKey960.dsc
> index 36f43956ab40..3da1b8556321 100644
> --- a/Platform/Hisilicon/HiKey960/HiKey960.dsc
> +++ b/Platform/Hisilicon/HiKey960/HiKey960.dsc
> @@ -179,6 +179,7 @@ [Components.common]
>    #
>    # GPIO
>    #
> +  Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
>    ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>  
>    #
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960.fdf b/Platform/Hisilicon/HiKey960/HiKey960.fdf
> index 655032a36c53..162dbaaf2646 100644
> --- a/Platform/Hisilicon/HiKey960/HiKey960.fdf
> +++ b/Platform/Hisilicon/HiKey960/HiKey960.fdf
> @@ -120,6 +120,7 @@ [FV.FvMain]
>    #
>    # GPIO
>    #
> +  INF Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
>    INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>  
>    #
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
> new file mode 100644
> index 000000000000..a16213f02520
> --- /dev/null
> +++ b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
> @@ -0,0 +1,35 @@
> +#
> +#  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

Probably bump this to 0x0001001a by now.

> +  BASE_NAME                      = HiKey960GpioDxe
> +  FILE_GUID                      = 6aa12592-7e36-4aec-acf8-2ac2fd13815c
> +  MODULE_TYPE                    = DXE_DRIVER
> +  VERSION_STRING                 = 1.0
> +  ENTRY_POINT                    = HiKey960GpioEntryPoint
> +
> +[Sources]
> +  HiKey960GpioDxe.c
> +
> +[Packages]
> +  EmbeddedPkg/EmbeddedPkg.dec
> +  MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> +  UefiDriverEntryPoint
> +
> +[Protocols]
> +  gPlatformGpioProtocolGuid
> +
> +[Depex]
> +  TRUE
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c
> new file mode 100644
> index 000000000000..986feceea564
> --- /dev/null
> +++ b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c
> @@ -0,0 +1,77 @@
> +/** @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[]= {

Missing space before '='.

> +  { 0xe8a0b000, 0, 8 },    // GPIO0

It would not improve readability to request all of these live-coded
values to be replaced by #defines, but barring that, could you add a
comment header before the definition?:

//  { base address, gpio index, gpio count }

> +  { 0xe8a0c000, 8, 8 },    // GPIO1
> +  { 0xe8a0d000, 16, 8 },   // GPIO2
> +  { 0xe8a0e000, 24, 8 },   // GPIO3
> +  { 0xe8a0f000, 32, 8 },   // GPIO4
> +  { 0xe8a10000, 40, 8 },   // GPIO5
> +  { 0xe8a11000, 48, 8 },   // GPIO6
> +  { 0xe8a12000, 56, 8 },   // GPIO7
> +  { 0xe8a13000, 64, 8 },   // GPIO8
> +  { 0xe8a14000, 72, 8 },   // GPIO9
> +  { 0xe8a15000, 80, 8 },   // GPIO10
> +  { 0xe8a16000, 88, 8 },   // GPIO11
> +  { 0xe8a17000, 96, 8 },   // GPIO12
> +  { 0xe8a18000, 104, 8 },  // GPIO13
> +  { 0xe8a19000, 112, 8 },  // GPIO14
> +  { 0xe8a1a000, 120, 8 },  // GPIO15
> +  { 0xe8a1b000, 128, 8 },  // GPIO16
> +  { 0xe8a1c000, 136, 8 },  // GPIO17
> +  { 0xff3b4000, 144, 8 },  // GPIO18
> +  { 0xff3b5000, 152, 8 },  // GPIO19

I notice that these:
> +  { 0xe8a1f000, 160, 8 },  // GPIO20
> +  { 0xe8a20000, 168, 8 },  // GPIO21
are out of order, from their base address.
Are the names GPIO20/GPIO21 defined in the TRM?

> +  { 0xfff0b000, 176, 8 },  // GPIO22
> +  { 0xfff0c000, 184, 8 },  // GPIO23
> +  { 0xfff0d000, 192, 8 },  // GPIO24
> +  { 0xfff0e000, 200, 8 },  // GPIO25
> +  { 0xfff0f000, 208, 8 },  // GPIO26
> +  { 0xfff10000, 216, 8 },  // GPIO27
> +  { 0xfff1d000, 224, 8 },  // GPIO28
> +};
> +
> +PLATFORM_GPIO_CONTROLLER gPlatformGpioDevice = {
> +  232, 29, gGpioDevice

And similarly
// { global gpio count, gpio controller count, GPIO_CONTROLLER }

/
    Leif

> +};
> +
> +EFI_STATUS
> +EFIAPI
> +HiKey960GpioEntryPoint (
> +  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	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 edk-platforms 1/4] Platform/Hisilicon/HiKey960: add gpio platform driver
  2018-05-02 15:14 ` Leif Lindholm
@ 2018-05-04  3:29   ` Haojian Zhuang
  2018-05-04 10:26     ` Leif Lindholm
  0 siblings, 1 reply; 5+ messages in thread
From: Haojian Zhuang @ 2018-05-04  3:29 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: edk2-devel@lists.01.org, Ard Biesheuvel

On 2 May 2018 at 23:14, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> On Thu, Mar 08, 2018 at 09:29:50PM +0800, Haojian Zhuang wrote:
>> Add gpio platform driver to enable GPIO in HiKey960 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/HiKey960/HiKey960.dsc                        |  1 +
>>  Platform/Hisilicon/HiKey960/HiKey960.fdf                        |  1 +
>>  Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf | 35 +++++++++
>>  Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c   | 77 ++++++++++++++++++++
>>  4 files changed, 114 insertions(+)
>>
>> diff --git a/Platform/Hisilicon/HiKey960/HiKey960.dsc b/Platform/Hisilicon/HiKey960/HiKey960.dsc
>> index 36f43956ab40..3da1b8556321 100644
>> --- a/Platform/Hisilicon/HiKey960/HiKey960.dsc
>> +++ b/Platform/Hisilicon/HiKey960/HiKey960.dsc
>> @@ -179,6 +179,7 @@ [Components.common]
>>    #
>>    # GPIO
>>    #
>> +  Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
>>    ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>>
>>    #
>> diff --git a/Platform/Hisilicon/HiKey960/HiKey960.fdf b/Platform/Hisilicon/HiKey960/HiKey960.fdf
>> index 655032a36c53..162dbaaf2646 100644
>> --- a/Platform/Hisilicon/HiKey960/HiKey960.fdf
>> +++ b/Platform/Hisilicon/HiKey960/HiKey960.fdf
>> @@ -120,6 +120,7 @@ [FV.FvMain]
>>    #
>>    # GPIO
>>    #
>> +  INF Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
>>    INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>>
>>    #
>> diff --git a/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
>> new file mode 100644
>> index 000000000000..a16213f02520
>> --- /dev/null
>> +++ b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
>> @@ -0,0 +1,35 @@
>> +#
>> +#  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
>
> Probably bump this to 0x0001001a by now.
>

OK

>
> Missing space before '='.
>

OK

>> +  { 0xe8a0b000, 0, 8 },    // GPIO0
>
> It would not improve readability to request all of these live-coded
> values to be replaced by #defines, but barring that, could you add a
> comment header before the definition?:
>
> //  { base address, gpio index, gpio count }
>

OK
>> +  { 0xe8a0c000, 8, 8 },    // GPIO1
>> +  { 0xe8a0d000, 16, 8 },   // GPIO2
>> +  { 0xe8a0e000, 24, 8 },   // GPIO3
>> +  { 0xe8a0f000, 32, 8 },   // GPIO4
>> +  { 0xe8a10000, 40, 8 },   // GPIO5
>> +  { 0xe8a11000, 48, 8 },   // GPIO6
>> +  { 0xe8a12000, 56, 8 },   // GPIO7
>> +  { 0xe8a13000, 64, 8 },   // GPIO8
>> +  { 0xe8a14000, 72, 8 },   // GPIO9
>> +  { 0xe8a15000, 80, 8 },   // GPIO10
>> +  { 0xe8a16000, 88, 8 },   // GPIO11
>> +  { 0xe8a17000, 96, 8 },   // GPIO12
>> +  { 0xe8a18000, 104, 8 },  // GPIO13
>> +  { 0xe8a19000, 112, 8 },  // GPIO14
>> +  { 0xe8a1a000, 120, 8 },  // GPIO15
>> +  { 0xe8a1b000, 128, 8 },  // GPIO16
>> +  { 0xe8a1c000, 136, 8 },  // GPIO17
>> +  { 0xff3b4000, 144, 8 },  // GPIO18
>> +  { 0xff3b5000, 152, 8 },  // GPIO19
>
> I notice that these:
>> +  { 0xe8a1f000, 160, 8 },  // GPIO20
>> +  { 0xe8a20000, 168, 8 },  // GPIO21
> are out of order, from their base address.
> Are the names GPIO20/GPIO21 defined in the TRM?
>

Yes, it's mentioned in the TRM.
(https://github.com/96boards/documentation/blob/master/consumer/hikey960/hardware-docs/HiKey960_SoC_Reference_Manual.pdf)

>> +  232, 29, gGpioDevice
>
> And similarly
> // { global gpio count, gpio controller count, GPIO_CONTROLLER }
>

OK

Best Regards
Haojian


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

* Re: [PATCH v2 edk-platforms 1/4] Platform/Hisilicon/HiKey960: add gpio platform driver
  2018-05-04  3:29   ` Haojian Zhuang
@ 2018-05-04 10:26     ` Leif Lindholm
  0 siblings, 0 replies; 5+ messages in thread
From: Leif Lindholm @ 2018-05-04 10:26 UTC (permalink / raw)
  To: Haojian Zhuang; +Cc: edk2-devel@lists.01.org, Ard Biesheuvel

On Fri, May 04, 2018 at 11:29:33AM +0800, Haojian Zhuang wrote:
> On 2 May 2018 at 23:14, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> >> +  { 0xe8a0b000, 0, 8 },    // GPIO0
> >
> > It would not improve readability to request all of these live-coded
> > values to be replaced by #defines, but barring that, could you add a
> > comment header before the definition?:
> >
> > //  { base address, gpio index, gpio count }
> >
> 
> OK
> >> +  { 0xe8a0c000, 8, 8 },    // GPIO1
> >> +  { 0xe8a0d000, 16, 8 },   // GPIO2
> >> +  { 0xe8a0e000, 24, 8 },   // GPIO3
> >> +  { 0xe8a0f000, 32, 8 },   // GPIO4
> >> +  { 0xe8a10000, 40, 8 },   // GPIO5
> >> +  { 0xe8a11000, 48, 8 },   // GPIO6
> >> +  { 0xe8a12000, 56, 8 },   // GPIO7
> >> +  { 0xe8a13000, 64, 8 },   // GPIO8
> >> +  { 0xe8a14000, 72, 8 },   // GPIO9
> >> +  { 0xe8a15000, 80, 8 },   // GPIO10
> >> +  { 0xe8a16000, 88, 8 },   // GPIO11
> >> +  { 0xe8a17000, 96, 8 },   // GPIO12
> >> +  { 0xe8a18000, 104, 8 },  // GPIO13
> >> +  { 0xe8a19000, 112, 8 },  // GPIO14
> >> +  { 0xe8a1a000, 120, 8 },  // GPIO15
> >> +  { 0xe8a1b000, 128, 8 },  // GPIO16
> >> +  { 0xe8a1c000, 136, 8 },  // GPIO17
> >> +  { 0xff3b4000, 144, 8 },  // GPIO18
> >> +  { 0xff3b5000, 152, 8 },  // GPIO19
> >
> > I notice that these:
> >> +  { 0xe8a1f000, 160, 8 },  // GPIO20
> >> +  { 0xe8a20000, 168, 8 },  // GPIO21
> > are out of order, from their base address.
> > Are the names GPIO20/GPIO21 defined in the TRM?
> >
> 
> Yes, it's mentioned in the TRM.

Yeah, I figured as much, but was hoping for something else :)

> (https://github.com/96boards/documentation/blob/master/consumer/hikey960/hardware-docs/HiKey960_SoC_Reference_Manual.pdf)

Thanks for the link - that will be useful!

/
    Leif


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

end of thread, other threads:[~2018-05-04 10:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-08 13:29 [PATCH v2 edk-platforms 1/4] Platform/Hisilicon/HiKey960: add gpio platform driver Haojian Zhuang
2018-05-02 15:14 ` Leif Lindholm
2018-05-04  3:29   ` Haojian Zhuang
2018-05-04 10:26     ` 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 1/4] Platform/Hisilicon/HiKey960: 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