/* Get the target bus timing to set on the link. This function will try to select highest bus timing supported by card, controller and the driver. */
SD_MMC_BUS_MODE SdGetTargetBusTiming(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN UINT8 CardSupportedBusTimings, IN BOOLEAN IsInUhsI)
/* Get the target bus timing to set on the link. This function will try to select highest bus timing supported by card, controller and the driver. */
SD_MMC_BUS_MODE SdGetTargetBusTiming(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN UINT8 CardSupportedBusTimings, IN BOOLEAN IsInUhsI)
{
  SD_MMC_BUS_MODE  BusTiming;
  if (IsInUhsI) {
    BusTiming = SdMmcUhsSdr104;
  } else {
    BusTiming = SdMmcSdHs;
  }
  while (BusTiming > SdMmcSdDs) {
    if (SdIsBusTimingSupported (Private, SlotIndex, CardSupportedBusTimings, IsInUhsI, BusTiming)) {
      break;
    }
    BusTiming--;
  }
  return BusTiming;
}