From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: mateusz.albecki@intel.com) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by groups.io with SMTP; Thu, 26 Sep 2019 07:28:41 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2019 07:28:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,552,1559545200"; d="scan'208";a="364746480" Received: from gklab-27-32.ger.corp.intel.com ([10.102.28.45]) by orsmga005.jf.intel.com with ESMTP; 26 Sep 2019 07:28:36 -0700 From: "Albecki, Mateusz" To: devel@edk2.groups.io Cc: "Albecki, Mateusz" , Hao A Wu , Marcin Wojtas Subject: [PATCHv2 3/3] MdeModulePkg/SdMmcPciHcDxe: Fix SdMmcMmcLegacy bus timing handling Date: Thu, 26 Sep 2019 16:27:44 +0200 Message-Id: <20190926142744.3356-4-mateusz.albecki@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 In-Reply-To: <20190926142744.3356-1-mateusz.albecki@intel.com> References: <20190926142744.3356-1-mateusz.albecki@intel.com> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2218 There is a bug in current driver code that makes it impossible for it to work with devices that only work in legacy speed mode since the function EmmcSwitchToHighSpeed will return with EFI_INVALID_ARGUMENT for such bus mode. Since the logic in that function will work well for SdMmcMmcLegacy this patch just allows to call this function with SdMmcMmcLegacy bus mode. Signed-off-by: Mateusz Albecki Cc: Hao A Wu Cc: Marcin Wojtas --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c index 3598a8538a..082904ccc5 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c @@ -794,7 +794,7 @@ EmmcSwitchToHighSpeed ( EFI_STATUS Status; BOOLEAN IsDdr; - if ((BusMode->BusTiming != SdMmcMmcHsSdr && BusMode->BusTiming != SdMmcMmcHsDdr) || + if ((BusMode->BusTiming != SdMmcMmcHsSdr && BusMode->BusTiming != SdMmcMmcHsDdr && BusMode->BusTiming != SdMmcMmcLegacy) || BusMode->ClockFreq > 52) { return EFI_INVALID_PARAMETER; } @@ -1244,6 +1244,12 @@ EmmcSetBusMode ( } else if (BusMode.BusTiming == SdMmcMmcHs200) { Status = EmmcSwitchToHS200 (PciIo, PassThru, Slot, Rca, &BusMode); } else { + // + // Note that EmmcSwitchToHighSpeed is also called for SdMmcMmcLegacy + // bus timing. This is because even though we might not want to + // change the timing itself we still want to allow customization of + // bus parameters such as clock frequency and bus width. + // Status = EmmcSwitchToHighSpeed (PciIo, PassThru, Slot, Rca, &BusMode); } -- 2.14.1.windows.1 -------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.