public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Tian, Feng" <feng.tian@intel.com>
To: Leif Lindholm <leif.lindholm@linaro.org>
Cc: "Zeng, Star" <star.zeng@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"Tian, Feng" <feng.tian@intel.com>
Subject: Re: [patch] MdeModulePkg/Xhci: add 1ms delay before access MMIO reg during reset
Date: Tue, 20 Sep 2016 01:39:43 +0000	[thread overview]
Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE566E1B1D4@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <20160914130833.GB16080@bivouac.eciton.net>

Lefi,

This delay is just a workaround for some XHCI HCs, I will add such info into commit log.

Thanks
Feng

-----Original Message-----
From: Leif Lindholm [mailto:leif.lindholm@linaro.org] 
Sent: Wednesday, September 14, 2016 9:09 PM
To: Tian, Feng <feng.tian@intel.com>
Cc: Zeng, Star <star.zeng@intel.com>; edk2-devel@lists.01.org
Subject: Re: [edk2] [patch] MdeModulePkg/Xhci: add 1ms delay before access MMIO reg during reset

On Wed, Sep 14, 2016 at 09:37:13AM +0800, Feng Tian wrote:
> Some XHCI host controllers require to have extra 1ms delay before 
> accessing any MMIO register during HC reset.

Is this compliant with the XHCI specification or a bug workaround?
I am not going to argue about the delay, but I would like to see it spelled out in the commit message.

> Cc: Star Zeng <star.zeng@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Feng Tian <feng.tian@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c 
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> index d0f2205..cb822a6 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c
> @@ -2,7 +2,7 @@
>  
>    The XHCI register operation routines.
>  
> -Copyright (c) 2011 - 2015, Intel Corporation. All rights 
> reserved.<BR>
> +Copyright (c) 2011 - 2016, Intel Corporation. All rights 
> +reserved.<BR>
>  This program and the accompanying materials  are licensed and made 
> available under the terms and conditions of the BSD License  which 
> accompanies this distribution.  The full text of the license may be 
> found at @@ -687,6 +687,10 @@ XhcResetHC (
>    if ((Xhc->DebugCapSupOffset == 0xFFFFFFFF) || ((XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset) & 0xFF) != XHC_CAP_USB_DEBUG) ||
>        ((XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset + XHC_DC_DCCTRL) & BIT0) == 0)) {
>      XhcSetOpRegBit (Xhc, XHC_USBCMD_OFFSET, XHC_USBCMD_RESET);
> +    //
> +    // some XHCI host controllers require to have extra 1ms delay before accessing any MMIO register during reset.
> +    //
> +    gBS->Stall (XHC_1_MILLISECOND);

OK, so this is not actually a comment on this patch, but why do we have so many separate definitions of how many microseconds go in a milisecond or second?

USB_BUS_1_MILLISECOND (Pei and Dxe)
XHC_1_MILLISECOND     (Pei and Dxe)
EHC_1_MILLISECOND     (Pei and Dxe)
UHC_1_MILLISECOND     (Dxe, Pei defines STALL_1_MILLI_SECOND instead)

And IdeBusPei/PciBusDxe do similar things.

Could we add something common to Base.h instead, like the SIZE_ ones, droppping a lot of duplication, gaining uniformity, and correcting spelling?

/
    Leif

>      Status = XhcWaitOpRegBit (Xhc, XHC_USBCMD_OFFSET, XHC_USBCMD_RESET, FALSE, Timeout);
>    }
>  
> --
> 2.7.1.windows.2
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


      parent reply	other threads:[~2016-09-20  1:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14  1:37 [patch] MdeModulePkg/Xhci: add 1ms delay before access MMIO reg during reset Feng Tian
2016-09-14  2:58 ` Zeng, Star
2016-09-14  2:59   ` Tian, Feng
2016-09-14 13:08 ` Leif Lindholm
2016-09-14 17:14   ` Kinney, Michael D
2016-09-14 17:37     ` Andrew Fish
2016-09-14 18:07       ` Kinney, Michael D
2016-09-15 10:19     ` Leif Lindholm
2016-09-20  2:01       ` Tian, Feng
2016-09-20  1:39   ` Tian, Feng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7F1BAD85ADEA444D97065A60D2E97EE566E1B1D4@SHSMSX101.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox