/* Refer to EMMC Electrical Standard Spec 5.1 Section 6.6.8 and SD Host Controller Simplified Spec 3.0 Figure 2-29 for details. */
EFI_STATUS EmmcSwitchToHS200(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, IN SD_MMC_BUS_SETTINGS *BusMode)
/* Refer to EMMC Electrical Standard Spec 5.1 Section 6.6.8 and SD Host Controller Simplified Spec 3.0 Figure 2-29 for details. */
EFI_STATUS EmmcSwitchToHS200(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, IN SD_MMC_BUS_SETTINGS *BusMode)
{
  EFI_STATUS  Status;
  if ((BusMode->BusTiming != SdMmcMmcHs200) ||
      ((BusMode->BusWidth != 4) && (BusMode->BusWidth != 8)))
  {
    return EFI_INVALID_PARAMETER;
  }
  Status = EmmcSwitchBusWidth (PciIo, PassThru, Slot, Rca, FALSE, BusMode->BusWidth);
  if (EFI_ERROR (Status)) {
    return Status;
  }
  Status = EmmcSwitchBusTiming (PciIo, PassThru, Slot, Rca, BusMode->DriverStrength, BusMode->BusTiming, BusMode->ClockFreq);
  if (EFI_ERROR (Status)) {
    return Status;
  }
  Status = EmmcTuningClkForHs200 (PciIo, PassThru, Slot, BusMode->BusWidth);
  return Status;
}