linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: tegra: Move "dbi" accesses to post common DWC initialization
@ 2020-11-25 19:22 Vidya Sagar
  2020-11-26 11:30 ` Thierry Reding
  2020-12-01 10:36 ` Lorenzo Pieralisi
  0 siblings, 2 replies; 3+ messages in thread
From: Vidya Sagar @ 2020-11-25 19:22 UTC (permalink / raw)
  To: lorenzo.pieralisi, robh, bhelgaas, thierry.reding, jonathanh,
	jingoohan1, kw, gregkh
  Cc: linux-pci, linux-tegra, linux-kernel, kthota, mmaddireddy,
	vidyas, sagar.tv

commit a0fd361db8e5 ("PCI: dwc: Move "dbi", "dbi2", and "addr_space"
resource setup into common code") moved the code that sets up dbi_base
to DWC common code thereby creating a requirement to not access the "dbi"
region before calling common DWC initialization code. But, Tegra194
already had some code that programs some of the "dbi" registers resulting
in system crash. This patch addresses that issue by refactoring the code
to have accesses to the "dbi" region only after common DWC initialization.

Fixes: a0fd361db8e5 ("PCI: dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common code")
Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
---
 drivers/pci/controller/dwc/pcie-tegra194.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index ac2225175087..648e731bccfa 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -859,6 +859,16 @@ static void tegra_pcie_prepare_host(struct pcie_port *pp)
 	struct tegra_pcie_dw *pcie = to_tegra_pcie(pci);
 	u32 val;
 
+	if (!pcie->pcie_cap_base)
+		pcie->pcie_cap_base = dw_pcie_find_capability(&pcie->pci,
+							      PCI_CAP_ID_EXP);
+
+	/* Disable ASPM-L1SS advertisement if there is no CLKREQ routing */
+	if (!pcie->supports_clkreq) {
+		disable_aspm_l11(pcie);
+		disable_aspm_l12(pcie);
+	}
+
 	val = dw_pcie_readl_dbi(pci, PCI_IO_BASE);
 	val &= ~(IO_BASE_IO_DECODE | IO_BASE_IO_DECODE_BIT8);
 	dw_pcie_writel_dbi(pci, PCI_IO_BASE, val);
@@ -1389,15 +1399,6 @@ static int tegra_pcie_config_controller(struct tegra_pcie_dw *pcie,
 
 	reset_control_deassert(pcie->core_rst);
 
-	pcie->pcie_cap_base = dw_pcie_find_capability(&pcie->pci,
-						      PCI_CAP_ID_EXP);
-
-	/* Disable ASPM-L1SS advertisement as there is no CLKREQ routing */
-	if (!pcie->supports_clkreq) {
-		disable_aspm_l11(pcie);
-		disable_aspm_l12(pcie);
-	}
-
 	return ret;
 
 fail_phy:
-- 
2.17.1


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

* Re: [PATCH] PCI: tegra: Move "dbi" accesses to post common DWC initialization
  2020-11-25 19:22 [PATCH] PCI: tegra: Move "dbi" accesses to post common DWC initialization Vidya Sagar
@ 2020-11-26 11:30 ` Thierry Reding
  2020-12-01 10:36 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2020-11-26 11:30 UTC (permalink / raw)
  To: Vidya Sagar
  Cc: lorenzo.pieralisi, robh, bhelgaas, jonathanh, jingoohan1, kw,
	gregkh, linux-pci, linux-tegra, linux-kernel, kthota,
	mmaddireddy, sagar.tv

[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

On Thu, Nov 26, 2020 at 12:52:34AM +0530, Vidya Sagar wrote:
> commit a0fd361db8e5 ("PCI: dwc: Move "dbi", "dbi2", and "addr_space"
> resource setup into common code") moved the code that sets up dbi_base
> to DWC common code thereby creating a requirement to not access the "dbi"
> region before calling common DWC initialization code. But, Tegra194
> already had some code that programs some of the "dbi" registers resulting
> in system crash. This patch addresses that issue by refactoring the code
> to have accesses to the "dbi" region only after common DWC initialization.
> 
> Fixes: a0fd361db8e5 ("PCI: dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common code")
> Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
> ---
>  drivers/pci/controller/dwc/pcie-tegra194.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)

This, together with your other patch fixes Tegra194 PCI on top of
next-20201126 for me, so:

Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] PCI: tegra: Move "dbi" accesses to post common DWC initialization
  2020-11-25 19:22 [PATCH] PCI: tegra: Move "dbi" accesses to post common DWC initialization Vidya Sagar
  2020-11-26 11:30 ` Thierry Reding
@ 2020-12-01 10:36 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2020-12-01 10:36 UTC (permalink / raw)
  To: thierry.reding, jonathanh, gregkh, robh, bhelgaas, kw,
	jingoohan1, Vidya Sagar
  Cc: Lorenzo Pieralisi, sagar.tv, linux-pci, mmaddireddy, linux-tegra,
	linux-kernel, kthota

On Thu, 26 Nov 2020 00:52:34 +0530, Vidya Sagar wrote:
> commit a0fd361db8e5 ("PCI: dwc: Move "dbi", "dbi2", and "addr_space"
> resource setup into common code") moved the code that sets up dbi_base
> to DWC common code thereby creating a requirement to not access the "dbi"
> region before calling common DWC initialization code. But, Tegra194
> already had some code that programs some of the "dbi" registers resulting
> in system crash. This patch addresses that issue by refactoring the code
> to have accesses to the "dbi" region only after common DWC initialization.

Applied to pci/dwc, thanks!

[1/1] PCI: tegra: Move "dbi" accesses to post common DWC initialization
      https://git.kernel.org/lpieralisi/pci/c/369b868f4a

Thanks,
Lorenzo

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

end of thread, other threads:[~2020-12-01 10:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 19:22 [PATCH] PCI: tegra: Move "dbi" accesses to post common DWC initialization Vidya Sagar
2020-11-26 11:30 ` Thierry Reding
2020-12-01 10:36 ` Lorenzo Pieralisi

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).