linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Zhu <r65037@freescale.com>
To: <linux-pci-owner@vger.kernel.org>
Cc: <linux-pci@vger.kernel.org>, <shawn.guo@freescale.com>,
	<festevam@gmail.com>, <l.stach@pengutronix.de>,
	<tharvey@gateworks.com>, Richard Zhu <r65037@freescale.com>
Subject: [PATCH v4 01/10] PCI: imx6: wait the clocks to stabilize after ref_en
Date: Tue, 30 Sep 2014 17:19:48 +0800	[thread overview]
Message-ID: <1412068796-16931-2-git-send-email-r65037@freescale.com> (raw)
In-Reply-To: <1412068796-16931-1-git-send-email-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.
System would be hangs when the clocks are not yet settled in the DW
PCIe core. So we need to make sure that there is always an
appropriate delay between those two actions.

Signed-off-by: Richard Zhu <r65037@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


  reply	other threads:[~2014-09-30  9:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30  9:19 [PATCH v4]PCI: imx6: enable pcie on imx6sx sdb and imx6qdl sabreauto Richard Zhu
2014-09-30  9:19 ` Richard Zhu [this message]
2014-09-30  9:19 ` [PATCH v4 02/10] PCI: imx6: add imx6sx pcie support Richard Zhu
2014-10-08 17:09   ` Bjorn Helgaas
2014-10-09  2:53     ` Hong-Xing.Zhu
2014-09-30  9:19 ` [PATCH v4 03/10] PCI: imx6: Fix possible dead lock Richard Zhu
2014-09-30  9:19 ` [PATCH v4 04/10] PCI: designware: refine setup_rc and add msi data restore Richard Zhu
2014-09-30  9:19 ` [PATCH v4 05/10] PCI: designware: fix one potential assignment error of cfg start Richard Zhu
2014-09-30  9:19 ` [PATCH v4 06/10] ARM: imx6qdl: enable pcie on imx6qdl sabreauto Richard Zhu
2014-09-30  9:19 ` [PATCH v4 07/10] ARM: imx6: update dts and binding for imx6sx pcie Richard Zhu
2014-09-30  9:19 ` [PATCH v4 08/10] ARM: imx6sx: add syscon into gpc dts Richard Zhu
2014-09-30  9:19 ` [PATCH v4 09/10] ARM: imx6sx: add imx6sx pcie related gpr bits definitions Richard Zhu
  -- strict thread matches above, loose matches on Subject: below --
2014-09-30  9:36 [PATCH v4]PCI: imx6: enable pcie on imx6sx sdb and imx6qdl sabreauto Richard Zhu
2014-09-30  9:36 ` [PATCH v4 01/10] PCI: imx6: wait the clocks to stabilize after ref_en Richard Zhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412068796-16931-2-git-send-email-r65037@freescale.com \
    --to=r65037@freescale.com \
    --cc=festevam@gmail.com \
    --cc=l.stach@pengutronix.de \
    --cc=linux-pci-owner@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=shawn.guo@freescale.com \
    --cc=tharvey@gateworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).