From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.33300.1623052486501340902 for ; Mon, 07 Jun 2021 00:54:46 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: sunny.wang@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1D6A231B; Mon, 7 Jun 2021 00:54:46 -0700 (PDT) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2004D3F719; Mon, 7 Jun 2021 00:54:43 -0700 (PDT) From: "Sunny Wang" To: devel@edk2.groups.io Cc: Sunny Wang , Samer El-Haj-Mahmoud , Sami Mujawar , Jeremy Linton , Pete Batard , Ard Biesheuvel , =?UTF-8?q?Mario=20B=C4=83l=C4=83nic=C4=83?= , Sunny Wang Subject: [PATCH v4 2/3] Silicon/Broadcom/Bcm283x: Clean up GpioPinSet function Date: Mon, 7 Jun 2021 15:53:38 +0800 Message-Id: <20210607075339.342-3-Sunny.Wang@arm.com> X-Mailer: git-send-email 2.31.0.windows.1 In-Reply-To: <20210607075339.342-1-Sunny.Wang@arm.com> References: <20210607075339.342-1-Sunny.Wang@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 Cc: Sami Mujawar Cc: Jeremy Linton Cc: Pete Batard Cc: Ard Biesheuvel Cc: Mario B=C4=83l=C4=83nic=C4=83 Signed-off-by: Sunny Wang --- 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 + * Copyright (c) 2021, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -13,6 +14,9 @@ =20 #include =20 +#define CLEAR_GPIO 0 +#define SET_GPIO 1 + VOID GpioPinFuncSet ( IN UINTN Pin, @@ -25,9 +29,9 @@ GpioPinFuncGet ( ); =20 VOID -GpioPinSet ( - IN UINTN Pin, - IN UINTN Val +GpioPinConfigure ( + IN UINTN Pin, + IN BOOLEAN Config ); =20 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 * Copyright (c) 2018, Andrei Warkentin + * Copyright (c) 2021, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -85,9 +86,9 @@ GpioPinFuncGet ( } =20 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 =3D (Val =3D=3D 0) ? GPIO_GPCLR0 : GPIO_GPSET0; + Reg =3D (Config =3D=3D CLEAR_GPIO) ? GPIO_GPCLR0 : GPIO_GPSET0; Reg +=3D RegIndex * sizeof (UINT32); MmioWrite32 (Reg, 1 << SelIndex); } --=20 2.31.0.windows.1