aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <[email protected]>2013-12-12 22:50:00 +0100
committerBjorn Helgaas <[email protected]>2013-12-19 10:56:10 -0700
commit982aa234512f6a88932a5ece7f7becbf4b08ece7 (patch)
tree93949c948a33eacbc08b1be4b5decbd735514eec
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 <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Shawn Guo <[email protected]> Cc: Frank Li <[email protected]> Cc: Harro Haan <[email protected]> Cc: Jingoo Han <[email protected]> Cc: Mohit KUMAR <[email protected]> Cc: Pratyush Anand <[email protected]> Cc: Richard Zhu <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: Sean Cross <[email protected]> Cc: Siva Reddy Kallam <[email protected]> Cc: Srikanth T Shivanand <[email protected]> Cc: Tim Harvey <[email protected]> Cc: Troy Kisky <[email protected]> Cc: Yinghai Lu <[email protected]>
-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)
return;
}
+static void imx6_pcie_reset_phy(struct pcie_port *pp)
+{
+ uint32_t temp;
+
+ pcie_phy_read(pp->dbi_base, PHY_RX_OVRD_IN_LO, &temp);
+ temp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN |
+ PHY_RX_OVRD_IN_LO_RX_PLL_EN);
+ pcie_phy_write(pp->dbi_base, PHY_RX_OVRD_IN_LO, temp);
+
+ usleep_range(2000, 3000);
+
+ pcie_phy_read(pp->dbi_base, PHY_RX_OVRD_IN_LO, &temp);
+ temp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN |
+ PHY_RX_OVRD_IN_LO_RX_PLL_EN);
+ pcie_phy_write(pp->dbi_base, PHY_RX_OVRD_IN_LO, temp);
+}
+
static int imx6_pcie_link_up(struct pcie_port *pp)
{
- u32 rc, ltssm, rx_valid, temp;
+ u32 rc, ltssm, rx_valid;
/*
* 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)
dev_err(pp->dev, "transition to gen2 is stuck, reset PHY!\n");
- pcie_phy_read(pp->dbi_base,
- PHY_RX_OVRD_IN_LO, &temp);
- temp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN
- | PHY_RX_OVRD_IN_LO_RX_PLL_EN);
- pcie_phy_write(pp->dbi_base,
- PHY_RX_OVRD_IN_LO, temp);
-
- usleep_range(2000, 3000);
-
- pcie_phy_read(pp->dbi_base,
- PHY_RX_OVRD_IN_LO, &temp);
- temp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN
- | PHY_RX_OVRD_IN_LO_RX_PLL_EN);
- pcie_phy_write(pp->dbi_base,
- PHY_RX_OVRD_IN_LO, temp);
+ imx6_pcie_reset_phy(pp);
return 0;
}