mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-15 15:04:27 +08:00
PCI: imx6: Factor out ref clock enable
Factor out ref clock enable to make it cleaner to add imx6sx support. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Tested-by: Christoph Fritz <chf.fritz@googlemail.com>
This commit is contained in:
parent
b2d7a9cd3f
commit
4d1821e729
@ -269,6 +269,23 @@ static int imx6_pcie_assert_core_reset(struct pcie_port *pp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
|
||||||
|
{
|
||||||
|
/* power up core phy and enable ref clock */
|
||||||
|
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
|
||||||
|
IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
|
||||||
|
/*
|
||||||
|
* the async reset input need ref clock to sync internally,
|
||||||
|
* when the ref clock comes after reset, internal synced
|
||||||
|
* reset time is too short, cannot meet the requirement.
|
||||||
|
* add one ~10us delay here.
|
||||||
|
*/
|
||||||
|
udelay(10);
|
||||||
|
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
|
||||||
|
IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
|
static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
|
||||||
{
|
{
|
||||||
struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
|
struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
|
||||||
@ -292,18 +309,11 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
|
|||||||
goto err_pcie;
|
goto err_pcie;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* power up core phy and enable ref clock */
|
ret = imx6_pcie_enable_ref_clk(imx6_pcie);
|
||||||
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
|
if (ret) {
|
||||||
IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
|
dev_err(pp->dev, "unable to enable pcie ref clock\n");
|
||||||
/*
|
goto err_ref_clk;
|
||||||
* the async reset input need ref clock to sync internally,
|
}
|
||||||
* when the ref clock comes after reset, internal synced
|
|
||||||
* reset time is too short, cannot meet the requirement.
|
|
||||||
* add one ~10us delay here.
|
|
||||||
*/
|
|
||||||
udelay(10);
|
|
||||||
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
|
|
||||||
IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
|
|
||||||
|
|
||||||
/* allow the clocks to stabilize */
|
/* allow the clocks to stabilize */
|
||||||
usleep_range(200, 500);
|
usleep_range(200, 500);
|
||||||
@ -316,6 +326,8 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_ref_clk:
|
||||||
|
clk_disable_unprepare(imx6_pcie->pcie);
|
||||||
err_pcie:
|
err_pcie:
|
||||||
clk_disable_unprepare(imx6_pcie->pcie_bus);
|
clk_disable_unprepare(imx6_pcie->pcie_bus);
|
||||||
err_pcie_bus:
|
err_pcie_bus:
|
||||||
|
Loading…
Reference in New Issue
Block a user