From: Bjorn Helgaas <bhelgaas@google.com>
To: Zhou Wang <wangzhou1@hisilicon.com>
Cc: Jingoo Han <jingoohan1@gmail.com>,
Pratyush Anand <pratyush.anand@gmail.com>,
linux-pci@vger.kernel.org, gabriele.paoloni@huawei.com,
yuanzhichang@hisilicon.com, zhangjukuo@huawei.com,
liguozhu@hisilicon.com, Richard Zhu <Richard.Zhu@freescale.com>,
Lucas Stach <l.stach@pengutronix.de>
Subject: Re: [PATCH] PCI: designware: set PORT_LOGIC_SPEED_CHANGE before linkup
Date: Tue, 2 Jun 2015 14:37:07 -0500 [thread overview]
Message-ID: <20150602193707.GJ3631@google.com> (raw)
In-Reply-To: <1433211273-226508-1-git-send-email-wangzhou1@hisilicon.com>
[+cc Richard, Lucas for imx6 questions below]
On Tue, Jun 02, 2015 at 10:14:33AM +0800, Zhou Wang wrote:
> When connected some PCIe3.0 cards(e.g. LSI 2208 PCIe-RAID card, Mellanox IB card),
> It will appear link unstable which will lead reading/writing fail.
>
> Here just move the setting of PORT_LOGIC_SPEED_CHANGE bit before starting
> building link. After doing this, it will work fine with above PCIe3.0 card.
>
> This patch is based on v4.1-rc4
>
> Signed-off-by: Zhou Wang <wangzhou1@hisilicon.com>
> ---
> drivers/pci/host/pcie-designware.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
> index 2e9f84f..64ebc51 100644
> --- a/drivers/pci/host/pcie-designware.c
> +++ b/drivers/pci/host/pcie-designware.c
> @@ -498,10 +498,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
> /* program correct class for RC */
> dw_pcie_wr_own_conf(pp, PCI_CLASS_DEVICE, 2, PCI_CLASS_BRIDGE_PCI);
>
> - dw_pcie_rd_own_conf(pp, PCIE_LINK_WIDTH_SPEED_CONTROL, 4, &val);
> - val |= PORT_LOGIC_SPEED_CHANGE;
> - dw_pcie_wr_own_conf(pp, PCIE_LINK_WIDTH_SPEED_CONTROL, 4, val);
> -
> #ifdef CONFIG_PCI_MSI
> dw_pcie_msi_chip.dev = pp->dev;
> dw_pci.msi_ctrl = &dw_pcie_msi_chip;
> @@ -797,6 +793,10 @@ void dw_pcie_setup_rc(struct pcie_port *pp)
> }
> dw_pcie_writel_rc(pp, val, PCIE_LINK_WIDTH_SPEED_CONTROL);
>
> + dw_pcie_readl_rc(pp, PCIE_LINK_WIDTH_SPEED_CONTROL, &val);
> + val |= PORT_LOGIC_SPEED_CHANGE;
> + dw_pcie_writel_rc(pp, val, PCIE_LINK_WIDTH_SPEED_CONTROL);
It makes sense to me to do this at the same place we do the other write to
PCIE_LINK_WIDTH_SPEED_CONTROL.
1) Can this be combined with the previous write, so we only need a single
write to PCIE_LINK_WIDTH_SPEED_CONTROL, e.g., something like this?
switch (pp->lanes) {
case 1:
val |= PORT_LOGIC_LINK_WIDTH_1_LANES;
...
}
val |= PORT_LOGIC_SPEED_CHANGE;
dw_pcie_writel_rc(pp, val, PCIE_LINK_WIDTH_SPEED_CONTROL);
2) imx6_pcie_start_link() also writes PCIE_LINK_WIDTH_SPEED_CONTROL. It
has a loop to wait for the speed change to finish. Does
dw_pcie_setup_rc() need a similar loop?
3) Since you are moving the PORT_LOGIC_SPEED_CHANGE write from
dw_pcie_host_init() to dw_pcie_setup_rc(), it will now happen before
imx6_pcie_start_link(). Does that mean we can remove the write from
imx6_pcie_start_link() completely?
> /* setup RC BARs */
> dw_pcie_writel_rc(pp, 0x00000004, PCI_BASE_ADDRESS_0);
> dw_pcie_writel_rc(pp, 0x00000000, PCI_BASE_ADDRESS_1);
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-06-02 19:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 2:14 [PATCH] PCI: designware: set PORT_LOGIC_SPEED_CHANGE before linkup Zhou Wang
2015-06-02 19:37 ` Bjorn Helgaas [this message]
2015-06-05 11:05 ` Zhou Wang
2015-06-18 16:42 ` Bjorn Helgaas
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=20150602193707.GJ3631@google.com \
--to=bhelgaas@google.com \
--cc=Richard.Zhu@freescale.com \
--cc=gabriele.paoloni@huawei.com \
--cc=jingoohan1@gmail.com \
--cc=l.stach@pengutronix.de \
--cc=liguozhu@hisilicon.com \
--cc=linux-pci@vger.kernel.org \
--cc=pratyush.anand@gmail.com \
--cc=wangzhou1@hisilicon.com \
--cc=yuanzhichang@hisilicon.com \
--cc=zhangjukuo@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.