aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/host
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2013-12-12 16:50:00 -0500
committerBjorn Helgaas <bhelgaas@google.com>2013-12-19 12:56:10 -0500
commit982aa234512f6a88932a5ece7f7becbf4b08ece7 (patch)
tree93949c948a33eacbc08b1be4b5decbd735514eec /drivers/pci/host
parent7f9f40c01cce0c0e0ced34af2a2fd8353cc606c3 (diff)
PCI: imx6: Factor out PHY reset
Split the PCIe PHY reset from the link up function to make the code a little more structured. No functional change. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Cc: Frank Li <lznuaa@gmail.com> Cc: Harro Haan <hrhaan@gmail.com> Cc: Jingoo Han <jg1.han@samsung.com> Cc: Mohit KUMAR <Mohit.KUMAR@st.com> Cc: Pratyush Anand <pratyush.anand@st.com> Cc: Richard Zhu <r65037@freescale.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Sean Cross <xobs@kosagi.com> Cc: Siva Reddy Kallam <siva.kallam@samsung.com> Cc: Srikanth T Shivanand <ts.srikanth@samsung.com> Cc: Tim Harvey <tharvey@gateworks.com> Cc: Troy Kisky <troy.kisky@boundarydevices.com> Cc: Yinghai Lu <yinghai@kernel.org>
Diffstat (limited to 'drivers/pci/host')
-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}