linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roberto Fichera <kernel@tekno-soft.it>
To: Richard Zhu <hongxing.zhu@nxp.com>, Bjorn Helgaas <helgaas@kernel.org>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Richard Zhu <Richard.Zhu@freescale.com>,
	Lucas Stach <l.stach@pengutronix.de>
Subject: Re: iMX6q PCIe phy link never came up on kernel v4.4.x
Date: Fri, 4 Mar 2016 09:09:21 +0100	[thread overview]
Message-ID: <56D942B1.9080802@tekno-soft.it> (raw)
In-Reply-To: <DBXPR04MB270332ED36095F8A86EA2828CBE0@DBXPR04MB270.eurprd04.prod.outlook.com>

On 03/04/2016 08:11 AM, Richard Zhu wrote:

Hi Richard,

>> -----Original Message-----
>> > From: Roberto Fichera [mailto:kernel@tekno-soft.it]
>> > Sent: Friday, March 04, 2016 2:34 AM
>> > To: Richard Zhu; Bjorn Helgaas
>> > Cc: linux-pci@vger.kernel.org; Richard Zhu; Lucas Stach
>> > Subject: Re: iMX6q PCIe phy link never came up on kernel v4.4.x
>> > 
>> > On 03/03/2016 03:34 PM, Roberto Fichera wrote:
>> > 
>> > I've also checked clock, pll, PMU_MISC1 and CCGR[45] registers, all looks fine
>> > and exactly equal to uboot settings.
>> > 
>> > However I'm investigating a possible HW issue in the LDVS pad wiring against
>> > the bridge XIO2001. Let's see once this is also clarified.
>> > 
> [Zhu hongxing] it means there are no differences of the pcie initialization between uboot and kernel.
> But, pcie link is up in uboot, but failed to link up in kernel.
> Thus, we have to take look at the procedures of the initialization between uboot and kernel.
> As I remember that, the usage of the #PERST is different at least.
>
Yes! I've applied the logic below to properly reset the XIO2001

int imx6_pcie_toggle_power(struct pcie_port *pp)
{
    struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);

        /*
         * TI XIO2001 Power Up procedure:
         *
         * 1) Assert both GRST# and PERST# without power voltages
         */
    gpio_set_value(imx6_pcie->pwr_gpio, 0);
    gpio_set_value(imx6_pcie->reset_gpio, 0);
    gpio_set_value(imx6_pcie->grst_gpio, 0);
    usleep_range(10000, 20000);

        /*
         * 2) Apply 1.5V and 3.3V voltages
         */
    gpio_set_value(imx6_pcie->pwr_gpio, 1);
    usleep_range(10000, 20000);

        /*
         * 3) Deassert GRST#
         */
    gpio_set_value(imx6_pcie->grst_gpio, 1);

        /*
         * 4) After that we should apply a stable PCIe reference clock
         */
    return 0;
}

and in the imx6_pcie_deassert_core_reset() I have:

static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
{
    struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
    int ret;

-->>>    imx6_pcie_toggle_power(pp);

    ret = clk_prepare_enable(imx6_pcie->pcie_phy);
    if (ret) {
        dev_err(pp->dev, "unable to enable pcie_phy clock\n");
        goto err_pcie_phy;
    }
...
...
    /* 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);
        msleep(100);
        gpio_set_value(imx6_pcie->reset_gpio, 1);
    }
    return 0;


  reply	other threads:[~2016-03-04  8:09 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 18:47 iMX6q PCIe phy link never came up on kernel v4.4.x Roberto Fichera
2016-03-02 17:13 ` Roberto Fichera
2016-03-02 19:56   ` Bjorn Helgaas
2016-03-03  9:15     ` Richard Zhu
2016-03-03  9:30       ` Roberto Fichera
2016-03-03  9:39         ` Richard Zhu
2016-03-03 10:55           ` Roberto Fichera
2016-03-03 14:34             ` Roberto Fichera
2016-03-03 18:34               ` Roberto Fichera
2016-03-04  7:11                 ` Richard Zhu
2016-03-04  8:09                   ` Roberto Fichera [this message]
2016-03-08 14:39                 ` Roberto Fichera
2016-03-08 14:53                   ` Lucas Stach
2016-03-08 14:59                     ` Roberto Fichera
2016-03-10 17:35                     ` Roberto Fichera
2016-03-14  8:44                       ` Roberto Fichera
2016-03-15 11:08                         ` Roberto Fichera
2016-03-15 14:04                           ` Bjorn Helgaas
2016-03-15 14:10                           ` Fabio Estevam
2016-03-15 14:29                             ` Roberto Fichera
2016-03-16 14:19                               ` Fabio Estevam
2016-03-16 21:33                                 ` Tim Harvey
2016-03-16 22:12                                   ` Fabio Estevam
2016-03-17  8:32                                     ` Roberto Fichera
2016-03-17 13:28                                       ` Fabio Estevam
2016-03-17 14:14                                         ` Roberto Fichera
2016-03-17 21:09                                           ` Fabio Estevam
2016-03-17  8:20                                   ` Roberto Fichera
2016-03-16  2:07                           ` Richard Zhu
2016-03-03  9:32 ` Lucas Stach
2016-03-03  9:38   ` Roberto Fichera
2016-03-08 15:02   ` Fabio Estevam
2016-03-08 15:06     ` Roberto Fichera

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=56D942B1.9080802@tekno-soft.it \
    --to=kernel@tekno-soft.it \
    --cc=Richard.Zhu@freescale.com \
    --cc=helgaas@kernel.org \
    --cc=hongxing.zhu@nxp.com \
    --cc=l.stach@pengutronix.de \
    --cc=linux-pci@vger.kernel.org \
    /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).