Skip to contentSkip to conversation

drivers: pci: imx: fix imx_pcie_remove function

PATCH New Fabio Estevam 4 participants 5 messages Oct 5, 2017 – Oct 13, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: pci: imx: fix imx_pcie_remove function

From: Sven-Ola Tuecke <[email protected]>

We have at least a minor count of boards, that failed to re-initialize PCI express in the Linux kernel. Typical failure rate is 20% on affected boards. This is mitigated by commit 6ecbe1375671 ("drivers: pci: imx:
add imx_pcie_remove function").

However, at least on some i.MX6 custom boards, when calling assert_core_reset() as part of the first-time PCIe init, read access to PCIE_PL_PFLR simply hangs. Surround this readl() with imx_pcie_fix_dabt_handler() does not help. For this reason, the forced LTSSM detection is only used on the second assert_core_reset() that is called shorly before starting the Linux kernel.

---
 drivers/pci/pcie_imx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/pcie_imx.c +4 -4
index eab0a2b..2900c8d 100644
@@ -431,7 +431,7 @@ static int imx_pcie_write_config(struct pci_controller *hose, pci_dev_t d,
 /*
  * Initial bus setup
  */
-static int imx6_pcie_assert_core_reset(void)
+static int imx6_pcie_assert_core_reset(bool prepare_for_boot)
 {
 	struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
 
@@ -459,7 +459,7 @@ static int imx6_pcie_assert_core_reset(void)
 	 * If both LTSSM_ENABLE and REF_SSP_ENABLE are active we have a strong
 	 * indication that the bootloader activated the link.
 	 */
-	if (is_mx6dq()) {
+	if (is_mx6dq() && prepare_for_boot) {
 		u32 val, gpr1, gpr12;
 
 		gpr1 = readl(&iomuxc_regs->gpr[1]);
@@ -605,7 +605,7 @@ static int imx_pcie_link_up(void)
 	uint32_t tmp;
 	int count = 0;
 
-	imx6_pcie_assert_core_reset();
+	imx6_pcie_assert_core_reset(false);
 	imx6_pcie_init_phy();
 	imx6_pcie_deassert_core_reset();
 
@@ -687,7 +687,7 @@ void imx_pcie_init(void)
 
 void imx_pcie_remove(void)
 {
-	imx6_pcie_assert_core_reset();
+	imx6_pcie_assert_core_reset(true);
 }
 
 /* Probe function. */
Signature · 1 line
2.7.4
reviewer
#1 lore raw

PATCH 1/1 drivers: pci: imx: fix imx_pcie_remove function

Hi David,

Quoted 14 lines · Fabio Estevam

From: Sven-Ola Tuecke <[email protected]>

We have at least a minor count of boards, that failed to re-initialize PCI express in the Linux kernel. Typical failure rate is 20% on affected boards. This is mitigated by commit 6ecbe1375671 ("drivers: pci: imx:
add imx_pcie_remove function").

However, at least on some i.MX6 custom boards, when calling assert_core_reset() as part of the first-time PCIe init, read access to PCIE_PL_PFLR simply hangs. Surround this readl() with imx_pcie_fix_dabt_handler() does not help. For this reason, the forced LTSSM detection is only used on the second assert_core_reset() that is called shorly before starting the Linux kernel.

Quoted 2 lines

Does this patch solve the PCIE_PL_PFLR hang you reported at
https://lists.denx.de/pipermail/u-boot/2017-September/307191.html ?

#2 lore raw

PATCH 1/1 drivers: pci: imx: fix imx_pcie_remove function

In reply to Fabio Estevam

Hi Fabio

Quoted 3 lines · Fabio Estevam

From: Sven-Ola Tuecke <[email protected]>

However, at least on some i.MX6 custom boards, when calling

By "some", I assume that not all i.MX6 systems are showing this behaviour. Does anyone have an idea which systems are affected and which are not?

Quoted 8 lines

assert_core_reset() as part of the first-time PCIe init, read access to PCIE_PL_PFLR simply hangs. Surround this readl() with imx_pcie_fix_dabt_handler() does not help. For this reason, the forced LTSSM detection is only used on the second assert_core_reset() that is called shorly before starting the Linux kernel.

Seems to work on our board therefore

#4 lore raw

PATCH 1/1 drivers: pci: imx: fix imx_pcie_remove function

In reply to Fabio Estevam
Quoted 14 lines · Fabio Estevam

From: Sven-Ola Tuecke <[email protected]>

We have at least a minor count of boards, that failed to re-initialize PCI express in the Linux kernel. Typical failure rate is 20% on affected boards. This is mitigated by commit 6ecbe1375671 ("drivers: pci: imx:
add imx_pcie_remove function").

However, at least on some i.MX6 custom boards, when calling assert_core_reset() as part of the first-time PCIe init, read access to PCIE_PL_PFLR simply hangs. Surround this readl() with imx_pcie_fix_dabt_handler() does not help. For this reason, the forced LTSSM detection is only used on the second assert_core_reset() that is called shorly before starting the Linux kernel.

Quoted 3 lines

---

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
reviewer
#3 lore raw

PATCH 1/1 drivers: pci: imx: fix imx_pcie_remove function

In reply to David Müller (ELSOFT AG)

Hi David,

Quoted 10 lines · David Müller (ELSOFT AG)

Hi Fabio

Quoted 3 lines · Fabio Estevam

From: Sven-Ola Tuecke <[email protected]>

However, at least on some i.MX6 custom boards, when calling

By "some", I assume that not all i.MX6 systems are showing this behaviour. Does anyone have an idea which systems are affected and which are not?

Yes, the mx6 board I have access to do not show this issue. Not sure why it fails on your board and on Sven's.

Quoted 6 lines
Quoted 6 lines

assert_core_reset() as part of the first-time PCIe init, read access to PCIE_PL_PFLR simply hangs. Surround this readl() with imx_pcie_fix_dabt_handler() does not help. For this reason, the forced LTSSM detection is only used on the second assert_core_reset() that is called shorly before starting the Linux kernel.

Quoted 6 lines
Quoted 2 lines

Seems to work on our board therefore

Thanks for testing and glad it works for both of you.