aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/host/pci-imx6.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 5634a33ea642..25dde2c7b445 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -336,9 +336,26 @@ static void imx6_pcie_host_init(struct pcie_port *pp)
336 return; 336 return;
337} 337}
338 338
339static void imx6_pcie_reset_phy(struct pcie_port *pp)
340{
341 uint32_t temp;
342
343 pcie_phy_read(pp->dbi_base, PHY_RX_OVRD_IN_LO, &temp);
344 temp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN |
345 PHY_RX_OVRD_IN_LO_RX_PLL_EN);
346 pcie_phy_write(pp->dbi_base, PHY_RX_OVRD_IN_LO, temp);
347
348 usleep_range(2000, 3000);
349
350 pcie_phy_read(pp->dbi_base, PHY_RX_OVRD_IN_LO, &temp);
351 temp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN |
352 PHY_RX_OVRD_IN_LO_RX_PLL_EN);
353 pcie_phy_write(pp->dbi_base, PHY_RX_OVRD_IN_LO, temp);
354}
355
339static int imx6_pcie_link_up(struct pcie_port *pp) 356static int imx6_pcie_link_up(struct pcie_port *pp)
340{ 357{
341 u32 rc, ltssm, rx_valid, temp; 358 u32 rc, ltssm, rx_valid;
342 359
343 /* 360 /*
344 * Test if the PHY reports that the link is up and also that 361 * Test if the PHY reports that the link is up and also that
@@ -370,21 +387,7 @@ static int imx6_pcie_link_up(struct pcie_port *pp)
370 387
371 dev_err(pp->dev, "transition to gen2 is stuck, reset PHY!\n"); 388 dev_err(pp->dev, "transition to gen2 is stuck, reset PHY!\n");
372 389
373 pcie_phy_read(pp->dbi_base, 390 imx6_pcie_reset_phy(pp);
374 PHY_RX_OVRD_IN_LO, &temp);
375 temp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN
376 | PHY_RX_OVRD_IN_LO_RX_PLL_EN);
377 pcie_phy_write(pp->dbi_base,
378 PHY_RX_OVRD_IN_LO, temp);
379
380 usleep_range(2000, 3000);
381
382 pcie_phy_read(pp->dbi_base,
383 PHY_RX_OVRD_IN_LO, &temp);
384 temp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN
385 | PHY_RX_OVRD_IN_LO_RX_PLL_EN);
386 pcie_phy_write(pp->dbi_base,
387 PHY_RX_OVRD_IN_LO, temp);
388 391
389 return 0; 392 return 0;
390} 393}