summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTroy Kisky <troy.kisky@boundarydevices.com>2015-06-09 12:15:35 -0700
committerMax Krummenacher <max.krummenacher@toradex.com>2015-10-15 09:41:18 +0200
commitf601b83e20980bb150e527f655c35643985cdcd4 (patch)
tree72a3702bf2407f9150862552f9cd8315f5e7079b
parent3614d5a6f5ae51979ed48de359f0616a63259ed9 (diff)
pci-imx6: fix reboot bug
-rw-r--r--drivers/pci/host/pci-imx6.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index b7a5e8dde3d9..53234701c2e4 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -57,6 +57,7 @@ struct imx6_pcie {
struct regmap *iomuxc_gpr;
struct regulator *pcie_phy_regulator;
void __iomem *mem_base;
+ int force_detect_state;
};
/* PCIe Root Complex registers (memory-mapped) */
@@ -243,7 +244,7 @@ static int imx6q_pcie_abort_handler(unsigned long addr,
static int imx6_pcie_assert_core_reset(struct pcie_port *pp)
{
struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
- u32 val, gpr1, gpr12;
+ u32 gpr1, gpr12;
if (is_imx6sx_pcie(imx6_pcie)) {
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
@@ -272,11 +273,7 @@ static int imx6_pcie_assert_core_reset(struct pcie_port *pp)
if ((gpr1 & IMX6Q_GPR1_PCIE_REF_CLK_EN) &&
(gpr12 & IMX6Q_GPR12_PCIE_CTL_2)) {
- val = readl(pp->dbi_base + PCIE_PL_PFLR);
- val &= ~PCIE_PL_PFLR_LINK_STATE_MASK;
- val |= PCIE_PL_PFLR_FORCE_LINK;
- writel(val, pp->dbi_base + PCIE_PL_PFLR);
-
+ imx6_pcie->force_detect_state = 1;
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
IMX6Q_GPR12_PCIE_CTL_2, 0);
}
@@ -390,6 +387,15 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
udelay(200);
}
+ if (imx6_pcie->force_detect_state) {
+ u32 val;
+
+ imx6_pcie->force_detect_state = 0;
+ val = readl(pp->dbi_base + PCIE_PL_PFLR);
+ val &= ~PCIE_PL_PFLR_LINK_STATE_MASK;
+ val |= PCIE_PL_PFLR_FORCE_LINK;
+ writel(val, pp->dbi_base + PCIE_PL_PFLR);
+ }
/*
* Release the PCIe PHY reset here, that we have set in
* imx6_pcie_init_phy() now