/* Get the target clock frequency to be set on the bus. */
UINT32 SdGetTargetBusClockFreq(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN SD_MMC_BUS_MODE BusTiming)
/* Get the target clock frequency to be set on the bus. */
UINT32 SdGetTargetBusClockFreq(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN SD_MMC_BUS_MODE BusTiming)
{
  UINT32  PreferredClockFreq;
  UINT32  MaxClockFreq;
  PreferredClockFreq = Private->Slot[SlotIndex].OperatingParameters.ClockFreq;
  switch (BusTiming) {
    case SdMmcUhsSdr104:
      MaxClockFreq = 208;
      break;
    case SdMmcUhsSdr50:
      MaxClockFreq = 100;
      break;
    case SdMmcUhsDdr50:
    case SdMmcUhsSdr25:
    case SdMmcSdHs:
      MaxClockFreq = 50;
      break;
    case SdMmcUhsSdr12:
    case SdMmcSdDs:
    default:
      MaxClockFreq = 25;
  }
  if ((PreferredClockFreq != EDKII_SD_MMC_CLOCK_FREQ_IGNORE) && (PreferredClockFreq < MaxClockFreq)) {
    return PreferredClockFreq;
  } else {
    return MaxClockFreq;
  }
}