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 v3 07/12] Marvell/Drivers: MvBoardDesc: Extend protocol with GPIO support
Date: Thu, 17 Jan 2019 11:50:25 +0000	[thread overview]
Message-ID: <20190117115025.na2m5osctpqikmt5@bivouac.eciton.net> (raw)
In-Reply-To: <1547723715-4562-8-git-send-email-mw@semihalf.com>

On Thu, Jan 17, 2019 at 12:15:10PM +0100, Marcin Wojtas wrote:
> Introduce new callback that can provide information
> about GPIO SoC controllers, as well as on-board
> I2C IO expanders. According ArmadaSoCDescLib
> ArmadaBoardDescLib routines are used for
> obtaining required data.
> 
> 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/Include/Protocol/BoardDesc.h       |  8 ++++
>  Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 50 ++++++++++++++++++++
>  2 files changed, 58 insertions(+)
> 
> diff --git a/Silicon/Marvell/Include/Protocol/BoardDesc.h b/Silicon/Marvell/Include/Protocol/BoardDesc.h
> index 1d57a16..02905ea 100644
> --- a/Silicon/Marvell/Include/Protocol/BoardDesc.h
> +++ b/Silicon/Marvell/Include/Protocol/BoardDesc.h
> @@ -50,6 +50,13 @@ EFI_STATUS
>  
>  typedef
>  EFI_STATUS
> +(EFIAPI *MV_BOARD_GPIO_DESCRIPTION_GET) (
> +  IN MARVELL_BOARD_DESC_PROTOCOL    *This,
> +  IN OUT MV_BOARD_GPIO_DESCRIPTION **GpioDescription
> +  );
> +
> +typedef
> +EFI_STATUS
>  (EFIAPI *MV_BOARD_DESC_I2C_GET) (
>    IN MARVELL_BOARD_DESC_PROTOCOL  *This,
>    IN OUT MV_BOARD_I2C_DESC       **I2cDesc
> @@ -113,6 +120,7 @@ struct _MARVELL_BOARD_DESC_PROTOCOL {
>    MV_BOARD_DESC_UTMI_GET         BoardDescUtmiGet;
>    MV_BOARD_DESC_XHCI_GET         BoardDescXhciGet;
>    MV_BOARD_DESC_FREE             BoardDescFree;
> +  MV_BOARD_GPIO_DESCRIPTION_GET  GpioDescriptionGet;
>  };
>  
>  #endif // __MARVELL_BOARD_DESC_PROTOCOL_H__
> diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c
> index f71bfc4..973c362 100644
> --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c
> +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c
> @@ -35,6 +35,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  
>  MV_BOARD_DESC *mBoardDescInstance;
>  
> +STATIC MV_BOARD_GPIO_DESCRIPTION *mGpioDescription;
> +
>  STATIC
>  EFI_STATUS
>  MvBoardDescComPhyGet (
> @@ -100,6 +102,53 @@ MvBoardDescComPhyGet (
>  
>  STATIC
>  EFI_STATUS
> +MvBoardGpioDescriptionGet (
> +  IN MARVELL_BOARD_DESC_PROTOCOL    *This,
> +  IN OUT MV_BOARD_GPIO_DESCRIPTION **GpioDescription
> +  )
> +{
> +  UINTN SoCGpioCount, GpioExpanderCount;
> +  MV_GPIO_EXPANDER *GpioExpanders;
> +  GPIO_CONTROLLER *SoCGpio;
> +  EFI_STATUS Status;
> +
> +  /* Use existing structure if already created. */
> +  if (mGpioDescription != NULL) {
> +    *GpioDescription = mGpioDescription;
> +    return EFI_SUCCESS;
> +  }
> +
> +  /* Get SoC data about all available GPIO controllers. */
> +  Status = ArmadaSoCGpioGet (&SoCGpio, &SoCGpioCount);
> +  if (EFI_ERROR (Status)) {
> +    return Status;
> +  }
> +
> +  /* Get per-board information about all available GPIO expanders. */
> +  Status = ArmadaBoardGpioExpanderGet (&GpioExpanders, &GpioExpanderCount);
> +  if (EFI_ERROR (Status)) {
> +    return Status;
> +  }
> +
> +  /* Allocate and fill board description. */
> +  mGpioDescription = AllocateZeroPool (sizeof (MV_BOARD_GPIO_DESCRIPTION));
> +  if (mGpioDescription == NULL) {
> +    DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__));
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +
> +  mGpioDescription->SoCGpio = SoCGpio;
> +  mGpioDescription->GpioDeviceCount = SoCGpioCount;
> +  mGpioDescription->GpioExpanders = GpioExpanders;
> +  mGpioDescription->GpioExpanderCount = GpioExpanderCount;
> +
> +  *GpioDescription = mGpioDescription;
> +
> +  return EFI_SUCCESS;
> +}
> +
> +STATIC
> +EFI_STATUS
>  MvBoardDescI2cGet (
>    IN MARVELL_BOARD_DESC_PROTOCOL  *This,
>    IN OUT MV_BOARD_I2C_DESC       **I2cDesc
> @@ -571,6 +620,7 @@ MvBoardDescInitProtocol (
>    BoardDescProtocol->BoardDescUtmiGet = MvBoardDescUtmiGet;
>    BoardDescProtocol->BoardDescXhciGet = MvBoardDescXhciGet;
>    BoardDescProtocol->BoardDescFree = MvBoardDescFree;
> +  BoardDescProtocol->GpioDescriptionGet = MvBoardGpioDescriptionGet;
>  
>    return EFI_SUCCESS;
>  }
> -- 
> 2.7.4
> 


  reply	other threads:[~2019-01-17 11:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 11:15 [platforms: PATCH v3 00/12] Armada 7k8k GPIO support Marcin Wojtas
2019-01-17 11:15 ` [platforms: PATCH v3 01/12] Marvell/Library: ArmadaSoCDescLib: Add GPIO information Marcin Wojtas
2019-01-17 11:15 ` [platforms: PATCH v3 02/12] Marvell/Library: ArmadaBoardDescLib: " Marcin Wojtas
2019-01-17 11:15 ` [platforms: PATCH v3 03/12] Marvell/Library: Introduce MvGpioLib class Marcin Wojtas
2019-01-17 11:33   ` Leif Lindholm
2019-01-17 12:19     ` Marcin Wojtas
2019-01-17 14:18       ` Leif Lindholm
2019-01-17 14:39         ` Marcin Wojtas
2019-01-17 11:15 ` [platforms: PATCH v3 04/12] SolidRun/Armada80x0McBin: Extend board description library with GPIO Marcin Wojtas
2019-01-17 11:15 ` [platforms: PATCH v3 05/12] Marvell/Armada70x0Db: " Marcin Wojtas
2019-01-17 11:34   ` Leif Lindholm
2019-01-17 11:15 ` [platforms: PATCH v3 06/12] Marvell/Armada80x0Db: " Marcin Wojtas
2019-01-17 11:34   ` Leif Lindholm
2019-01-17 11:15 ` [platforms: PATCH v3 07/12] Marvell/Drivers: MvBoardDesc: Extend protocol with GPIO support Marcin Wojtas
2019-01-17 11:50   ` Leif Lindholm [this message]
2019-01-17 11:15 ` [platforms: PATCH v3 08/12] Marvell/Drivers: MvGpioDxe: Introduce platform GPIO driver Marcin Wojtas
2019-01-17 11:52   ` Leif Lindholm
2019-01-17 11:15 ` [platforms: PATCH v3 09/12] Marvell/Drivers: I2c: Use common header for macros Marcin Wojtas
2019-01-17 11:15 ` [platforms: PATCH v3 10/12] Marvell/Drivers: MvPca95xxDxe: Introduce GPIO expander driver Marcin Wojtas
2019-01-17 11:55   ` Leif Lindholm
2019-01-17 11:15 ` [platforms: PATCH v3 11/12] Marvell/Armada7k8k: Enable GPIO drivers compilation Marcin Wojtas
2019-01-17 11:15 ` [platforms: PATCH v3 12/12] Marvell/Armada7k8k: Introduce NonDiscoverable device init routines Marcin Wojtas
2019-01-17 12:03 ` [platforms: PATCH v3 00/12] Armada 7k8k GPIO support Leif Lindholm
2019-01-17 12:26   ` Marcin Wojtas

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=20190117115025.na2m5osctpqikmt5@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