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: devel@edk2.groups.io, ard.biesheuvel@linaro.org,
	jsd@semihalf.com, jaz@semihalf.com, kostap@marvell.com
Subject: Re: [edk2-platforms: PATCH v3 4/9] Marvell/Library: ArmadaSoCDescLib/MppLib: Extend Xenon information
Date: Thu, 10 Oct 2019 23:55:45 +0100	[thread overview]
Message-ID: <20191010225545.GU25504@bivouac.eciton.net> (raw)
In-Reply-To: <1570686139-25182-5-git-send-email-mw@semihalf.com>

On Thu, Oct 10, 2019 at 07:42:14AM +0200, Marcin Wojtas wrote:
> Hitherto SoC description and MppLib libraries code assumed
> that there could be only two Xenon SdMmc controller
> instances in the SoC. Remove those limitations, so that
> to support CN913x SoCs, which may have up to 4 of such interfaces.
> 
> Signed-off-by: Marcin Wojtas <mw@semihalf.com>

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

> ---
>  Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h |  5 +--
>  Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 34 +++++++++++++-------
>  Silicon/Marvell/Library/MppLib/MppLib.c                                        |  4 +--
>  3 files changed, 26 insertions(+), 17 deletions(-)
> 
> diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h
> index 0296d43..265b4f4 100644
> --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h
> +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h
> @@ -90,8 +90,9 @@
>  //
>  // Platform description of SDMMC controllers
>  //
> -#define MV_SOC_MAX_SDMMC_COUNT           2
> -#define MV_SOC_SDMMC_BASE(Index)         ((Index) == 0 ? 0xF06E0000 : 0xF2780000)
> +#define MV_SOC_SDMMC_PER_CP_COUNT        1
> +#define MV_SOC_AP80X_SDMMC_BASE          0xF06E0000
> +#define MV_SOC_CP_SDMMC_BASE(Cp)         (MV_SOC_CP_BASE (Cp) + 0x780000)
>  
>  //
>  // Platform description of UTMI PHY's
> diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
> index 5947601..3ffd57e 100644
> --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
> +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c
> @@ -349,26 +349,36 @@ EFI_STATUS
>  EFIAPI
>  ArmadaSoCDescSdMmcGet (
>    IN OUT MV_SOC_SDMMC_DESC  **SdMmcDesc,
> -  IN OUT UINTN               *DescCount
> +  IN OUT UINTN               *Count
>    )
>  {
> -  MV_SOC_SDMMC_DESC *Desc;
> -  UINTN Index;
> +  MV_SOC_SDMMC_DESC *SdMmc;
> +  UINTN CpCount, CpIndex;
>  
> -  Desc = AllocateZeroPool (MV_SOC_MAX_SDMMC_COUNT * sizeof (MV_SOC_SDMMC_DESC));
> -  if (Desc == NULL) {
> +  CpCount = FixedPcdGet8 (PcdMaxCpCount);
> +
> +  *Count = CpCount * MV_SOC_SDMMC_PER_CP_COUNT + MV_SOC_AP806_COUNT;
> +  SdMmc = AllocateZeroPool (*Count * sizeof (MV_SOC_SDMMC_DESC));
> +  if (SdMmc == NULL) {
>      DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__));
>      return EFI_OUT_OF_RESOURCES;
>    }
>  
> -  for (Index = 0; Index < MV_SOC_MAX_SDMMC_COUNT; Index++) {
> -    Desc[Index].SdMmcBaseAddress = MV_SOC_SDMMC_BASE (Index);
> -    Desc[Index].SdMmcMemSize = SIZE_1KB;
> -    Desc[Index].SdMmcDmaType = NonDiscoverableDeviceDmaTypeCoherent;
> -  }
> +  *SdMmcDesc = SdMmc;
> +
> +  /* AP80x controller */
> +  SdMmc->SdMmcBaseAddress = MV_SOC_AP80X_SDMMC_BASE;
> +  SdMmc->SdMmcMemSize = SIZE_1KB;
> +  SdMmc->SdMmcDmaType = NonDiscoverableDeviceDmaTypeCoherent;
> +  SdMmc++;
>  
> -  *SdMmcDesc = Desc;
> -  *DescCount = MV_SOC_MAX_SDMMC_COUNT;
> +  /* CP11x controllers */
> +  for (CpIndex = 0; CpIndex < CpCount; CpIndex++) {
> +    SdMmc->SdMmcBaseAddress = MV_SOC_CP_SDMMC_BASE (CpIndex);
> +    SdMmc->SdMmcMemSize = SIZE_1KB;
> +    SdMmc->SdMmcDmaType = NonDiscoverableDeviceDmaTypeCoherent;
> +    SdMmc++;
> +  }
>  
>    return EFI_SUCCESS;
>  }
> diff --git a/Silicon/Marvell/Library/MppLib/MppLib.c b/Silicon/Marvell/Library/MppLib/MppLib.c
> index 40d9077..f20668d 100644
> --- a/Silicon/Marvell/Library/MppLib/MppLib.c
> +++ b/Silicon/Marvell/Library/MppLib/MppLib.c
> @@ -139,11 +139,9 @@ SetSdMmcPhyMpp (
>    case 0:
>      Offset = SD_MMC_PHY_AP_MPP_OFFSET;
>      break;
> -  case 1:
> +  default:
>      Offset = SD_MMC_PHY_CP0_MPP_OFFSET;
>      break;
> -  default:
> -    return;
>    }
>  
>    /*
> -- 
> 2.7.4
> 

  reply	other threads:[~2019-10-10 22:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10  5:42 [edk2-platforms: PATCH v3 0/9] Marvell Octeon CN913X SoC family support Marcin Wojtas
2019-10-10  5:42 ` [edk2-platforms: PATCH v3 1/9] Marvell/Armada7k8k: Fix 32-bit compilation Marcin Wojtas
2019-10-10 22:47   ` Leif Lindholm
2019-10-10  5:42 ` [edk2-platforms: PATCH v3 2/9] Marvell/Cn9130Db: Add ACPI tables Marcin Wojtas
2019-10-10  5:42 ` [edk2-platforms: PATCH v3 3/9] Marvell/Cn9130Db: Introduce board support Marcin Wojtas
2019-10-10 22:52   ` Leif Lindholm
2019-10-10  5:42 ` [edk2-platforms: PATCH v3 4/9] Marvell/Library: ArmadaSoCDescLib/MppLib: Extend Xenon information Marcin Wojtas
2019-10-10 22:55   ` Leif Lindholm [this message]
2019-10-10  5:42 ` [edk2-platforms: PATCH v3 5/9] Marvell/Library: IcuLib: Fix debug information Marcin Wojtas
2019-10-10  5:42 ` [edk2-platforms: PATCH v3 6/9] Marvell/Cn9131Db: Introduce board support Marcin Wojtas
2019-10-10 22:56   ` Leif Lindholm
2019-10-10  5:42 ` [edk2-platforms: PATCH v3 7/9] Marvell/Cn9132Db: " Marcin Wojtas
2019-10-10 22:57   ` Leif Lindholm
2019-10-10  5:42 ` [edk2-platforms: PATCH v3 8/9] Marvell/Drivers: SmbiosPlatformDxe: Load SMBIOS strings from PCD Marcin Wojtas
2019-10-10 23:04   ` Leif Lindholm
2019-10-10 23:33     ` Marcin Wojtas
2019-10-10 23:51       ` Leif Lindholm
2019-10-11  7:30         ` Marcin Wojtas
2019-10-11  8:17           ` Marcin Wojtas
2019-10-10  5:42 ` [edk2-platforms: PATCH v3 9/9] Marvell: Customize per-board SBMIOS strings Marcin Wojtas
2019-10-10 23:07   ` Leif Lindholm
2019-10-10 23:16     ` 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=20191010225545.GU25504@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