Message ID | 20190415004632.5907-3-andrew.smirnov@gmail.com (mailing list archive) |
---|---|
State | Accepted, archived |
Commit | ee6f37175b3f7ae1c3bc147d4779c6043ce25461 |
Headers | show |
Series | i.MX6, DesignWare PCI improvements | expand |
Am Sonntag, den 14.04.2019, 17:46 -0700 schrieb Andrey Smirnov: > All calls to imx6_pcie_wait_for_link() share the same error path and > the state of PHY debug registers will already be printed there, so > there's no real reason we can't just use dw_pcie_wait_for_link(). Drop > imx6_pcie_wait_for_link() and replace it with dw_pcie_wait_for_link(). > > > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> > > Suggested-by: Lucas Stach <l.stach@pengutronix.de> > > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> > > Cc: Bjorn Helgaas <bhelgaas@google.com> > > Cc: Chris Healy <cphealy@gmail.com> > > Cc: Lucas Stach <l.stach@pengutronix.de> > Cc: linux-kernel@vger.kernel.org > Cc: linux-pci@vger.kernel.org Reviewed-by: Lucas Stach <l.stach@pengutronix.de> > --- > drivers/pci/controller/dwc/pci-imx6.c | 19 ++----------------- > 1 file changed, 2 insertions(+), 17 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c > index ea2617712a3b..bb3dcfdbf697 100644 > --- a/drivers/pci/controller/dwc/pci-imx6.c > +++ b/drivers/pci/controller/dwc/pci-imx6.c > @@ -723,21 +723,6 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) > > return 0; > } > > -static int imx6_pcie_wait_for_link(struct imx6_pcie *imx6_pcie) > -{ > > - struct dw_pcie *pci = imx6_pcie->pci; > > - struct device *dev = pci->dev; > - > > - /* check if the link is up or not */ > > - if (!dw_pcie_wait_for_link(pci)) > > - return 0; > - > > - dev_dbg(dev, "DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n", > > - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R0), > > - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1)); > > - return -ETIMEDOUT; > -} > - > static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) > { > > struct dw_pcie *pci = imx6_pcie->pci; > @@ -796,7 +781,7 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie) > > /* Start LTSSM. */ > > imx6_pcie_ltssm_enable(dev); > > > - ret = imx6_pcie_wait_for_link(imx6_pcie); > > + ret = dw_pcie_wait_for_link(pci); > > if (ret) > > goto err_reset_phy; > > @@ -834,7 +819,7 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie) > > } > > > /* Make sure link training is finished as well! */ > > - ret = imx6_pcie_wait_for_link(imx6_pcie); > > + ret = dw_pcie_wait_for_link(pci); > > if (ret) { > > dev_err(dev, "Failed to bring link up!\n"); > > goto err_reset_phy;
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index ea2617712a3b..bb3dcfdbf697 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -723,21 +723,6 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) return 0; } -static int imx6_pcie_wait_for_link(struct imx6_pcie *imx6_pcie) -{ - struct dw_pcie *pci = imx6_pcie->pci; - struct device *dev = pci->dev; - - /* check if the link is up or not */ - if (!dw_pcie_wait_for_link(pci)) - return 0; - - dev_dbg(dev, "DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n", - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R0), - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1)); - return -ETIMEDOUT; -} - static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) { struct dw_pcie *pci = imx6_pcie->pci; @@ -796,7 +781,7 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie) /* Start LTSSM. */ imx6_pcie_ltssm_enable(dev); - ret = imx6_pcie_wait_for_link(imx6_pcie); + ret = dw_pcie_wait_for_link(pci); if (ret) goto err_reset_phy; @@ -834,7 +819,7 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie) } /* Make sure link training is finished as well! */ - ret = imx6_pcie_wait_for_link(imx6_pcie); + ret = dw_pcie_wait_for_link(pci); if (ret) { dev_err(dev, "Failed to bring link up!\n"); goto err_reset_phy;
All calls to imx6_pcie_wait_for_link() share the same error path and the state of PHY debug registers will already be printed there, so there's no real reason we can't just use dw_pcie_wait_for_link(). Drop imx6_pcie_wait_for_link() and replace it with dw_pcie_wait_for_link(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Suggested-by: Lucas Stach <l.stach@pengutronix.de> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Chris Healy <cphealy@gmail.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org --- drivers/pci/controller/dwc/pci-imx6.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)