Browse Source

Platform/RaspberryPi/Arasan: Select the correct base frequency

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@arm.com>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Jeremy Linton 3 years ago
parent
commit
a50f14a301
1 changed files with 7 additions and 3 deletions
  1. 7 3
      Platform/RaspberryPi/Drivers/ArasanMmcHostDxe/ArasanMmcHostDxe.c

+ 7 - 3
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)) {