Skip to content

Commit a2fa6f6

Browse files
Richard Zhubjorn-helgaas
authored andcommitted
PCI: imx6: Wait for clocks to stabilize after ref_en
For boards without a reset GPIO we skip the delay between enabling the pcie_ref_clk and touching the RC registers for configuration. This hangs the system if there isn't a proper delay to ensure the clocks are settled in the DW PCIe core. Also iMX6Q always needs an additional 10us delay to make sure the reset is propagated through the core, as we don't have an explicitly controlled reset input on this SoC. This fixes a problem with 3fce0e8 ("PCI: imx6: Delay enabling reference clock for SS until it stabilizes"): the kernel doesn't boot on systems that don't pass the PCI GPIO reset in the DTB. This regression affects mx6 nitrogen boards. [bhelgaas: add regression info in changelog] Fixes: 3fce0e8 ("PCI: imx6: Delay enabling reference clock for SS until it stabilizes") Reported-by: Fabio Estevam <fabio.estevam@freescale.com> Tested-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Richard Zhu <richard.zhu@freescale.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Lucas Stach <l.stach@pengutronix.de>
1 parent c302d35 commit a2fa6f6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/pci/host/pci-imx6.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,15 +275,22 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
275275
goto err_pcie;
276276
}
277277

278-
/* allow the clocks to stabilize */
279-
usleep_range(200, 500);
280-
281278
/* power up core phy and enable ref clock */
282279
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
283280
IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
281+
/*
282+
* the async reset input need ref clock to sync internally,
283+
* when the ref clock comes after reset, internal synced
284+
* reset time is too short, cannot meet the requirement.
285+
* add one ~10us delay here.
286+
*/
287+
udelay(10);
284288
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
285289
IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
286290

291+
/* allow the clocks to stabilize */
292+
usleep_range(200, 500);
293+
287294
/* Some boards don't have PCIe reset GPIO. */
288295
if (gpio_is_valid(imx6_pcie->reset_gpio)) {
289296
gpio_set_value(imx6_pcie->reset_gpio, 0);

0 commit comments

Comments
 (0)