imx6: kernel: fix occasional link failure
[openwrt.git] / target / linux / imx6 / patches-3.14 / 0060-pci_imx6_fix-link-failure.patch
1 PCI: imx6: fix occasional link failure
2
3 According to the IMX6 reference manuals, REF_SSP_EN (Reference clock enable
4 for SS function) must remain deasserted until the reference clock is running
5 at the appropriate frequency.
6
7 Without this patch we find a high link failure rate (>5%) on certain
8 IMX6 boards at various temperatures.
9
10 Signed-off-by: Tim Harvey <tharvey@gateworks.com>
11
12 --- a/drivers/pci/host/pci-imx6.c
13 +++ b/drivers/pci/host/pci-imx6.c
14 @@ -262,11 +262,6 @@ static int imx6_pcie_deassert_core_reset
15         if (gpio_is_valid(imx6_pcie->power_on_gpio))
16                 gpio_set_value(imx6_pcie->power_on_gpio, 1);
17  
18 -       regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
19 -                       IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
20 -       regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
21 -                       IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
22 -
23         ret = clk_prepare_enable(imx6_pcie->sata_ref_100m);
24         if (ret) {
25                 dev_err(pp->dev, "unable to enable sata_ref_100m\n");
26 @@ -294,6 +289,12 @@ static int imx6_pcie_deassert_core_reset
27         /* allow the clocks to stabilize */
28         usleep_range(200, 500);
29  
30 +       /* power up core phy and enable ref clock */
31 +       regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
32 +                       IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
33 +       regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
34 +                       IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
35 +
36         /* Some boards don't have PCIe reset GPIO. */
37         if (gpio_is_valid(imx6_pcie->reset_gpio)) {
38                 gpio_set_value(imx6_pcie->reset_gpio, 0);