From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2607:f8b0:4864:20::143; helo=mail-it1-x143.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-it1-x143.google.com (mail-it1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7FCCA2118B65D for ; Thu, 8 Nov 2018 03:18:18 -0800 (PST) Received: by mail-it1-x143.google.com with SMTP id j79-v6so1054104itb.2 for ; Thu, 08 Nov 2018 03:18:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=fexQlJN6pyflpUrVvcYd7JMOE/6XAUv/7MhHWDnG/74=; b=FcPNnCvFfG8TthV5A2gV8Vqw2rNDpUSxhjqvGIkuugRguIH5JS0eRSGkEOZJf41Jqc 9kmlOsv8DUr2kJjqu0aJHTDjg7j8M2Y1KPKmA0NQ8QcVVA9eqi2OeB8Cck1jaza/Fyp7 0NVJDN19govL4sjGRl5CohFJy/nf2kASskDjlEbPMRE1c5lQkztw68M8GKr1oxEJi8xG 9ttI4Ra/dT8Hc9qDugqcmAdeLdnRCw2UVxDYT0VsaqbVAW6Me9ixsxug1b/42P+jcHnb SRU2P73RIic3FHyvkJsDIFkng7SXcecfs5xvoeVooLlyPcVD66+Kl8xGySJaOkmuKKnt /16w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=fexQlJN6pyflpUrVvcYd7JMOE/6XAUv/7MhHWDnG/74=; b=h5zOSElTSMbIc7kMCk1CH55W+6nCdD+rV5SwtCzFrOvp7uvNZn4p5yQWR+SQNpJIG6 A2K4Cl5b0Pr2ImryI9dpX+Cjtj+Ac+jJou2LN/NEDNxJiOHkugGd6mf9GbFdxiiSUshB BsbhsgLnQEsCiTTZdpm4QlakYMNKOhqS0UIbpdiQ6jZwybOXW5H1EQVFRVUyjJVEBPvB mklqBhT8evXYjqtD6/nhthm8maKryL9dmGOWNv86/fhgXVQF9XxKeIi+FHs+VIYKPSTM 3pjwvhLuoEfUAiww+e+MH/egz77gnOjpZVMKdFB5XDhbpS514r6YUVdz8vAhX+ZqdYpA GZSw== X-Gm-Message-State: AGRZ1gKz/4P7b2ANwhju8V121WYPvJxVtlPmR1NZX1wrcBTLj1EuiIOd IwMR57SE4NZssvkglyBW/QwSs5kcdPv1kUFSIl1YvA== X-Google-Smtp-Source: AJdET5d/dSoP6rYUWppXyNtahh7W3/4gNwYcWrDorw2ZyNJ1zKC/09XvJ662P+ktrrVWWmkNIBT0xrtAsTPr/9x7DdE= X-Received: by 2002:a24:a10:: with SMTP id 16-v6mr532715itw.145.1541675897749; Thu, 08 Nov 2018 03:18:17 -0800 (PST) MIME-Version: 1.0 References: <1541642255-15602-1-git-send-email-mw@semihalf.com> <1541642255-15602-4-git-send-email-mw@semihalf.com> In-Reply-To: From: Marcin Wojtas Date: Thu, 8 Nov 2018 12:18:06 +0100 Message-ID: To: Ard Biesheuvel Cc: edk2-devel-01 , Leif Lindholm , hao.a.wu@intel.com, "Kinney, Michael D" , "Gao, Liming" , nadavh@marvell.com, "jsd@semihalf.com" , Tomasz Michalec , Grzegorz Jaszczyk Subject: Re: [PATCH v3 3/4] MdeModulePkg/SdMmcPciHcDxe: Add SwitchClockFreqPost to SdMmcOverride X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Nov 2018 11:18:18 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable czw., 8 lis 2018 o 12:09 Ard Biesheuvel napisa= =C5=82(a): > > On 8 November 2018 at 02:57, Marcin Wojtas wrote: > > From: Tomasz Michalec > > > > Some SD Host Controlers need to do additional opperations after clock > > frequency switch. > > > > This patch add new callback type to NotifyPhase of the SdMmcOverride > > protocol. It is called after EmmcSwitchClockFreq and SdMmcHcClockSupply= . > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > MdeModulePkg/Include/Protocol/SdMmcOverride.h | 1 + > > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c | 60 +++++++++++++++++= +++ > > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 18 ++++++ > > 3 files changed, 79 insertions(+) > > > > diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h b/MdeModuleP= kg/Include/Protocol/SdMmcOverride.h > > index f948bef..6160b5b 100644 > > --- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h > > +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h > > @@ -48,6 +48,7 @@ typedef enum { > > EdkiiSdMmcInitHostPre, > > EdkiiSdMmcInitHostPost, > > EdkiiSdMmcUhsSignaling, > > + EdkiiSdMmcSwitchClockFreqPost, > > } EDKII_SD_MMC_PHASE_TYPE; > > > > /** > > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c b/MdeModul= ePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c > > index 473df8d..6fc6871 100755 > > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c > > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c > > @@ -794,6 +794,27 @@ EmmcSwitchToHighSpeed ( > > > > HsTiming =3D 1; > > Status =3D EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming= , ClockFreq); > > + if (EFI_ERROR (Status)) { > > + return Status; > > + } > > + > > + if (mOverride !=3D NULL && mOverride->NotifyPhase !=3D NULL) { > > + Status =3D mOverride->NotifyPhase ( > > + Private->ControllerHandle, > > + Slot, > > + EdkiiSdMmcSwitchClockFreqPost, > > + &Timing > > + ); > > + if (EFI_ERROR (Status)) { > > + DEBUG (( > > + DEBUG_ERROR, > > + "%a: SD/MMC switch clock freq post notifier callback failed - = %r\n", > > + __FUNCTION__, > > + Status > > + )); > > + return Status; > > + } > > + } > > Is there a way we could move this into EmmcSwitchClockFreq() rather > than duplicate it? > Yes, it will only require modifying EmmcSwitchClockFreq argument list, but this is no cost. > > > > return Status; > > } > > @@ -904,6 +925,24 @@ EmmcSwitchToHS200 ( > > return Status; > > } > > > > + if (mOverride !=3D NULL && mOverride->NotifyPhase !=3D NULL) { > > + Status =3D mOverride->NotifyPhase ( > > + Private->ControllerHandle, > > + Slot, > > + EdkiiSdMmcSwitchClockFreqPost, > > + &Timing > > + ); > > + if (EFI_ERROR (Status)) { > > + DEBUG (( > > + DEBUG_ERROR, > > + "%a: SD/MMC switch clock freq post notifier callback failed - = %r\n", > > + __FUNCTION__, > > + Status > > + )); > > + return Status; > > + } > > + } > > + > > Status =3D EmmcTuningClkForHs200 (PciIo, PassThru, Slot, BusWidth); > > > > return Status; > > @@ -988,6 +1027,27 @@ EmmcSwitchToHS400 ( > > > > HsTiming =3D 3; > > Status =3D EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming= , ClockFreq); > > + if (EFI_ERROR (Status)) { > > + return Status; > > + } > > + > > + if (mOverride !=3D NULL && mOverride->NotifyPhase !=3D NULL) { > > + Status =3D mOverride->NotifyPhase ( > > + Private->ControllerHandle, > > + Slot, > > + EdkiiSdMmcSwitchClockFreqPost, > > + &Timing > > + ); > > + if (EFI_ERROR (Status)) { > > + DEBUG (( > > + DEBUG_ERROR, > > + "%a: SD/MMC switch clock freq post notifier callback failed - = %r\n", > > + __FUNCTION__, > > + Status > > + )); > > + return Status; > > + } > > + } > > > > return Status; > > } > > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c b/MdeModuleP= kg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > > index 850ad26..5408bbc 100644 > > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > > @@ -887,6 +887,24 @@ SdCardSetBusMode ( > > return Status; > > } > > > > + if (mOverride !=3D NULL && mOverride->NotifyPhase !=3D NULL) { > > + Status =3D mOverride->NotifyPhase ( > > + Private->ControllerHandle, > > + Slot, > > + EdkiiSdMmcSwitchClockFreqPost, > > + &Timing > > + ); > > + if (EFI_ERROR (Status)) { > > + DEBUG (( > > + DEBUG_ERROR, > > + "%a: SD/MMC switch clock freq post notifier callback failed - = %r\n", > > + __FUNCTION__, > > + Status > > + )); > > + return Status; > > + } > > + } > > + > > if ((AccessMode =3D=3D 3) || ((AccessMode =3D=3D 2) && (Capability->= TuningSDR50 !=3D 0))) { > > Status =3D SdCardTuningClock (PciIo, PassThru, Slot); > > if (EFI_ERROR (Status)) { > > -- > > 2.7.4 > >