linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Richard Zhu <r65037@freescale.com>
Cc: linux-pci-owner@vger.kernel.org, linux-pci@vger.kernel.org,
	shawn.guo@freescale.com, festevam@gmail.com,
	tharvey@gateworks.com
Subject: Re: [PATCH v2 2/5] PCI: imx6: wait the clocks to stabilize after ref_en
Date: Tue, 23 Sep 2014 11:56:30 +0200	[thread overview]
Message-ID: <1411466190.3256.7.camel@pengutronix.de> (raw)
In-Reply-To: <1411445498-20250-3-git-send-email-r65037@freescale.com>

Am Dienstag, den 23.09.2014, 12:11 +0800 schrieb Richard Zhu:
> - a while delay is mandatory required after pcie_ref_clk_en
> is set. Otherwise, the system would be hang on imx6qdl ard
> boards, because that imx6qdl boards don't have the reset_gpio.
> - the clocks should be stable already after the
> "clk_prepare_enable" is return. So I think it's ok to move the
> usleep delay after the pcie_ref_en is set.
> 

You are describing a lot of the conditions around the issue, but not the
issue itself, which makes it hard to follow your commit message. After
looking at the code I think the problem is this (and should be described
accordingly):

For boards without a reset gpio we skip the delay between enabling the
pcie_ref_clk and touching the RC registers for configuration. Apparently
this 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.

I have not found this constraint anywhere in the i.MX6 Reference Manual,
nor in the DW PCIe documents I have access to, which makes me a bit feel
a bit unhappy about this. Richard, do you have better info on why this
delay is needed and how long it needs to be? Or is this just empirical?

In general I'm ok with this patch, but still want a confirmation from
Tim that this doesn't break anything.

> Signed-off-by: Richard Zhu <r65037@freescale.com>
> ---
>  drivers/pci/host/pci-imx6.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
> index 233fe8a..bc4222b 100644
> --- a/drivers/pci/host/pci-imx6.c
> +++ b/drivers/pci/host/pci-imx6.c
> @@ -275,15 +275,15 @@ 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);
>  	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);

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |


  reply	other threads:[~2014-09-23  9:56 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23  4:11 [PATCH v2]PCI: imx6: enable pcie on imx6sx sdb and imx6qdl sabreauto Richard Zhu
2014-09-23  4:11 ` [PATCH v2 1/5] PCI: imx6: enable pcie on " Richard Zhu
2014-09-23  9:19   ` Lucas Stach
2014-09-23 12:40   ` Fabio Estevam
2014-09-24  2:54     ` Hong-Xing.Zhu
2014-09-24 21:04       ` Fabio Estevam
2014-09-25  1:21         ` Hong-Xing.Zhu
2014-09-25  1:39           ` Fabio Estevam
2014-09-25  2:02             ` Hong-Xing.Zhu
2014-09-23  4:11 ` [PATCH v2 2/5] PCI: imx6: wait the clocks to stabilize after ref_en Richard Zhu
2014-09-23  9:56   ` Lucas Stach [this message]
2014-09-23 12:28     ` Tim Harvey
2014-09-25  5:21       ` Hong-Xing.Zhu
2014-10-01 18:00       ` Tim Harvey
2014-10-02  2:26         ` Hong-Xing.Zhu
2014-09-23 12:45   ` Fabio Estevam
2014-10-24  1:51   ` Fabio Estevam
2014-10-24  2:46     ` Richard.Zhu
2014-09-23  4:11 ` [PATCH v2 3/5] PCI: imx6: update dts and binding for imx6sx pcie Richard Zhu
2014-09-23 10:19   ` Lucas Stach
2014-09-24  9:43     ` Hong-Xing.Zhu
2014-09-23  4:11 ` [PATCH v2 4/5] PCI: imx6: add imx6sx pcie related gpr bits definitions Richard Zhu
2014-09-23 10:21   ` Lucas Stach
2014-09-24  4:45     ` Hong-Xing.Zhu
2014-09-23  4:11 ` [PATCH v2 5/5] PCI: imx6: add imx6sx pcie support Richard Zhu
2014-09-23 11:00   ` Lucas Stach
2014-09-24  7:09     ` Hong-Xing.Zhu
2014-09-24  9:46       ` Lucas Stach
2014-09-24 10:15         ` Hong-Xing.Zhu
2014-09-23  9:18 ` [PATCH v2]PCI: imx6: enable pcie on imx6sx sdb and imx6qdl sabreauto Lucas Stach
2014-09-23  9:29   ` Hong-Xing.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=1411466190.3256.7.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=festevam@gmail.com \
    --cc=linux-pci-owner@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=r65037@freescale.com \
    --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).