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@nuviainc.com, ardb+tianocore@kernel.org, mw@semihalf.com,
	jaz@semihalf.com, kostap@marvell.com, upstream@semihalf.com
Subject: [edk2-platforms PATCH 5/6] Marvell/Cn913xDb: Update AP807 MMC settings
Date: Mon, 19 Apr 2021 10:49:00 +0200	[thread overview]
Message-ID: <20210419084901.380576-6-mw@semihalf.com> (raw)
In-Reply-To: <20210419084901.380576-1-mw@semihalf.com>

This patch enables switching to 1.8V power supply
on the VCCQ rail of the AP807 MMC interface,
which allows to operate at HS400 when booting with
ACPI. Since there are issues with this mode in
EDK2 Xenon SD/MMC driver apply a workaround, that
limits the mode to HS200 by forcing bus width to 4.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
 Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.h |  1 +
 Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.c     |  8 +++++--
 Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.c | 23 ++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.h b/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.h
index a641420ef7..00449d4390 100644
--- a/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.h
+++ b/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.h
@@ -13,6 +13,7 @@
 #define CN9130_DB_VBUS0_LIMIT_PIN    4
 #define CN9130_DB_VBUS1_PIN          1
 #define CN9130_DB_VBUS1_LIMIT_PIN    5
+#define CN9130_DB_AP_MMC_VCCQ_PIN    8
 #define CN9130_DB_SDMMC_VCC_PIN      14
 #define CN9130_DB_SDMMC_VCCQ_PIN     15
 #define CN9131_DB_VBUS0_PIN          3
diff --git a/Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.c b/Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.c
index 2b46d141cd..2755600f53 100644
--- a/Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.c
+++ b/Platform/Marvell/Cn913xDb/BoardDescriptionLib/Cn9130DbABoardDescLib.c
@@ -95,8 +95,12 @@ MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = {
   { /* eMMC 0xF06E0000 */
     0,     /* SOC will be filled by MvBoardDescDxe */
     0,     /* SdMmcDevCount will be filled by MvBoardDescDxe */
-    FALSE, /* Xenon1v8Enabled */
-    TRUE,  /* Xenon8BitBusEnabled */
+    TRUE,  /* Xenon1v8Enabled */
+    /*
+     * Force 4-bit bus width - work-around for non
+     * functional HS400 mode.
+     */
+    FALSE, /* Xenon8BitBusEnabled */
     FALSE, /* XenonSlowModeEnabled */
     0x40,  /* XenonTuningStepDivisor */
     EmbeddedSlot /* SlotType */
diff --git a/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.c b/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.c
index 42dc54a892..965d8efe57 100644
--- a/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.c
+++ b/Platform/Marvell/Cn913xDb/NonDiscoverableInitLib/NonDiscoverableInitLib.c
@@ -157,6 +157,27 @@ Cp2XhciInit (
            MV_GPIO_DRIVER_TYPE_SOC_CONTROLLER);
 }
 
+STATIC CONST MV_GPIO_PIN mApSdMmcPins[] = {
+  {
+    MV_GPIO_DRIVER_TYPE_PCA95XX,
+    CN9130_DB_IO_EXPANDER0,
+    CN9130_DB_AP_MMC_VCCQ_PIN,
+    TRUE,
+  },
+};
+
+STATIC
+EFI_STATUS
+EFIAPI
+ApSdMmcInit (
+  IN  NON_DISCOVERABLE_DEVICE  *This
+  )
+{
+  return ConfigurePins (mApSdMmcPins,
+           ARRAY_SIZE (mApSdMmcPins),
+           MV_GPIO_DRIVER_TYPE_PCA95XX);
+}
+
 STATIC CONST MV_GPIO_PIN mCp0SdMmcPins[] = {
   {
     MV_GPIO_DRIVER_TYPE_PCA95XX,
@@ -206,6 +227,8 @@ NonDiscoverableDeviceInitializerGet (
 
   if (Type == NonDiscoverableDeviceTypeSdhci) {
     switch (Index) {
+    case 0:
+      return ApSdMmcInit;
     case 1:
       return Cp0SdMmcInit;
     }
-- 
2.29.0


  parent reply	other threads:[~2021-04-19  8:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19  8:48 [edk2-platforms PATCH 0/6] Marvell SD/MMC updates Marcin Wojtas
2021-04-19  8:48 ` [edk2-platforms PATCH 1/6] Marvell/Armada80x0Db: Update CP0 MMC settings Marcin Wojtas
2021-04-19  8:48 ` [edk2-platforms PATCH 2/6] Marvell/Armada80x0Db: Introduce SD/MMC ACPI description Marcin Wojtas
2021-04-19  8:48 ` [edk2-platforms PATCH 3/6] Marvell/Armada70x0Db: Update CP0 MMC settings Marcin Wojtas
2021-04-19  8:48 ` [edk2-platforms PATCH 4/6] Marvell/Armada70x0Db: Introduce SD/MMC ACPI description Marcin Wojtas
2021-04-19  8:49 ` Marcin Wojtas [this message]
2021-04-19  8:49 ` [edk2-platforms PATCH 6/6] Marvell/Cn913xDb: " Marcin Wojtas
2021-04-19  8:52 ` [edk2-platforms PATCH 0/6] Marvell SD/MMC updates Marcin Wojtas
2021-04-30 18:04   ` Marcin Wojtas
2021-05-10 16:07     ` Ard Biesheuvel
2021-05-10 16:08       ` 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=20210419084901.380576-6-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