public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sunny Wang" <Sunny.Wang@arm.com>
To: devel@edk2.groups.io
Cc: "Sunny Wang" <Sunny.Wang@arm.com>,
	"Samer El-Haj-Mahmoud" <samer.el-haj-mahmoud@arm.com>,
	"Sami Mujawar" <sami.mujawar@arm.com>,
	"Jeremy Linton" <jeremy.linton@arm.com>,
	"Pete Batard" <pete@akeo.ie>,
	"Ard Biesheuvel" <ardb+tianocore@kernel.org>,
	"Mario Bălănică" <mariobalanica02@gmail.com>,
	"Sunny Wang" <sunny.wang@arm.com>
Subject: [PATCH v4 2/3] Silicon/Broadcom/Bcm283x: Clean up GpioPinSet function
Date: Mon,  7 Jun 2021 15:53:38 +0800	[thread overview]
Message-ID: <20210607075339.342-3-Sunny.Wang@arm.com> (raw)
In-Reply-To: <20210607075339.342-1-Sunny.Wang@arm.com>

Make the changes below for making it clearer.
    - Rename GpioPinSet() to GpioPinConfigure()
    - Rename parameter Val to Config and change its type to BOOLEAN

Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jeremy Linton <jeremy.linton@arm.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Mario Bălănică <mariobalanica02@gmail.com>
Signed-off-by: Sunny Wang <sunny.wang@arm.com>
---
 Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h | 10 +++++++---
 Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c |  9 +++++----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h b/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h
index 75c2c8be51..1f7d2204e0 100644
--- a/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h
+++ b/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h
@@ -3,6 +3,7 @@
  *  GPIO manipulation.
  *
  *  Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
+ *  Copyright (c) 2021, ARM Limited. All rights reserved.
  *
  *  SPDX-License-Identifier: BSD-2-Clause-Patent
  *
@@ -13,6 +14,9 @@
 
 #include <IndustryStandard/Bcm2836Gpio.h>
 
+#define CLEAR_GPIO    0
+#define SET_GPIO      1
+
 VOID
 GpioPinFuncSet (
   IN  UINTN Pin,
@@ -25,9 +29,9 @@ GpioPinFuncGet (
   );
 
 VOID
-GpioPinSet (
-  IN  UINTN Pin,
-  IN  UINTN Val
+GpioPinConfigure (
+  IN  UINTN   Pin,
+  IN  BOOLEAN Config
   );
 
 UINTN
diff --git a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c
index a4b4af59eb..eaf53e5369 100644
--- a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c
+++ b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c
@@ -4,6 +4,7 @@
  *
  *  Copyright (c) 2020, Pete Batard <pete@akeo.ie>
  *  Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
+ *  Copyright (c) 2021, ARM Limited. All rights reserved.
  *
  *  SPDX-License-Identifier: BSD-2-Clause-Patent
  *
@@ -85,9 +86,9 @@ GpioPinFuncGet (
 }
 
 VOID
-GpioPinSet (
-  IN  UINTN Pin,
-  IN  UINTN Val
+GpioPinConfigure (
+  IN  UINTN   Pin,
+  IN  BOOLEAN Config
   )
 {
   EFI_PHYSICAL_ADDRESS Reg;
@@ -102,7 +103,7 @@ GpioPinSet (
   //
   // Different base addresses are used for clear and set
   //
-  Reg = (Val == 0) ? GPIO_GPCLR0 : GPIO_GPSET0;
+  Reg = (Config == CLEAR_GPIO) ? GPIO_GPCLR0 : GPIO_GPSET0;
   Reg += RegIndex * sizeof (UINT32);
   MmioWrite32 (Reg, 1 << SelIndex);
 }
-- 
2.31.0.windows.1


  parent reply	other threads:[~2021-06-07  7:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07  7:53 [PATCH v4 0/3] Dynamically build UARTs info in ACPI Sunny Wang
2021-06-07  7:53 ` [PATCH v4 1/3] Platform/RaspberryPi: " Sunny Wang
2021-06-12 13:39   ` Pete Batard
2021-06-12 20:08     ` Ard Biesheuvel
2021-06-07  7:53 ` Sunny Wang [this message]
2021-06-12 13:40   ` [PATCH v4 2/3] Silicon/Broadcom/Bcm283x: Clean up GpioPinSet function Pete Batard
2021-06-07  7:53 ` [PATCH v4 3/3] Platform/RaspberryPi: Enable Bluetooth and UART in Windows OS Sunny Wang
2021-06-07 15:04   ` Mario Bălănică
2021-06-12 13:40   ` Pete Batard

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=20210607075339.342-3-Sunny.Wang@arm.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