[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AS8PR04MB86760B1E09E3CD01C7DC19B68C899@AS8PR04MB8676.eurprd04.prod.outlook.com>
Date: Wed, 13 Jul 2022 10:57:23 +0000
From: Hongxing Zhu <hongxing.zhu@....com>
To: Lucas Stach <l.stach@...gutronix.de>,
"bhelgaas@...gle.com" <bhelgaas@...gle.com>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"broonie@...nel.org" <broonie@...nel.org>,
"lorenzo.pieralisi@....com" <lorenzo.pieralisi@....com>,
"festevam@...il.com" <festevam@...il.com>,
"francesco.dolcini@...adex.com" <francesco.dolcini@...adex.com>
CC: "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kernel@...gutronix.de" <kernel@...gutronix.de>,
dl-linux-imx <linux-imx@....com>
Subject: RE: [PATCH v14 13/17] PCI: imx6: Reduce resume time by only starting
link if it was up before suspend
> -----Original Message-----
> From: Lucas Stach <l.stach@...gutronix.de>
> Sent: 2022年7月13日 16:48
> To: Hongxing Zhu <hongxing.zhu@....com>; bhelgaas@...gle.com;
> robh+dt@...nel.org; broonie@...nel.org; lorenzo.pieralisi@....com;
> festevam@...il.com; francesco.dolcini@...adex.com
> Cc: linux-pci@...r.kernel.org; linux-arm-kernel@...ts.infradead.org;
> linux-kernel@...r.kernel.org; kernel@...gutronix.de; dl-linux-imx
> <linux-imx@....com>
> Subject: Re: [PATCH v14 13/17] PCI: imx6: Reduce resume time by only starting
> link if it was up before suspend
>
> Am Freitag, dem 01.07.2022 um 11:25 +0800 schrieb Richard Zhu:
> > Because i.MX PCIe doesn't support hot-plug feature. In the link down
> > scenario, only start the PCIe link training in resume when the link is
> > up before system suspend to avoid the long latency in the link
> > training period.
> >
> > Signed-off-by: Richard Zhu <hongxing.zhu@....com>
> > Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
> > ---
> > drivers/pci/controller/dwc/pci-imx6.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pci-imx6.c
> > b/drivers/pci/controller/dwc/pci-imx6.c
> > index e236f824c808..5a06fbca82d6 100644
> > --- a/drivers/pci/controller/dwc/pci-imx6.c
> > +++ b/drivers/pci/controller/dwc/pci-imx6.c
> > @@ -67,6 +67,7 @@ struct imx6_pcie {
> > struct dw_pcie *pci;
> > int reset_gpio;
> > bool gpio_active_high;
> > + bool link_is_up;
> > struct clk *pcie_bus;
> > struct clk *pcie_phy;
> > struct clk *pcie_inbound_axi;
> > @@ -881,11 +882,13 @@ static int imx6_pcie_start_link(struct dw_pcie
> *pci)
> > dev_info(dev, "Link: Gen2 disabled\n");
> > }
> >
> > + imx6_pcie->link_is_up = true;
> > tmp = dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKSTA);
> > dev_info(dev, "Link up, Gen%i\n", tmp & PCI_EXP_LNKSTA_CLS);
> > return 0;
> >
> > err_reset_phy:
> > + imx6_pcie->link_is_up = false;
> > dev_dbg(dev, "PHY DEBUG_R0=0x%08x DEBUG_R1=0x%08x\n",
> > dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0),
> > dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1)); @@ -1032,9 +1035,8
> @@
> > static int imx6_pcie_resume_noirq(struct device *dev)
> > return ret;
> > dw_pcie_setup_rc(pp);
> >
> > - ret = imx6_pcie_start_link(imx6_pcie->pci);
> > - if (ret < 0)
> > - dev_info(dev, "pcie link is down after resume.\n");
> > + if (imx6_pcie->link_is_up)
> > + imx6_pcie_start_link(imx6_pcie->pci);
>
> While the change itself is correct, the removal of the return value check should
> be added to the previous patch, as that's the point where you change this
> function to always return 0, rendering this check pointless.
Thanks for your comments.
Yes, it is. Indeed the return check should be cleaned up in the 12/17, since
imx6_pcie_start_link() always returns 0.
Best Regards
Richard Zhu
>
> Regards,
> Lucas
>
> >
> > return 0;
> > }
>
Powered by blists - more mailing lists