linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V1]PCI: imx6: Wait the clocks to stabilize after ref_en
@ 2014-10-24  2:30 Richard Zhu
  2014-10-24  2:30 ` [PATCH V1] PCI: " Richard Zhu
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Zhu @ 2014-10-24  2:30 UTC (permalink / raw)
  To: linux-pci; +Cc: shawn.guo, festevam, l.stach, tharvey, m-karicheri2

Fabio suggested to resend this patch only, because that he notice that
the kernel does not boot anymore since commit  3fce0e882f61
(PCI: imx6: Delay enabling reference clock for SS until it stabilizes)
on a system that does not pass the PCI gpio reset in the dtb. This causes
a regression on mx6 nitrogen boards.

[PATCH V1] PCI: imx6: Wait the clocks to stabilize after ref_en
---
 drivers/pci/host/pci-imx6.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH V1] PCI: imx6: Wait the clocks to stabilize after ref_en
  2014-10-24  2:30 [PATCH V1]PCI: imx6: Wait the clocks to stabilize after ref_en Richard Zhu
@ 2014-10-24  2:30 ` Richard Zhu
  2014-10-24 19:01   ` Fabio Estevam
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Zhu @ 2014-10-24  2:30 UTC (permalink / raw)
  To: linux-pci
  Cc: shawn.guo, festevam, l.stach, tharvey, m-karicheri2, Richard Zhu,
	Richard Zhu

From: Richard Zhu <r65037@freescale.com>

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.

Signed-off-by: Richard Zhu <richard.zhu@freescale.com>
Tested-by: Tim Harvey <tharvey@gateworks.com>
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/pci/host/pci-imx6.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 233fe8a..eac96fb 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -275,15 +275,22 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 		goto err_pcie;
 	}
 
-	/* allow the clocks to stabilize */
-	usleep_range(200, 500);
-
 	/* 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);
 
+	/* allow the clocks to stabilize */
+	usleep_range(200, 500);
+
 	/* Some boards don't have PCIe reset GPIO. */
 	if (gpio_is_valid(imx6_pcie->reset_gpio)) {
 		gpio_set_value(imx6_pcie->reset_gpio, 0);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V1] PCI: imx6: Wait the clocks to stabilize after ref_en
  2014-10-24  2:30 ` [PATCH V1] PCI: " Richard Zhu
@ 2014-10-24 19:01   ` Fabio Estevam
       [not found]     ` <pryfyn2m266ess9s6pii03q3.1414196895183@email.android.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2014-10-24 19:01 UTC (permalink / raw)
  To: Richard Zhu
  Cc: linux-pci, Shawn Guo, Lucas Stach, Tim Harvey, m-karicheri2, Richard Zhu

Hi Richard,

On Fri, Oct 24, 2014 at 12:30 AM, Richard Zhu <richard.zhu@freescale.com> wrote:

> -       /* allow the clocks to stabilize */
> -       usleep_range(200, 500);
> -
>         /* 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);

I am curious about this delay here: have you seen boot issues without
it? If so, which hardware was that?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: [PATCH V1] PCI: imx6: Wait the clocks to stabilize after ref_en
       [not found]     ` <pryfyn2m266ess9s6pii03q3.1414196895183@email.android.com>
@ 2014-10-25 10:14       ` Fabio Estevam
  0 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2014-10-25 10:14 UTC (permalink / raw)
  To: Richard.Zhu
  Cc: linux-pci, Shengchao Guo, Lucas Stach, Tim Harvey, m-karicheri2

On Fri, Oct 24, 2014 at 10:31 PM, Richard.Zhu@freescale.com
<Richard.Zhu@freescale.com> wrote:
> Hi Fabio:
> This bug is found during the stress warm-reset stress test.
> There are about three times randomly link down issue during the consecutive
> 10000 times system warm reset tests on one customer’s golden board.
> Regarding to imx internal pcie design situation, synposys gave the
> suggestion, and it works.

Ok, great. Thanks for providing the details. I am happy with this patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-25 18:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-24  2:30 [PATCH V1]PCI: imx6: Wait the clocks to stabilize after ref_en Richard Zhu
2014-10-24  2:30 ` [PATCH V1] PCI: " Richard Zhu
2014-10-24 19:01   ` Fabio Estevam
     [not found]     ` <pryfyn2m266ess9s6pii03q3.1414196895183@email.android.com>
2014-10-25 10:14       ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).