From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::d41; helo=mail-io1-xd41.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (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 695492116327F for ; Mon, 8 Oct 2018 05:44:07 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id n18-v6so15715109ioa.9 for ; Mon, 08 Oct 2018 05:44:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=O0LV+tuK7wcAniTVy0kKp/2lpjhK4wXXqzMRJrWqtGk=; b=AbJINN0eEu2w413yTJU4DJYEi0BwAX1V28UeO08u4QrUlmFagN5VeqCoRDyZJ0fpax /fBQrBcps1bw+6PWup1KehKVuQyy9KDDrbjVjBlSrqvJCCcA9hb/Hm4nojV8zJ7DERw/ tVVmDfSw+krf6Ie4rmlnGtGuJXQOYIVFtIe/Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=O0LV+tuK7wcAniTVy0kKp/2lpjhK4wXXqzMRJrWqtGk=; b=lw945esIz8/DtdHQJOxd6Ira0JAJII3ISWEKq8eVjKOsQBB5sX7/ddhJ59ExF4ONVN zp8r3lfOsT3gmpXpfaA9w//VcItzCDXRdyWswXYVIbbuas2oFJdu3j+D2L/GcO6PuTJm EjKXpDEMIYuFvh0E4pB04+zleP24lCqmv80Py0L+T5thOjdlanTtPu87D2akiy0NjEju bel4SOtHAgfYclCyB36bzD3BJTxODcOtyxR/x2+OxZu7jIXI6fz/XtLpAFyIeq9Aovzo PJ66EUtoLBasslMEoKTPCvtBL6ZERe/IVMLtY79VLC1Hm4TJ8RKPFpsecttyPg5qpm6y WaWg== X-Gm-Message-State: ABuFfoinNS6luYFf9ChzoM64tPkgQp3xOd2yBL24sndvc95iueJ/w1kr JBytDjmkTaDMCVKJgOpdD/HCJwlqJP8t9mCes4Q4kw== X-Google-Smtp-Source: ACcGV616mspUSSqbxrIMNG2e52XyTCKQu6+5VJzr86VL9FZf3ggiVYGx0Hown5Z+E1pDex/zynBJaf5Yk/dBxib7eys= X-Received: by 2002:a6b:5d12:: with SMTP id r18-v6mr15449139iob.170.1539002646556; Mon, 08 Oct 2018 05:44:06 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:5910:0:0:0:0:0 with HTTP; Mon, 8 Oct 2018 05:44:06 -0700 (PDT) In-Reply-To: <1538745911-22484-4-git-send-email-mw@semihalf.com> References: <1538745911-22484-1-git-send-email-mw@semihalf.com> <1538745911-22484-4-git-send-email-mw@semihalf.com> From: Ard Biesheuvel Date: Mon, 8 Oct 2018 14:44:06 +0200 Message-ID: To: Marcin Wojtas , "Zeng, Star" , Eric Dong , Ruiyu Ni Cc: "edk2-devel@lists.01.org" , "Tian, Feng" , "Kinney, Michael D" , "Gao, Liming" , Leif Lindholm , "Wu, Hao A" , Nadav Haklai , =?UTF-8?B?SmFuIETEhWJyb8Wb?= , Tomasz Michalec Subject: Re: [PATCH v2 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: Mon, 08 Oct 2018 12:44:07 -0000 Content-Type: text/plain; charset="UTF-8" (add MdeModulePkg maintainers) On 5 October 2018 at 15:25, Marcin Wojtas wrote: > From: Tomasz Michalec > > Some SD Host Controlers need to do additional opperations after clock > frequency switch. > controllers operations Otherwise, this looks fine to me Reviewed-by: Ard Biesheuvel > 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/MdeModulePkg/Include/Protocol/SdMmcOverride.h > index 25db98a..d9daada 100644 > --- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h > +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h > @@ -33,6 +33,7 @@ typedef enum { > EdkiiSdMmcInitHostPre, > EdkiiSdMmcInitHostPost, > EdkiiSdMmcUhsSignaling, > + EdkiiSdMmcSwitchClockFreqPost, > } EDKII_SD_MMC_PHASE_TYPE; > > /** > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c > index 05bd4a0..7e75283 100755 > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c > @@ -796,6 +796,27 @@ EmmcSwitchToHighSpeed ( > > HsTiming = 1; > Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, ClockFreq); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + if (mOverride != NULL && mOverride->NotifyPhase != NULL) { > + Status = 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; > } > @@ -905,6 +926,24 @@ EmmcSwitchToHS200 ( > return Status; > } > > + if (mOverride != NULL && mOverride->NotifyPhase != NULL) { > + Status = 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 = EmmcTuningClkForHs200 (PciIo, PassThru, Slot, BusWidth); > > return Status; > @@ -989,6 +1028,27 @@ EmmcSwitchToHS400 ( > > HsTiming = 3; > Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, ClockFreq); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + if (mOverride != NULL && mOverride->NotifyPhase != NULL) { > + Status = 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/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > index 5645a71..057a4e2 100644 > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c > @@ -887,6 +887,24 @@ SdCardSetBusMode ( > return Status; > } > > + if (mOverride != NULL && mOverride->NotifyPhase != NULL) { > + Status = 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 == 3) || ((AccessMode == 2) && (Capability->TuningSDR50 != 0))) { > Status = SdCardTuningClock (PciIo, PassThru, Slot); > if (EFI_ERROR (Status)) { > -- > 2.7.4 >