From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web11.920.1577155953018329186 for ; Mon, 23 Dec 2019 18:52:33 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: hao.a.wu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Dec 2019 18:52:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,350,1571727600"; d="scan'208";a="268308313" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by FMSMGA003.fm.intel.com with ESMTP; 23 Dec 2019 18:52:32 -0800 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Dec 2019 18:52:32 -0800 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Dec 2019 18:52:32 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.90]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.71]) with mapi id 14.03.0439.000; Tue, 24 Dec 2019 10:52:29 +0800 From: "Wu, Hao A" To: "Albecki, Mateusz" , "devel@edk2.groups.io" CC: Marcin Wojtas , "Gao, Zhichao" , "Gao, Liming" , Ard Biesheuvel Subject: Re: [PATCH 2/2] MdeModulePkg/SdMmcPciHcDxe: Add function to start SD clock Thread-Topic: [PATCH 2/2] MdeModulePkg/SdMmcPciHcDxe: Add function to start SD clock Thread-Index: AQHVt1kCEp5LeFVru02krZ4hI7/qpqfIk+hw Date: Tue, 24 Dec 2019 02:52:29 +0000 Message-ID: References: <20191220171312.3120-1-mateusz.albecki@intel.com> <20191220171312.3120-3-mateusz.albecki@intel.com> In-Reply-To: <20191220171312.3120-3-mateusz.albecki@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Albecki, Mateusz > Sent: Saturday, December 21, 2019 1:13 AM > To: devel@edk2.groups.io > Cc: Albecki, Mateusz; Wu, Hao A; Marcin Wojtas; Gao, Zhichao; Gao, Liming > Subject: [PATCH 2/2] MdeModulePkg/SdMmcPciHcDxe: Add function to start > SD clock >=20 > In SD card voltage switch flow we used to redo the > entire internal clock setup after voltage switch. > Since internal clock has already been setup this > is wasting time on polling the internal clock stable. > This commit changes it to only start the SD clock. Reviewed-by: Hao A Wu Let us wait to see if other reviewers have additional comments. Best Regards, Hao Wu >=20 > Cc: Hao A Wu > Cc: Marcin Wojtas > Cc: Zhichao Gao > Cc: Liming Gao >=20 > Signed-off-by: Mateusz Albecki > --- > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 11 +++----- > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 33 > ++++++++++++++++++++---- > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h | 15 +++++++++++ > 3 files changed, 47 insertions(+), 12 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > index d63dc54e8c..b630daab76 100644 > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > @@ -1327,13 +1327,10 @@ SdCardIdentification ( > goto Error; > } >=20 > - // > - // Restart the clock with first time parameters. > - // NOTE: it is not required to actually restart the clock > - // and go through internal clock setup again. Some time > - // could be saved if we simply started the SD clock. > - // > - SdMmcHcClockSupply (Private, Slot, 0, TRUE, 400); > + Status =3D SdMmcHcStartSdClock (PciIo, Slot); > + if (EFI_ERROR (Status)) { > + goto Error; > + } >=20 > gBS->Stall (1000); >=20 > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > index f667264c5e..e7f2fac69b 100644 > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > @@ -758,6 +758,30 @@ SdMmcHcStopClock ( > return Status; > } >=20 > +/** > + Start the SD clock. > + > + @param[in] PciIo The PCI IO protocol instance. > + @param[in] Slot The slot number. > + > + @retval EFI_SUCCESS Succeeded to start the SD clock. > + @rtval Others Failed to start the SD clock. > +**/ > +EFI_STATUS > +SdMmcHcStartSdClock ( > + IN EFI_PCI_IO_PROTOCOL *PciIo, > + IN UINT8 Slot > + ) > +{ > + UINT16 ClockCtrl; > + > + // > + // Set SD Clock Enable in the Clock Control register to 1 > + // > + ClockCtrl =3D BIT2; > + return SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_CLOCK_CTRL, sizeof > (ClockCtrl), &ClockCtrl); > +} > + > /** > SD/MMC card clock supply. >=20 > @@ -879,11 +903,10 @@ SdMmcHcClockSupply ( > return Status; > } >=20 > - // > - // Set SD Clock Enable in the Clock Control register to 1 > - // > - ClockCtrl =3D BIT2; > - Status =3D SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_CLOCK_CTRL, sizeof > (ClockCtrl), &ClockCtrl); > + Status =3D SdMmcHcStartSdClock (PciIo, Slot); > + if (EFI_ERROR (Status)) { > + return Status; > + } >=20 > // > // We don't notify the platform on first time setup to avoid changing > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h > index 826e851b04..4753bb6864 100644 > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h > @@ -478,6 +478,21 @@ SdMmcHcStopClock ( > IN UINT8 Slot > ); >=20 > +/** > + Start the SD clock. > + > + @param[in] PciIo The PCI IO protocol instance. > + @param[in] Slot The slot number. > + > + @retval EFI_SUCCESS Succeeded to start the SD clock. > + @rtval Others Failed to start the SD clock. > +**/ > +EFI_STATUS > +SdMmcHcStartSdClock ( > + IN EFI_PCI_IO_PROTOCOL *PciIo, > + IN UINT8 Slot > + ); > + > /** > SD/MMC bus power control. >=20 > -- > 2.14.1.windows.1