]> git.karo-electronics.de Git - linux-beck.git/commitdiff
PCI: altera: Fix altera_pcie_link_is_up()
authorLey Foon Tan <lftan@altera.com>
Wed, 2 Mar 2016 09:43:07 +0000 (17:43 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 11 Mar 2016 18:14:39 +0000 (12:14 -0600)
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

index 99da549d5d06a067b58d3bbe08c39041a9d90605..dbac6fb3f0bdfbccaaceefc0c1467e80ce0345df 100644 (file)
@@ -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,