Skip to contentSkip to conversation

PCI: imx6: fix occasional link failure

PATCH Applied Tim Harvey 7 participants 11 messages Aug 8, 2014 – Sep 16, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH 1/1 PCI: imx6: fix occasional link failure

According to the IMX6 reference manuals, REF_SSP_EN (Reference clock enable for SS function) must remain deasserted until the reference clock is running at the appropriate frequency.

Without this patch we find a high link failure rate (>5%) on certain IMX6 boards at various temperatures.

---
 drivers/pci/host/pci-imx6.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pci/host/pci-imx6.c +6 -5
index 1be6073..9b6bab9 100644
@@ -256,11 +256,6 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
 	int ret;
 
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
-			IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
-			IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
-
 	ret = clk_prepare_enable(imx6_pcie->pcie_phy);
 	if (ret) {
 		dev_err(pp->dev, "unable to enable pcie_phy clock\n");
@@ -282,6 +277,12 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	/* allow the clocks to stabilize */
 	usleep_range(200, 500);
 
+	/* power up core phy and enable ref clock */
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+			IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+			IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
+
 	/* Some boards don't have PCIe reset GPIO. */
 	if (gpio_is_valid(imx6_pcie->reset_gpio)) {
 		gpio_set_value(imx6_pcie->reset_gpio, 0);
Signature · 1 line
1.8.3.2
#1 lore raw

Hi Tim:

Quoted 38 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Tim Harvey
Sent: Friday, August 08, 2014 2:37 PM
To: [email protected]
Cc: Fabio Estevam; Guo Shawn-R65073; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH] PCI: imx6: fix occasional link failure

According to the IMX6 reference manuals, REF_SSP_EN (Reference clock enable for SS function) must remain deasserted until the reference clock is running at the appropriate frequency.

Without this patch we find a high link failure rate (>5%) on certain IMX6 boards at various temperatures.

---
 drivers/pci/host/pci-imx6.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pci/host/pci-imx6.c index renamed from drivers/pci/host/pci-imx6.c +0 -0

1be6073..9b6bab9 100644

drivers/pci/host/pci-imx6.c +0 -5
@@ -256,11 +256,6 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port
 *pp)
 	struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
 	int ret;
 
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
-			IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
-			IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
-
 	ret = clk_prepare_enable(imx6_pcie->pcie_phy);
 	if (ret) {
drivers/pci/host/pci-imx6.c +0 -0
 		dev_err(pp->dev, "unable to enable pcie_phy clock\n"); @@ -282,6

drivers/pci/host/pci-imx6.c static int imx6_pcie_deassert_core_reset(struct pcie_port *pp) · line 285

Quoted 10 lines
drivers/pci/host/pci-imx6.c +7 -0
+277,12 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	/* allow the clocks to stabilize */
 	usleep_range(200, 500);
 
+	/* power up core phy and enable ref clock */
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+			IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+			IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
+

[Richard] It's better add some comments into the codes, why Enable_pcie_clock should be placed before ssp_en is set. For example:
- enable_pcie_clock should be call before ssp_en is set, since that ssp_en control the phy_ref clk gate, turn on it after the source of the pcie clks are stable.

Best Regards
Richard Zhu

Quoted 10 lines
drivers/pci/host/pci-imx6.c +0 -1
 	/* Some boards don't have PCIe reset GPIO. */
 	if (gpio_is_valid(imx6_pcie->reset_gpio)) {
 		gpio_set_value(imx6_pcie->reset_gpio, 0);
--

1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Tim Harvey
Quoted 11 lines · Tim Harvey

According to the IMX6 reference manuals, REF_SSP_EN (Reference clock enable for SS function) must remain deasserted until the reference clock is running at the appropriate frequency.

Without this patch we find a high link failure rate (>5%) on certain IMX6 boards at various temperatures.

---
 drivers/pci/host/pci-imx6.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

<formletter>

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read Documentation/stable_kernel_rules.txt for how to do this properly.

</formletter>

reviewer
#3 lore raw
In reply to Tim Harvey
Quoted 8 lines · Tim Harvey

According to the IMX6 reference manuals, REF_SSP_EN (Reference clock enable for SS function) must remain deasserted until the reference clock is running at the appropriate frequency.

Without this patch we find a high link failure rate (>5%) on certain IMX6 boards at various temperatures.

Thanks, Tim.

Marek,

Does this fix the PCI linkup failures you reported earlier?

Regards,

Fabio Estevam

Acked-by
#4 lore raw
Quoted 8 lines · Fabio Estevam
Quoted 7 lines · Tim Harvey

According to the IMX6 reference manuals, REF_SSP_EN (Reference clock enable for SS function) must remain deasserted until the reference clock is running at the appropriate frequency.

Without this patch we find a high link failure rate (>5%) on certain IMX6 boards at various temperatures.

Quoted 7 lines
Quoted 1 line

Thanks, Tim.

Marek,

Does this fix the PCI linkup failures you reported earlier?

I currently don't have the board available, so I will moan later if this is still broken. Please go ahead and apply, the patch looks good to me:

Best regards,
Marek Vasut

reviewer Tested-by on v1 1/1
#5 lore raw
In reply to Tim Harvey
Quoted 8 lines · Tim Harvey

According to the IMX6 reference manuals, REF_SSP_EN (Reference clock enable for SS function) must remain deasserted until the reference clock is running at the appropriate frequency.

Without this patch we find a high link failure rate (>5%) on certain IMX6 boards at various temperatures.

Thanks for the patch, Tim:

maintainer Applied
#6 lore raw
In reply to Tim Harvey
Quoted 8 lines · Tim Harvey

According to the IMX6 reference manuals, REF_SSP_EN (Reference clock enable for SS function) must remain deasserted until the reference clock is running at the appropriate frequency.

Without this patch we find a high link failure rate (>5%) on certain IMX6 boards at various temperatures.

Applied to pci/host-imx6 for v3.18 with acks from Marek and Lucas, thanks!

Quoted 36 lines
---
 drivers/pci/host/pci-imx6.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pci/host/pci-imx6.c +6 -5
index 1be6073..9b6bab9 100644
@@ -256,11 +256,6 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
 	int ret;
 
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
-			IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
-			IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
-
 	ret = clk_prepare_enable(imx6_pcie->pcie_phy);
 	if (ret) {
 		dev_err(pp->dev, "unable to enable pcie_phy clock\n");
@@ -282,6 +277,12 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	/* allow the clocks to stabilize */
 	usleep_range(200, 500);
 
+	/* power up core phy and enable ref clock */
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+			IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+			IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
+
 	/* Some boards don't have PCIe reset GPIO. */
 	if (gpio_is_valid(imx6_pcie->reset_gpio)) {
 		gpio_set_value(imx6_pcie->reset_gpio, 0);
Signature · 1 line
1.8.3.2
#7 lore raw
Quoted 11 lines · Bjorn Helgaas
Quoted 8 lines · Tim Harvey

According to the IMX6 reference manuals, REF_SSP_EN (Reference clock enable for SS function) must remain deasserted until the reference clock is running at the appropriate frequency.

Without this patch we find a high link failure rate (>5%) on certain IMX6 boards at various temperatures.

Applied to pci/host-imx6 for v3.18 with acks from Marek and Lucas, thanks!

Thanks!

Best regards,
Marek Vasut

A message that is not in the archive (sent off-list or not yet received): Message-Id: <[email protected]

author
#9 lore raw

PATCH 1/1 PCI: imx6: fix occasional link failure

According to the IMX6 reference manuals, REF_SSP_EN (Reference clock enable for SS function) must remain deasserted until the reference clock is running at the appropriate frequency.

Without this patch we find a high link failure rate (>5%) on certain IMX6 boards at various temperatures.

---

v2:
- added Tested-by Fabio Estevam
- added Acked-by Marek Vasut

---
 drivers/pci/host/pci-imx6.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pci/host/pci-imx6.c +6 -5
index 1be6073..9b6bab9 100644
@@ -256,11 +256,6 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
 	int ret;
 
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
-			IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
-			IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
-
 	ret = clk_prepare_enable(imx6_pcie->pcie_phy);
 	if (ret) {
 		dev_err(pp->dev, "unable to enable pcie_phy clock\n");
@@ -282,6 +277,12 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	/* allow the clocks to stabilize */
 	usleep_range(200, 500);
 
+	/* power up core phy and enable ref clock */
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+			IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+			IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
+
 	/* Some boards don't have PCIe reset GPIO. */
 	if (gpio_is_valid(imx6_pcie->reset_gpio)) {
 		gpio_set_value(imx6_pcie->reset_gpio, 0);
Signature · 1 line
1.8.3.2
maintainer
#10 lore raw
Quoted 10 lines · Tim Harvey

According to the IMX6 reference manuals, REF_SSP_EN (Reference clock enable for SS function) must remain deasserted until the reference clock is running at the appropriate frequency.

Without this patch we find a high link failure rate (>5%) on certain IMX6 boards at various temperatures.

I'm looking for the comment update requested by Richard, and an ack from Richard and/or Lucas. Also, please add the stable tag if you want it (see Documentation/stable_kernel_rules.txt for details).

Bjorn

Quoted 42 lines

---

v2:
- added Tested-by Fabio Estevam
- added Acked-by Marek Vasut

---
 drivers/pci/host/pci-imx6.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pci/host/pci-imx6.c +6 -5
index 1be6073..9b6bab9 100644
@@ -256,11 +256,6 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
 	int ret;
 
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
-			IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
-			IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
-
 	ret = clk_prepare_enable(imx6_pcie->pcie_phy);
 	if (ret) {
 		dev_err(pp->dev, "unable to enable pcie_phy clock\n");
@@ -282,6 +277,12 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	/* allow the clocks to stabilize */
 	usleep_range(200, 500);
 
+	/* power up core phy and enable ref clock */
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+			IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+			IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
+
 	/* Some boards don't have PCIe reset GPIO. */
 	if (gpio_is_valid(imx6_pcie->reset_gpio)) {
 		gpio_set_value(imx6_pcie->reset_gpio, 0);
Signature · 1 line
1.8.3.2
Acked-by
#11 lore raw

Am Freitag, den 05.09.2014, 11:32 -0600 schrieb Bjorn Helgaas:

Quoted 8 lines · Tim Harvey
Quoted 7 lines

According to the IMX6 reference manuals, REF_SSP_EN (Reference clock enable for SS function) must remain deasserted until the reference clock is running at the appropriate frequency.

Without this patch we find a high link failure rate (>5%) on certain IMX6 boards at various temperatures.

Quoted 8 lines
Quoted 3 lines

I'm looking for the comment update requested by Richard, and an ack from Richard and/or Lucas. Also, please add the stable tag if you want it (see Documentation/stable_kernel_rules.txt for details).

We already have a comment some line above regarding clock stabilization, so I don't think another one is strictly needed. Especially as this initialization order is clearly defined by the reference manual.

So with or without the comment added:

Quoted 48 lines

Bjorn

Quoted 42 lines

---

v2:
- added Tested-by Fabio Estevam
- added Acked-by Marek Vasut

---
 drivers/pci/host/pci-imx6.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pci/host/pci-imx6.c +6 -5
index 1be6073..9b6bab9 100644
@@ -256,11 +256,6 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
 	int ret;
 
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
-			IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
-			IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
-
 	ret = clk_prepare_enable(imx6_pcie->pcie_phy);
 	if (ret) {
 		dev_err(pp->dev, "unable to enable pcie_phy clock\n");
@@ -282,6 +277,12 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	/* allow the clocks to stabilize */
 	usleep_range(200, 500);
 
+	/* power up core phy and enable ref clock */
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+			IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+			IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
+
 	/* Some boards don't have PCIe reset GPIO. */
 	if (gpio_is_valid(imx6_pcie->reset_gpio)) {
 		gpio_set_value(imx6_pcie->reset_gpio, 0);
Signature · 1 line
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |