All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3] Powerpc: pcie: Make pcie link state judgement more specific
Date: Wed, 8 Nov 2017 21:30:46 +0000	[thread overview]
Message-ID: <1510176641.29897.151.camel@infinera.com> (raw)
In-Reply-To: <VI1PR04MB20783169D3C9DF7ABDABE5D59A560@VI1PR04MB2078.eurprd04.prod.outlook.com>

On Wed, 2017-11-08 at 21:05 +0000, York Sun wrote:
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
> 
> 
> On 10/22/2017 07:39 PM, Xiaowei Bao wrote:
> > 
> > -----Original Message-----
> > From: Joakim Tjernlund [mailto:Joakim.Tjernlund at infinera.com]
> > Sent: Friday, October 20, 2017 9:13 PM
> > To: wd at denx.de; Mingkai Hu <mingkai.hu@nxp.com>; tony.obrien at alliedtelesis.co.nz; u-boot at lists.denx.de; Z.q. Hou <zhiqiang.hou@nxp.com>; York Sun <york.sun@nxp.com>; Xiaowei Bao <xiaowei.bao@nxp.com>; hamish.martin at alliedtelesis.co.nz; M.h. Lian <minghuan.lian@nxp.com>
> > Subject: Re: [U-Boot] [PATCH 3/3] Powerpc: pcie: Make pcie link state judgement more specific
> > 
> > On Fri, 2017-10-20 at 18:16 +0800, Bao Xiaowei wrote:
> > > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > > 
> > > 
> > > For some special reset times for longer pcie devices, the pcie device
> > > may on polling compliance state, the RC considers the pcie device is
> > > link up, but the pcie device is not link up, only the L0 state is link
> > > up state.
> > > 
> > > Signed-off-by: Bao Xiaowei <xiaowei.bao@nxp.com>
> > > ---
> > >  arch/powerpc/include/asm/fsl_pci.h |  2 ++
> > >  drivers/pci/fsl_pci_init.c         | 10 ++++++----
> > >  2 files changed, 8 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/arch/powerpc/include/asm/fsl_pci.h
> > > b/arch/powerpc/include/asm/fsl_pci.h
> > > index 70a5461..323b182 100644
> > > --- a/arch/powerpc/include/asm/fsl_pci.h
> > > +++ b/arch/powerpc/include/asm/fsl_pci.h
> > > @@ -25,6 +25,8 @@
> > >  #define PCI_LTSSM      0x404   /* PCIe Link Training, Status State Machine */
> > >  #define PCI_LTSSM_L0   0x16    /* L0 state */
> > >  #define PCI_LTSSM_L0_PEX_REV3  0x11    /* L0 state for pex rev3*/
> > > +#define LTSSM_PCIE_DETECT_QUIET                0x00    /* Detect state */
> > > +#define LTSSM_PCIE_DETECT_ACTIVE       0x01    /* Detect state */
> > > 
> > >  int fsl_setup_hose(struct pci_controller *hose, unsigned long addr);
> > > int fsl_is_pci_agent(struct pci_controller *hose); diff --git
> > > a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c index
> > > be57e53..9b5f386 100644
> > > --- a/drivers/pci/fsl_pci_init.c
> > > +++ b/drivers/pci/fsl_pci_init.c
> > > @@ -335,15 +335,17 @@ static int fsl_pci_link_up(struct pci_controller *hose,
> > >                 pci_ltssm_l0 = PCI_LTSSM_L0;
> > > 
> > >         ltssm = fsl_get_ltssm(hose, pci_info);
> > > -
> > > -       if (ltssm == pci_ltssm_l0) {
> > > +       if (ltssm == LTSSM_PCIE_DETECT_QUIET ||
> > > +               ltssm == LTSSM_PCIE_DETECT_ACTIVE) {
> > > +               enabled = 0;
> > > +       } else if (ltssm == pci_ltssm_l0) {
> > >                 enabled = 1;
> > >         } else {
> > > -               for (i = 0; i < 100 && ltssm < pci_ltssm_l0; i++) {
> > > +               for (i = 0; i < 100 && ltssm != pci_ltssm_l0; i++) {
> > >                         ltssm = fsl_get_ltssm(hose, pci_info);
> > >                         udelay(1000);
> > 
> > Do you really need this long loop here ? It causes a long delay in case the PCIe device is in permanent polling state. Our device is in polling state until clocks is configured and that will be done from user space in Linux
> > 
> > Yes, if the pcie device is in permanent polling state, it will take probably 100ms delay, but this case is occur very few special devices, if we want to use the pcie device in uboot, we have to wait the device link up state is ok, so need some time to wait the pcie device ready. if the pcie slot have no device, the function will return at once, will not bring delay.
> 
> Joakim,
> 
> Are we OK with this change? Can you test it to make sure no negative
> impact on your boards?

Not really happy, what device needs 100 ms extra to exit polling state? 

  reply	other threads:[~2017-11-08 21:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 10:16 [U-Boot] [PATCH 1/3] fsl/pci: fix leading whitespace of PCI_LTSSM_L0 Bao Xiaowei
2017-10-20 10:16 ` [U-Boot] [PATCH 2/3] Powerpc: pcie: optmize the code of pci init function Bao Xiaowei
2017-10-20 10:16 ` [U-Boot] [PATCH 3/3] Powerpc: pcie: Make pcie link state judgement more specific Bao Xiaowei
2017-10-20 13:12   ` Joakim Tjernlund
2017-10-23  2:39     ` Xiaowei Bao
2017-11-08 21:05       ` York Sun
2017-11-08 21:30         ` Joakim Tjernlund [this message]
2017-11-08 21:45           ` York Sun
2017-11-09  6:45             ` Xiaowei Bao
2017-11-29 18:48               ` York Sun
2018-02-27 19:33                 ` York Sun

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-all 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=1510176641.29897.151.camel@infinera.com \
    --to=joakim.tjernlund@infinera.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.