From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mx.groups.io with SMTP id smtpd.web08.5930.1623505207757757850 for ; Sat, 12 Jun 2021 06:40:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=wRxOPKI6; spf=pass (domain: akeo.ie, ip: 209.85.128.48, mailfrom: pete@akeo.ie) Received: by mail-wm1-f48.google.com with SMTP id t4-20020a1c77040000b029019d22d84ebdso10197962wmi.3 for ; Sat, 12 Jun 2021 06:40:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=oB2EjTlfRX4HBG+SmaIKaudqkq8V/+rtE1fGLSijc5E=; b=wRxOPKI6NYfUybD75UrccURk9P+BETthvRcWmveCNt6txGejFnRUFAxzdMgw1UoZMu Fn4UKxu/yGr6ZEYFOuB7phLXxD3bIGDaQUBvXPbBXGI2v9AfggJ0CaN0wHxMd2WJX8PK sdAWl/Sf7PL0naNLbftwF27v6kEkcvIZ3uDDNlnPaWBHeHMMhFp/1TgUiuB2EYvM1ppM 3Nam1NfMElNkzV6BZVMw7Xahdy4yqLF/Y2d6hj/oPyUh14k4sUqY6kyWO58i7+VCBKhj jm72gV+MTkV20nKiO3Hz0Uc9uSaPAUAki52DTlXXxxjBUKhH5znn4OALvpaFpKB/Ylg4 i6xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oB2EjTlfRX4HBG+SmaIKaudqkq8V/+rtE1fGLSijc5E=; b=el1x2i/grQJzJY6brKRfAtqcp0x+6Z1ZEu7mV7RukfrvC9Ps8AuwoAz0lmgTBj8hcE 27iHQJTnnFZzWfPBqSp0x3BEiFaQiEJYX8FMnR56XJpesTlBeJUGrneE04v1/LDgLBMy p1mn8LwmKBMUIwzsubdpVijdPQ+2ZWUrhxhi256g5Y7iYwjcSMfzFF9QjLH9Ub/4biQU 8m00Mzp7uRg7ERoMhAsBMr1U5e2GWCtLhM2nL52JekLtKFkXCTCOtJgl4Mcq38FDrjEa BXn5dNEyzr2IXtLKaDirQimlN/hO1ljfNaEBASPL4Zr0wTXjhMYg7R8YR6BvcINRu12/ vHyQ== X-Gm-Message-State: AOAM530A/yjaiPP02n6uOItaoBDL1OalPHpr9vD245L5RKvQFFWNG4RN tMGuLmhedN5NPmIfqk4DS7LmTA== X-Google-Smtp-Source: ABdhPJyriXTvsvndecQbf9yJwQfaqYqRhu/LYn5Q6vx+DGF/kbpJw3M3ETnVfIycxCRkZ+taRUefUg== X-Received: by 2002:a05:600c:2284:: with SMTP id 4mr8424044wmf.146.1623505206365; Sat, 12 Jun 2021 06:40:06 -0700 (PDT) Return-Path: Received: from [10.0.0.122] ([84.203.35.112]) by smtp.googlemail.com with ESMTPSA id k82sm16215839wmf.11.2021.06.12.06.40.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 12 Jun 2021 06:40:06 -0700 (PDT) Subject: Re: [PATCH v4 2/3] Silicon/Broadcom/Bcm283x: Clean up GpioPinSet function To: Sunny Wang , devel@edk2.groups.io Cc: Samer El-Haj-Mahmoud , Sami Mujawar , Jeremy Linton , Ard Biesheuvel , =?UTF-8?B?TWFyaW8gQsSDbMSDbmljxIM=?= References: <20210607075339.342-1-Sunny.Wang@arm.com> <20210607075339.342-3-Sunny.Wang@arm.com> From: "Pete Batard" Message-ID: <226ac355-8e9b-6287-456c-b36c9fdc030d@akeo.ie> Date: Sat, 12 Jun 2021 14:40:04 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210607075339.342-3-Sunny.Wang@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit On 2021.06.07 08:53, Sunny Wang wrote: > 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ălănică > 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 @@ > > #include > > +#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 > * 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 ( > } > > 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); > } > Reviewed-by: Pete Batard