linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Ley Foon Tan <lftan@altera.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Ley Foon Tan <lftan.linux@gmail.com>
Subject: Re: [PATCH] PCI: altera: fix altera_pcie_link_is_up()
Date: Fri, 11 Mar 2016 12:19:36 -0600	[thread overview]
Message-ID: <20160311181936.GD4725@localhost> (raw)
In-Reply-To: <1456911787-3576-1-git-send-email-lftan@altera.com>

On Wed, Mar 02, 2016 at 05:43:07PM +0800, Ley Foon Tan wrote:
> The original code return true if RP_LTSSM register return non-zero
> value. This fix to return true only RP_LTSSM register is in L0 state
> (link up).
> 
> Signed-off-by: Ley Foon Tan <lftan@altera.com>

Applied to pci/host-altera for v4.6 with the following changelog.
Thanks!

    PCI: altera: Fix altera_pcie_link_is_up()
    
    Originally altera_pcie_link_is_up() decided the link was up if any of the
    low four bits of the LTSSM register were set.  But the link is only up if
    the LTSSM state is L0, so check for that exact value.
    
    [bhelgaas: changelog]
    Signed-off-by: Ley Foon Tan <lftan@altera.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
>  drivers/pci/host/pcie-altera.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
> index 99da549..dbac6fb 100644
> --- a/drivers/pci/host/pcie-altera.c
> +++ b/drivers/pci/host/pcie-altera.c
> @@ -40,6 +40,7 @@
>  #define P2A_INT_ENABLE			0x3070
>  #define P2A_INT_ENA_ALL			0xf
>  #define RP_LTSSM			0x3c64
> +#define RP_LTSSM_MASK			0x1f
>  #define LTSSM_L0			0xf
>  
>  /* TLP configuration type 0 and 1 */
> @@ -140,7 +141,7 @@ static void tlp_write_tx(struct altera_pcie *pcie,
>  
>  static bool altera_pcie_link_is_up(struct altera_pcie *pcie)
>  {
> -	return !!(cra_readl(pcie, RP_LTSSM) & LTSSM_L0);
> +	return !!((cra_readl(pcie, RP_LTSSM) & RP_LTSSM_MASK) == LTSSM_L0);
>  }
>  
>  static bool altera_pcie_valid_config(struct altera_pcie *pcie,
> -- 
> 2.2.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2016-03-11 18:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02  9:43 [PATCH] PCI: altera: fix altera_pcie_link_is_up() Ley Foon Tan
2016-03-11 18:19 ` Bjorn Helgaas [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-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=20160311181936.GD4725@localhost \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=lftan.linux@gmail.com \
    --cc=lftan@altera.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).