All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: dwc: move dw_pcie_iatu_detect() after host_init callback
@ 2021-04-07 13:12 Dmitry Baryshkov
  2021-04-07 13:37 ` Dmitry Baryshkov
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Baryshkov @ 2021-04-07 13:12 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Rob Herring, Lorenzo Pieralisi
  Cc: linux-arm-msm, Manivannan Sadhasivam, linux-pci, Hou Zhiqiang

The commit 9ea483375ded ("PCI: dwc: Move forward the iATU detection
process") broke PCIe support on Qualcomm SM8250 (and maybe other
platforms) since it moves the call to dw_pcie_iatu_detect() at the
beginning of the dw_pcie_host_init(), before ops->host_init() callback.
Accessing PCIe registers at this point causes the board to reboot since
not all clocks are enabled, making PCIe registers unavailable.

Move dw_pcie_iatu_detect() call after calling ops->host_init() callback,
so that all register are accessible.

Cc: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Fixes: 9ea483375ded ("PCI: dwc: Move forward the iATU detection process")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/pci/controller/dwc/pcie-designware-host.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 52f6887179cd..24192b40e3a2 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -319,8 +319,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
 			return PTR_ERR(pci->dbi_base);
 	}
 
-	dw_pcie_iatu_detect(pci);
-
 	bridge = devm_pci_alloc_host_bridge(dev, 0);
 	if (!bridge)
 		return -ENOMEM;
@@ -400,6 +398,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
 		if (ret)
 			goto err_free_msi;
 	}
+	dw_pcie_iatu_detect(pci);
 
 	dw_pcie_setup_rc(pp);
 	dw_pcie_msi_init(pp);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: dwc: move dw_pcie_iatu_detect() after host_init callback
  2021-04-07 13:12 [PATCH] PCI: dwc: move dw_pcie_iatu_detect() after host_init callback Dmitry Baryshkov
@ 2021-04-07 13:37 ` Dmitry Baryshkov
  2021-04-13 10:21   ` Lorenzo Pieralisi
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Baryshkov @ 2021-04-07 13:37 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Rob Herring, Lorenzo Pieralisi
  Cc: open list:DRM DRIVER FOR MSM ADRENO GPU, Manivannan Sadhasivam,
	PCI, Hou Zhiqiang

Hi,

On Wed, 7 Apr 2021 at 16:12, Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> The commit 9ea483375ded ("PCI: dwc: Move forward the iATU detection
> process") broke PCIe support on Qualcomm SM8250 (and maybe other
> platforms) since it moves the call to dw_pcie_iatu_detect() at the
> beginning of the dw_pcie_host_init(), before ops->host_init() callback.
> Accessing PCIe registers at this point causes the board to reboot since
> not all clocks are enabled, making PCIe registers unavailable.
>
> Move dw_pcie_iatu_detect() call after calling ops->host_init() callback,
> so that all register are accessible.
>
> Cc: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> Fixes: 9ea483375ded ("PCI: dwc: Move forward the iATU detection process")

Please disregard the Fixes: tag here, the patch in question came to me
from a local tree, which I failed to notice.
The patch still applies on top of the previously dropped patch (and it
is the same fix as the one proposed for exynos by Marek Szyprowski at
https://lore.kernel.org/linux-pci/b777ab31-e0b9-bbc0-9631-72b93097919e@samsung.com/.

> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  drivers/pci/controller/dwc/pcie-designware-host.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 52f6887179cd..24192b40e3a2 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -319,8 +319,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
>                         return PTR_ERR(pci->dbi_base);
>         }
>
> -       dw_pcie_iatu_detect(pci);
> -
>         bridge = devm_pci_alloc_host_bridge(dev, 0);
>         if (!bridge)
>                 return -ENOMEM;
> @@ -400,6 +398,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
>                 if (ret)
>                         goto err_free_msi;
>         }
> +       dw_pcie_iatu_detect(pci);
>
>         dw_pcie_setup_rc(pp);
>         dw_pcie_msi_init(pp);
> --
> 2.30.2
>


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: dwc: move dw_pcie_iatu_detect() after host_init callback
  2021-04-07 13:37 ` Dmitry Baryshkov
@ 2021-04-13 10:21   ` Lorenzo Pieralisi
  0 siblings, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2021-04-13 10:21 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Andy Gross, Bjorn Andersson, Rob Herring,
	open list:DRM DRIVER FOR MSM ADRENO GPU, Manivannan Sadhasivam,
	PCI, Hou Zhiqiang

On Wed, Apr 07, 2021 at 04:37:15PM +0300, Dmitry Baryshkov wrote:
> Hi,
> 
> On Wed, 7 Apr 2021 at 16:12, Dmitry Baryshkov
> <dmitry.baryshkov@linaro.org> wrote:
> >
> > The commit 9ea483375ded ("PCI: dwc: Move forward the iATU detection
> > process") broke PCIe support on Qualcomm SM8250 (and maybe other
> > platforms) since it moves the call to dw_pcie_iatu_detect() at the
> > beginning of the dw_pcie_host_init(), before ops->host_init() callback.
> > Accessing PCIe registers at this point causes the board to reboot since
> > not all clocks are enabled, making PCIe registers unavailable.
> >
> > Move dw_pcie_iatu_detect() call after calling ops->host_init() callback,
> > so that all register are accessible.
> >
> > Cc: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> > Fixes: 9ea483375ded ("PCI: dwc: Move forward the iATU detection process")
> 
> Please disregard the Fixes: tag here, the patch in question came to me
> from a local tree, which I failed to notice.
> The patch still applies on top of the previously dropped patch (and it
> is the same fix as the one proposed for exynos by Marek Szyprowski at
> https://lore.kernel.org/linux-pci/b777ab31-e0b9-bbc0-9631-72b93097919e@samsung.com/.

Ok. Can you integrate Bjorn's changes (reported in the thread above) to
the commit log and resend it with Marek in CC so that I can merge it
please ?

Thanks,
Lorenzo

> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > ---
> >  drivers/pci/controller/dwc/pcie-designware-host.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> > index 52f6887179cd..24192b40e3a2 100644
> > --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> > @@ -319,8 +319,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
> >                         return PTR_ERR(pci->dbi_base);
> >         }
> >
> > -       dw_pcie_iatu_detect(pci);
> > -
> >         bridge = devm_pci_alloc_host_bridge(dev, 0);
> >         if (!bridge)
> >                 return -ENOMEM;
> > @@ -400,6 +398,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
> >                 if (ret)
> >                         goto err_free_msi;
> >         }
> > +       dw_pcie_iatu_detect(pci);
> >
> >         dw_pcie_setup_rc(pp);
> >         dw_pcie_msi_init(pp);
> > --
> > 2.30.2
> >
> 
> 
> -- 
> With best wishes
> Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-13 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 13:12 [PATCH] PCI: dwc: move dw_pcie_iatu_detect() after host_init callback Dmitry Baryshkov
2021-04-07 13:37 ` Dmitry Baryshkov
2021-04-13 10:21   ` Lorenzo Pieralisi

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.