[edk2-devel] [PATCH v3 5/7] Platform/RaspberryPi/Arasan: Select the correct base frequency

Jeremy Linton jeremy.linton at arm.com
Mon Jan 4 17:37:29 UTC 2021


The firmware reports the emmc2 frequency with a slightly
different mailbox command, lets select the correct one
based on which controller we are binding to.

Signed-off-by: Jeremy Linton <jeremy.linton at arm.com>
Reviewed-by: Andrei Warkentin <awarkentin at vmware.com>
---
 .../RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.c    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.c b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.c
index a7b538a91a..b0f03cefc9 100644
--- a/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.c
+++ b/Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.c
@@ -250,7 +250,11 @@ CalculateClockFrequencyDivisor (
   UINT32 Divisor;
   UINT32 BaseFrequency = 0;
 
-  Status = mFwProtocol->GetClockRate (RPI_MBOX_CLOCK_RATE_EMMC, &BaseFrequency);
+  if (PcdGet32 (PcdSdIsArasan)) {
+    Status = mFwProtocol->GetClockRate (RPI_MBOX_CLOCK_RATE_EMMC, &BaseFrequency);
+  } else {
+    Status = mFwProtocol->GetClockRate (RPI_MBOX_CLOCK_RATE_EMMC2, &BaseFrequency);
+  }
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "Couldn't get RPI_MBOX_CLOCK_RATE_EMMC\n"));
     return Status;
@@ -472,8 +476,8 @@ MMCNotifyState (
   switch (State) {
   case MmcHwInitializationState:
     {
-      EFI_STATUS Status;
-      UINT32 Divisor;
+
+      DEBUG ((DEBUG_MMCHOST_SD, "ArasanMMCHost: current divisor %x\n", MmioRead32(MMCHS_SYSCTL)));
 
       Status = SoftReset (SRA);
       if (EFI_ERROR (Status)) {
-- 
2.13.7



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69609): https://edk2.groups.io/g/devel/message/69609
Mute This Topic: https://groups.io/mt/79429632/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list