public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Marcin Wojtas" <mw@semihalf.com>
To: devel@edk2.groups.io
Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org,
	mw@semihalf.com, jsd@semihalf.com, jaz@semihalf.com,
	kostap@marvell.com
Subject: [edk2-platforms: PATCH 4/9] Marvell/Library: ArmadaSoCDescLib: Extend Xenon information
Date: Thu,  8 Aug 2019 01:30:25 +0200	[thread overview]
Message-ID: <1565220630-1653-5-git-send-email-mw@semihalf.com> (raw)
In-Reply-To: <1565220630-1653-1-git-send-email-mw@semihalf.com>

Hitherto SoC description library code assumed that there could
be only two Xenon SdMmc controller instances in the SoC. Remove this
limitation, so that to support CN913x SoCs, which may have up to 4 of
such interfaces.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
 Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h |  5 +--
 Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 34 +++++++++++++-------
 2 files changed, 25 insertions(+), 14 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;
 }
-- 
2.7.4


  parent reply	other threads:[~2019-08-07 23:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07 23:30 [edk2-platforms: PATCH 0/9] Marvell Octeon CN913X SoC family support Marcin Wojtas
2019-08-07 23:30 ` [edk2-platforms: PATCH 1/9] Marvell/Cn9130Db: Add ACPI tables Marcin Wojtas
2019-08-07 23:30 ` [edk2-platforms: PATCH 2/9] Marvell/Cn9130Db: Add DeviceTree Marcin Wojtas
2019-08-07 23:30 ` [edk2-platforms: PATCH 3/9] Marvell/Cn9130Db: Introduce board support Marcin Wojtas
2019-08-07 23:30 ` Marcin Wojtas [this message]
2019-08-07 23:30 ` [edk2-platforms: PATCH 5/9] Marvell/Library: MppLib: Allow to configure more Xenon PHYs Marcin Wojtas
2019-08-07 23:30 ` [edk2-platforms: PATCH 6/9] Marvell/Library: IcuLib: Fix debug information Marcin Wojtas
2019-08-07 23:30 ` [edk2-platforms: PATCH 7/9] Marvell/Cn9131Db: Introduce board support Marcin Wojtas
2019-08-07 23:30 ` [edk2-platforms: PATCH 8/9] Marvell/Cn9132Db: " Marcin Wojtas
2019-08-07 23:30 ` [edk2-platforms: PATCH 9/9] Marvell/Drivers: SmbiosPlatformDxe: Use more generic board name Marcin Wojtas
2019-08-08 11:51 ` [edk2-platforms: PATCH 0/9] Marvell Octeon CN913X SoC family support Leif Lindholm
2019-08-08 13:51   ` Marcin Wojtas
2019-08-08 16:48     ` Leif Lindholm
2019-08-08 17:05       ` Marcin Wojtas
2019-08-08 17:53         ` Leif Lindholm
2019-08-09  6:36           ` 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=1565220630-1653-5-git-send-email-mw@semihalf.com \
    --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