public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: zwei4 <david.wei@intel.com>
To: edk2-devel@lists.01.org
Cc: Mike Wu <mike.wu@intel.com>,
	Benjamin You <benjamin.you@intel.com>,
	Mang Guo <mang.guo@intel.com>, Shifei Lu <shifeix.a.lu@intel.com>,
	Ruth Li <ruth.li@intel.com>
Subject: [Patch][edk2-platforms/devel-MinnowBoard3] Enable SD card.
Date: Tue, 17 Jan 2017 14:05:31 +0800	[thread overview]
Message-ID: <20170117060531.2460-1-david.wei@intel.com> (raw)

Fixed the issue that SD card cannot be detected by BIOS. Add SD host and device drivers.

Signed-off-by: zwei4 <david.wei@intel.com>
Cc: Mike Wu <mike.wu@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Shifei Lu <shifeix.a.lu@intel.com>
Cc: Ruth Li <ruth.li@intel.com>
---
 .../Common/PlatformSettings/PlatformDxe/Platform.c | 47 ++++++++++++++++++++++
 .../PlatformSettings/PlatformDxe/PlatformDxe.inf   |  1 +
 .../BroxtonPlatformPkg/PlatformDsc/Components.dsc  |  4 ++
 Platform/BroxtonPlatformPkg/PlatformPkg.fdf        |  3 ++
 4 files changed, 55 insertions(+)

diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c
index e034e6ed8..02dcc2750 100644
--- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c
+++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platform.c
@@ -641,6 +641,50 @@ InitPlatformResolution (
   PcdSet32S (PcdVideoVerticalResolution, PanelResolution[mSystemConfiguration.IgdFlatPanel].VerticalResolution);
 }
 
+VOID 
+OverrideSdCardPresence (
+  VOID
+  )
+{
+  UINT32 PciP2sbBar0RegOffset;
+  UINT32 P2sbMmioBar;
+  UINT32 Gpio177PadConfigDW0RegAdd;
+  UINT32 Gpio177RxState;
+
+  PciP2sbBar0RegOffset = (UINT32) MmPciAddress (
+                                    0,
+                                    DEFAULT_PCI_BUS_NUMBER_SC,
+                                    PCI_DEVICE_NUMBER_P2SB,
+                                    PCI_FUNCTION_NUMBER_P2SB,
+                                    R_P2SB_BASE
+                                    );
+  //
+  // Read back P2SB MMIO BAR Base Addr
+  //
+  P2sbMmioBar = MmioRead32 (PciP2sbBar0RegOffset);
+  if (P2sbMmioBar == 0xFFFFFFFF) {
+    //
+    // P2SB has been hidden, read it from Pcd
+    //
+    P2sbMmioBar = PcdGet32 (PcdP2SBBaseAddress);
+  } else {
+    P2sbMmioBar &= B_P2SB_BAR_BA;
+  }
+  
+  Gpio177PadConfigDW0RegAdd = P2SB_MMIO_ADDR (P2sbMmioBar, SOUTHWEST, 0x5D0);
+  Gpio177RxState = MmioRead32(Gpio177PadConfigDW0RegAdd) & BIT1;
+  DEBUG ((DEBUG_INFO, "Gpio177PadConfigDW0RegAdd: 0x%X\n", Gpio177PadConfigDW0RegAdd));
+  DEBUG ((DEBUG_INFO, "Gpio177RxState: 0x%X\n", Gpio177RxState));
+
+  if (Gpio177RxState == 0x00) {
+    SideBandAndThenOr32 (
+      0xD6,
+      0x0600 + 0x08,
+      0xFFFFFFFF,
+      BIT5
+      );
+  };
+}
 
 /**
   This is the standard EFI driver point for the Driver. This
@@ -872,6 +916,9 @@ InitializePlatform (
                   &EfiExitBootServicesEvent
                   );
 
+  
+  OverrideSdCardPresence(); 
+        
   return EFI_SUCCESS;
 }
 
diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf
index e00588170..c2714a6ae 100644
--- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf
+++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.inf
@@ -127,6 +127,7 @@
   gEfiBxtTokenSpaceGuid.PcdPmcGcrBaseAddress
   gPlatformModuleTokenSpaceGuid.PcdPBTNDisableInterval
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdFastPS2Detection
+  gEfiBxtTokenSpaceGuid.PcdP2SBBaseAddress
 
 [Depex]
   gEfiPciRootBridgeIoProtocolGuid     AND
diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc
index 53658cf79..0edcd9867 100644
--- a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc
+++ b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc
@@ -353,6 +353,10 @@
   $(PLATFORM_SI_PACKAGE)/SouthCluster/Sdio/Dxe/MMC/MmcHostDxe/MmcHostDxe.inf
 
   $(PLATFORM_SI_PACKAGE)/SouthCluster/Sdio/Dxe/MMC/MmcMediaDeviceDxe/MmcMediaDeviceDxe.inf
+  
+  $(PLATFORM_SI_PACKAGE)/SouthCluster/Sdio/Dxe/SD/SdControllerDxe/SdControllerDxe.inf
+  $(PLATFORM_SI_PACKAGE)/SouthCluster/Sdio/Dxe/SD/SdMediaDeviceDxe/SdMediaDeviceDxe.inf
+    
 
   !if $(ACPI50_ENABLE) == TRUE
     MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferDxe.inf
diff --git a/Platform/BroxtonPlatformPkg/PlatformPkg.fdf b/Platform/BroxtonPlatformPkg/PlatformPkg.fdf
index 0d9a087f3..404efd156 100644
--- a/Platform/BroxtonPlatformPkg/PlatformPkg.fdf
+++ b/Platform/BroxtonPlatformPkg/PlatformPkg.fdf
@@ -447,6 +447,9 @@ APRIORI DXE {
   INF $(PLATFORM_SI_PACKAGE)/SouthCluster/Sdio/Dxe/MMC/MmcMediaDeviceDxe/MmcMediaDeviceDxe.inf
 !endif
 
+  INF $(PLATFORM_SI_PACKAGE)/SouthCluster/Sdio/Dxe/SD/SdControllerDxe/SdControllerDxe.inf
+  INF $(PLATFORM_SI_PACKAGE)/SouthCluster/Sdio/Dxe/SD/SdMediaDeviceDxe/SdMediaDeviceDxe.inf
+    
   INF IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
 
   #
-- 
2.11.0.windows.1



                 reply	other threads:[~2017-01-17  6:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20170117060531.2460-1-david.wei@intel.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