public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: Marcin Wojtas <mw@semihalf.com>
Cc: edk2-devel@lists.01.org, ard.biesheuvel@linaro.org,
	nadavh@marvell.com, jsd@semihalf.com, jaz@semihalf.com,
	kostap@marvell.com
Subject: Re: [platforms: PATCH 09/12] Marvell/Drivers: I2c: Use common header for macros
Date: Tue, 4 Dec 2018 16:38:45 +0000	[thread overview]
Message-ID: <20181204163845.mjerkult3k3qo7xe@bivouac.eciton.net> (raw)
In-Reply-To: <1540000661-1956-10-git-send-email-mw@semihalf.com>

On Sat, Oct 20, 2018 at 03:57:38AM +0200, Marcin Wojtas wrote:
> Hitherto I2c solution used same macros, defined in multiple
> places. Move them to a new common header.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas <mw@semihalf.com>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
>  Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h | 10 -------
>  Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h       | 17 ++---------
>  Silicon/Marvell/Include/Protocol/MvI2c.h              | 31 ++++++++++++++++++++
>  Silicon/Marvell/Applications/EepromCmd/EepromCmd.c    |  5 +---
>  Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.c |  3 +-
>  Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c       |  4 +--
>  6 files changed, 37 insertions(+), 33 deletions(-)
>  create mode 100644 Silicon/Marvell/Include/Protocol/MvI2c.h
> 
> diff --git a/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h b/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h
> index b1af645..c32ee48 100644
> --- a/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h
> +++ b/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h
> @@ -41,16 +41,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  
>  #define MAX_BUFFER_LENGTH 64
>  
> -/*
> - * I2C_FLAG_NORESTART is not part of PI spec, it allows to continue
> - * transmission without repeated start operation.
> - * FIXME: This flag is also defined in Drivers/I2c/MvI2cDxe/MvI2cDxe.h
> - * and it's important to have both version synced. This solution is
> - * temporary and shared flag should be used by both files.
> - * Situation is analogous with I2C_GUID, which also should be common, but is
> - * for now defined same way in two header files.
> - */
> -#define I2C_FLAG_NORESTART 0x00000002
>  #define I2C_GUID \
>    { \
>    0xadc1901b, 0xb83c, 0x4831, { 0x8f, 0x59, 0x70, 0x89, 0x8f, 0x26, 0x57, 0x1e } \
> diff --git a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h
> index 3c9beaf..6850c34 100644
> --- a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h
> +++ b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h
> @@ -32,8 +32,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  
>  *******************************************************************************/
>  
> -#ifndef __MV_I2C_H__
> -#define __MV_I2C_H__
> +#ifndef __MV_I2C_DXE_H__
> +#define __MV_I2C_DXE_H__
>  
>  #include <Uefi.h>
>  
> @@ -75,17 +75,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  #define I2C_FAST           0x2
>  #define I2C_FASTEST        0x3
>  
> -/*
> - * I2C_FLAG_NORESTART is not part of PI spec, it allows to continue
> - * transmission without repeated start operation.
> - * FIXME: This flag is also defined in
> - * Platforms/Marvell/Include/Protocol/Eeprom.h and it's important to have both
> - * version synced. This solution is temporary and shared flag should be used by
> - * both files.
> - * Situation is analogous with I2C_GUID, which also should be common, but is
> - * for now defined same way in two header files.
> - */
> -#define I2C_FLAG_NORESTART 0x00000002
>  #define I2C_GUID \
>    { \
>    0xadc1901b, 0xb83c, 0x4831, { 0x8f, 0x59, 0x70, 0x89, 0x8f, 0x26, 0x57, 0x1e } \
> @@ -266,4 +255,4 @@ MvI2cEnableConf (
>    IN EFI_STATUS                                          *I2cStatus OPTIONAL
>    );
>  
> -#endif // __MV_I2C_H__
> +#endif // __MV_I2C_DXE_H__
> diff --git a/Silicon/Marvell/Include/Protocol/MvI2c.h b/Silicon/Marvell/Include/Protocol/MvI2c.h
> new file mode 100644
> index 0000000..d8e644e
> --- /dev/null
> +++ b/Silicon/Marvell/Include/Protocol/MvI2c.h
> @@ -0,0 +1,31 @@
> +/**
> +*
> +*  Copyright (c) 2018, Marvell International Ltd. 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.
> +*
> +**/
> +#ifndef __MV_I2C_H__
> +#define __MV_I2C_H__
> +
> +/*
> + * I2C_FLAG_NORESTART is not part of PI spec, it allows to continue
> + * transmission without repeated start operation.
> + */
> +#define I2C_FLAG_NORESTART             0x00000002
> +
> +/*
> + * Helper macros for maintaining multiple I2C buses
> + * and devices defined via EFI_I2C_DEVICE.
> + */
> +#define I2C_DEVICE_ADDRESS(Index)      ((Index) & MAX_UINT16)
> +#define I2C_DEVICE_BUS(Index)          ((Index) >> 16)
> +#define I2C_DEVICE_INDEX(Bus, Address) (((Address) & MAX_UINT16) | (Bus) << 16)
> +
> +#endif
> diff --git a/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c b/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c
> index f43e411..a390f23 100644
> --- a/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c
> +++ b/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c
> @@ -52,10 +52,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  #include <Library/UefiBootServicesTableLib.h>
>  
>  #include <Protocol/Eeprom.h>
> -
> -#define I2C_DEVICE_INDEX(bus, address) (((address) & 0xffff) | (bus) << 16)
> -#define I2C_DEVICE_ADDRESS(index) ((index) & 0xffff)
> -#define I2C_DEVICE_BUS(index) ((index) >> 16)
> +#include <Protocol/MvI2c.h>
>  
>  CONST CHAR16 ShellEepromFileName[] = L"ShellCommand";
>  EFI_HANDLE ShellEepromHiiHandle = NULL;
> diff --git a/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.c b/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.c
> index 9d2f650..90d0d1e 100644
> --- a/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.c
> +++ b/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.c
> @@ -35,6 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  #include <Protocol/DriverBinding.h>
>  #include <Protocol/I2cIo.h>
>  #include <Protocol/Eeprom.h>
> +#include <Protocol/MvI2c.h>
>  
>  #include <Library/BaseLib.h>
>  #include <Library/BaseMemoryLib.h>
> @@ -49,8 +50,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  
>  #include "MvEepromDxe.h"
>  
> -#define I2C_DEVICE_INDEX(bus, address) (((address) & 0xffff) | (bus) << 16)
> -
>  STATIC CONST EFI_GUID I2cGuid = I2C_GUID;
>  
>  EFI_DRIVER_BINDING_PROTOCOL gDriverBindingProtocol = {
> diff --git a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
> index 9ec4929..582e2b9 100755
> --- a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
> +++ b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
> @@ -37,6 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  #include <Protocol/I2cEnumerate.h>
>  #include <Protocol/I2cBusConfigurationManagement.h>
>  #include <Protocol/DevicePath.h>
> +#include <Protocol/MvI2c.h>
>  
>  #include <Library/BaseLib.h>
>  #include <Library/IoLib.h>
> @@ -628,9 +629,6 @@ MvI2cStartRequest (
>  
>  STATIC CONST EFI_GUID DevGuid = I2C_GUID;
>  
> -#define I2C_DEVICE_INDEX(bus, address) (((address) & 0xffff) | (bus) << 16)
> -#define I2C_DEVICE_ADDRESS(index) ((index) & 0xffff)
> -
>  STATIC
>  EFI_STATUS
>  MvI2cAllocDevice (
> -- 
> 2.7.4
> 


  reply	other threads:[~2018-12-04 16:38 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-20  1:57 [platforms: PATCH 00/12] Armada7k8k GPIO support Marcin Wojtas
2018-10-20  1:57 ` [platforms: PATCH 01/12] Marvell/Library: ArmadaSoCDescLib: Add GPIO information Marcin Wojtas
2018-11-14  1:10   ` Leif Lindholm
2018-11-14  6:05     ` Marcin Wojtas
2018-11-14 17:33       ` Leif Lindholm
2018-11-21  1:26         ` Marcin Wojtas
2018-11-26 14:49           ` Leif Lindholm
2018-10-20  1:57 ` [platforms: PATCH 02/12] Marvell/Library: ArmadaBoardDescLib: " Marcin Wojtas
2018-11-14  1:12   ` Leif Lindholm
2018-11-14  6:16     ` Marcin Wojtas
2018-11-14 17:29       ` Leif Lindholm
2018-12-04 15:18     ` Leif Lindholm
2018-10-20  1:57 ` [platforms: PATCH 03/12] SolidRun/Armada80x0McBin: Introduce board description library Marcin Wojtas
2018-12-04 15:23   ` Leif Lindholm
2018-10-20  1:57 ` [platforms: PATCH 04/12] Marvell/Armada70x0Db: " Marcin Wojtas
2018-12-04 15:27   ` Leif Lindholm
2018-10-20  1:57 ` [platforms: PATCH 05/12] Marvell/Armada80x0Db: " Marcin Wojtas
2018-12-04 15:31   ` Leif Lindholm
2018-10-20  1:57 ` [platforms: PATCH 06/12] Marvell/Drivers: MvBoardDesc: Extend protocol with GPIO support Marcin Wojtas
2018-12-04 15:42   ` Leif Lindholm
2018-10-20  1:57 ` [platforms: PATCH 07/12] Marvell/Protocol: Introduce MARVELL_GPIO_PROTOCOL Marcin Wojtas
2018-12-04 16:00   ` Leif Lindholm
2018-10-20  1:57 ` [platforms: PATCH 08/12] Marvell/Drivers: MvGpioDxe: Introduce platform GPIO driver Marcin Wojtas
2018-12-04 16:37   ` Leif Lindholm
2018-12-04 16:40     ` Ard Biesheuvel
2018-12-04 17:19       ` Leif Lindholm
2018-12-04 17:20         ` Ard Biesheuvel
2018-10-20  1:57 ` [platforms: PATCH 09/12] Marvell/Drivers: I2c: Use common header for macros Marcin Wojtas
2018-12-04 16:38   ` Leif Lindholm [this message]
2018-10-20  1:57 ` [platforms: PATCH 10/12] Marvell/Drivers: MvPca95xxDxe: Introduce I2C GPIO driver Marcin Wojtas
2018-12-04 17:02   ` Leif Lindholm
2018-10-20  1:57 ` [platforms: PATCH 11/12] Marvell/Armada7k8k: Enable GPIO drivers compilation Marcin Wojtas
2018-12-04 17:06   ` Leif Lindholm
2018-10-20  1:57 ` [platforms: PATCH 12/12] Marvell/Armada7k8k: Introduce NonDiscoverable device init routines Marcin Wojtas
2018-12-04 17:16   ` Leif Lindholm

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=20181204163845.mjerkult3k3qo7xe@bivouac.eciton.net \
    --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