Skip to contentSkip to conversation

PCI: imx6: Make reset-gpio optional

PATCH New Marek Vasut 4 participants 11 messages Dec 12, 2013 – Dec 19, 2013

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

PATCH v2 1/7 PCI: imx6: Make reset-gpio optional

Some boards do not have a PCIe reset GPIO. To avoid probe failure on these boards, make the reset GPIO optional as well.

Cc Bjorn Helgaas <[email protected]>
Cc Frank Li <[email protected]>
Cc Harro Haan <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Mohit KUMAR <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Sean Cross <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Siva Reddy Kallam <[email protected]>
Cc Srikanth T Shivanand <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Troy Kisky <[email protected]>
Cc Yinghai Lu <[email protected]>
---
 .../devicetree/bindings/pci/designware-pcie.txt    |  2 ++
 drivers/pci/host/pci-imx6.c                        | 29 +++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)

V2: Make the 'reset-gpio' prop shared between imx6 and exynos
Rebase on top of pci/host-imx6

Documentation/devicetree/bindings/pci/designware-pcie.txt +2 -0
index d5d26d4..d6fae13 100644
@@ -19,6 +19,8 @@ Required properties:
 	to define the mapping of the PCIe interface to interrupt
 	numbers.
 - num-lanes: number of lanes to use
+
+Optional properties:
 - reset-gpio: gpio pin number of power good signal
 
 Optional properties for fsl,imx6q-pcie
drivers/pci/host/pci-imx6.c +15 -14
index 9fc1cb6..c247602 100644
@@ -214,9 +214,12 @@ static int imx6_pcie_assert_core_reset(struct pcie_port *pp)
 	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
 			IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 16);
 
-	gpio_set_value(imx6_pcie->reset_gpio, 0);
-	msleep(100);
-	gpio_set_value(imx6_pcie->reset_gpio, 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);
+		msleep(100);
+		gpio_set_value(imx6_pcie->reset_gpio, 1);
+	}
 
 	return 0;
 }
@@ -432,17 +435,15 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
 
 	/* Fetch GPIOs */
 	imx6_pcie->reset_gpio = of_get_named_gpio(np, "reset-gpio", 0);
-	if (!gpio_is_valid(imx6_pcie->reset_gpio)) {
-		dev_err(&pdev->dev, "no reset-gpio defined\n");
-		ret = -ENODEV;
-	}
-	ret = devm_gpio_request_one(&pdev->dev,
-				imx6_pcie->reset_gpio,
-				GPIOF_OUT_INIT_LOW,
-				"PCIe reset");
-	if (ret) {
-		dev_err(&pdev->dev, "unable to get reset gpio\n");
-		return ret;
+	if (gpio_is_valid(imx6_pcie->reset_gpio)) {
+		ret = devm_gpio_request_one(&pdev->dev,
+					imx6_pcie->reset_gpio,
+					GPIOF_OUT_INIT_LOW,
+					"PCIe reset");
+		if (ret) {
+			dev_err(&pdev->dev, "unable to get reset gpio\n");
+			return ret;
+		}
 	}
 
 	imx6_pcie->power_on_gpio = of_get_named_gpio(np, "power-on-gpio", 0);
Signature · 1 line
1.8.4.3
#1 lore raw

PATCH 2/7 PCI: imx6: Fix waiting for link up

While waiting for the PHY to report the PCIe link is up, we might hit a situation where the link training is still in progress, while the PHY already reports the link is up. Add additional check for this condition.

Cc Bjorn Helgaas <[email protected]>
Cc Frank Li <[email protected]>
Cc Harro Haan <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Mohit KUMAR <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Sean Cross <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Siva Reddy Kallam <[email protected]>
Cc Srikanth T Shivanand <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Troy Kisky <[email protected]>
Cc Yinghai Lu <[email protected]>
---
 drivers/pci/host/pci-imx6.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/pci/host/pci-imx6.c +13 -4
index c247602..f5541c3 100644
@@ -48,6 +48,8 @@ struct imx6_pcie {
 #define PL_OFFSET 0x700
 #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
 #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
+#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING	(1 << 29)
+#define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP		(1 << 4)
 
 #define PCIE_PHY_CTRL (PL_OFFSET + 0x114)
 #define PCIE_PHY_CTRL_DATA_LOC 0
@@ -338,10 +340,17 @@ static int imx6_pcie_link_up(struct pcie_port *pp)
 {
 	u32 rc, ltssm, rx_valid, temp;
 
-	/* link is debug bit 36, debug register 1 starts@bit 32 */
-	rc = readl(pp->dbi_base + PCIE_PHY_DEBUG_R1) & (0x1 << (36 - 32));
-	if (rc)
-		return -EAGAIN;
+	/*
+	 * Test if the PHY reports that the link is up and also that
+	 * the link training finished. It might happen that the PHY
+	 * reports the link is already up, but the link training bit
+	 * is still set, so make sure to check the training is done
+	 * as well here.
+	 */
+	rc = readl(pp->dbi_base + PCIE_PHY_DEBUG_R1);
+	if ((rc & PCIE_PHY_DEBUG_R1_XMLH_LINK_UP) &&
+	    !(rc & PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING))
+		return 1;
 
 	/*
 	 * From L0, initiate MAC entry to gen2 if EP/RC supports gen2.
Signature · 1 line
1.8.4.3
#2 lore raw

PATCH v2 3/7 PCI: imx6: Split away the PHY reset

In reply to Marek Vasut

Split the PCIe PHY reset from the link up function to make the code a little more structured.

Cc Bjorn Helgaas <[email protected]>
Cc Frank Li <[email protected]>
Cc Harro Haan <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Mohit KUMAR <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Sean Cross <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Siva Reddy Kallam <[email protected]>
Cc Srikanth T Shivanand <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Troy Kisky <[email protected]>
Cc Yinghai Lu <[email protected]>
---
 drivers/pci/host/pci-imx6.c | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

V2: Drop unused 'temp' variable.

drivers/pci/host/pci-imx6.c +19 -16
index f5541c3..4983784 100644
@@ -336,9 +336,26 @@ static void imx6_pcie_host_init(struct pcie_port *pp)
 	return;
 }
 
+static void imx6_pcie_reset_phy(struct pcie_port *pp)
+{
+	uint32_t temp;
+
+	pcie_phy_read(pp->dbi_base, PHY_RX_OVRD_IN_LO, &temp);
+	temp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN |
+		 PHY_RX_OVRD_IN_LO_RX_PLL_EN);
+	pcie_phy_write(pp->dbi_base, PHY_RX_OVRD_IN_LO, temp);
+
+	usleep_range(2000, 3000);
+
+	pcie_phy_read(pp->dbi_base, PHY_RX_OVRD_IN_LO, &temp);
+	temp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN |
+		  PHY_RX_OVRD_IN_LO_RX_PLL_EN);
+	pcie_phy_write(pp->dbi_base, PHY_RX_OVRD_IN_LO, temp);
+}
+
 static int imx6_pcie_link_up(struct pcie_port *pp)
 {
-	u32 rc, ltssm, rx_valid, temp;
+	u32 rc, ltssm, rx_valid;
 
 	/*
 	 * Test if the PHY reports that the link is up and also that
@@ -370,21 +387,7 @@ static int imx6_pcie_link_up(struct pcie_port *pp)
 
 	dev_err(pp->dev, "transition to gen2 is stuck, reset PHY!\n");
 
-	pcie_phy_read(pp->dbi_base,
-		PHY_RX_OVRD_IN_LO, &temp);
-	temp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN
-		| PHY_RX_OVRD_IN_LO_RX_PLL_EN);
-	pcie_phy_write(pp->dbi_base,
-		PHY_RX_OVRD_IN_LO, temp);
-
-	usleep_range(2000, 3000);
-
-	pcie_phy_read(pp->dbi_base,
-		PHY_RX_OVRD_IN_LO, &temp);
-	temp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN
-		| PHY_RX_OVRD_IN_LO_RX_PLL_EN);
-	pcie_phy_write(pp->dbi_base,
-		PHY_RX_OVRD_IN_LO, temp);
+	imx6_pcie_reset_phy(pp);
 
 	return 0;
 }
Signature · 1 line
1.8.4.3
#3 lore raw

PATCH 4/7 PCI: imx6: Split away the link up wait loop

In reply to Marek Vasut

Split the function that waits for the PCIe link to come up from the rest if the host init function. We will find this change useful in the subsequent patch, since this will be called twice then.

Cc Bjorn Helgaas <[email protected]>
Cc Frank Li <[email protected]>
Cc Harro Haan <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Mohit KUMAR <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Sean Cross <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Siva Reddy Kallam <[email protected]>
Cc Srikanth T Shivanand <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Troy Kisky <[email protected]>
Cc Yinghai Lu <[email protected]>
---
 drivers/pci/host/pci-imx6.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)
drivers/pci/host/pci-imx6.c +20 -12
index 4983784..e9e580a 100644
@@ -304,6 +304,25 @@ static void imx6_pcie_init_phy(struct pcie_port *pp)
 			IMX6Q_GPR8_TX_SWING_LOW, 127 << 25);
 }
 
+static int imx6_pcie_wait_for_link(struct pcie_port *pp)
+{
+	int count = 200;
+
+	while (!dw_pcie_link_up(pp)) {
+		usleep_range(100, 1000);
+		if (--count)
+			continue;
+
+		dev_err(pp->dev, "phy link never came up\n");
+		dev_dbg(pp->dev, "DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n",
+			readl(pp->dbi_base + PCIE_PHY_DEBUG_R0),
+			readl(pp->dbi_base + PCIE_PHY_DEBUG_R1));
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 static void imx6_pcie_host_init(struct pcie_port *pp)
 {
 	int count = 0;
@@ -320,18 +339,7 @@ static void imx6_pcie_host_init(struct pcie_port *pp)
 	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
 			IMX6Q_GPR12_PCIE_CTL_2, 1 << 10);
 
-	while (!dw_pcie_link_up(pp)) {
-		usleep_range(100, 1000);
-		count++;
-		if (count >= 200) {
-			dev_err(pp->dev, "phy link never came up\n");
-			dev_dbg(pp->dev,
-				"DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n",
-				readl(pp->dbi_base + PCIE_PHY_DEBUG_R0),
-				readl(pp->dbi_base + PCIE_PHY_DEBUG_R1));
-			break;
-		}
-	}
+	imx6_pcie_wait_for_link(pp);
 
 	return;
 }
Signature · 1 line
1.8.4.3
#4 lore raw

PATCH v2 5/7 PCI: imx6: Fix link start operation

In reply to Marek Vasut

This patch first forces the link into Gen1 mode before starting up the link and only after the link is up requests the link to start negotiating possible Gen2 mode operation. This is because without such sequence, some PCIe switches are not detected at all.

Cc Bjorn Helgaas <[email protected]>
Cc Frank Li <[email protected]>
Cc Harro Haan <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Mohit KUMAR <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Sean Cross <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Siva Reddy Kallam <[email protected]>
Cc Srikanth T Shivanand <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Troy Kisky <[email protected]>
Cc Yinghai Lu <[email protected]>
---
 drivers/pci/host/pci-imx6.c | 78 +++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 72 insertions(+), 6 deletions(-)

V2: Change the link speed reporting from dev_err() to dev_dbg() so it doesn't
polute the kernel output.

drivers/pci/host/pci-imx6.c +72 -6
index e9e580a..a945e74 100644
@@ -44,6 +44,12 @@ struct imx6_pcie {
 	void __iomem		*mem_base;
 };
 
+/* PCIe Root Complex registers (memory-mapped) */
+#define PCIE_RC_LCR				0x7c
+#define PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN1	0x1
+#define PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN2	0x2
+#define PCIE_RC_LCR_MAX_LINK_SPEEDS_MASK	0xf
+
 /* PCIe Port Logic registers (memory-mapped) */
 #define PL_OFFSET 0x700
 #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
@@ -61,6 +67,9 @@ struct imx6_pcie {
 #define PCIE_PHY_STAT (PL_OFFSET + 0x110)
 #define PCIE_PHY_STAT_ACK_LOC 16
 
+#define PCIE_LINK_WIDTH_SPEED_CONTROL	0x80C
+#define PORT_LOGIC_SPEED_CHANGE		(0x1 << 17)
+
 /* PHY registers (not memory-mapped) */
 #define PCIE_PHY_RX_ASIC_OUT 0x100D
 
@@ -323,11 +332,71 @@ static int imx6_pcie_wait_for_link(struct pcie_port *pp)
 	return 0;
 }
 
-static void imx6_pcie_host_init(struct pcie_port *pp)
+static int imx6_pcie_start_link(struct pcie_port *pp)
 {
-	int count = 0;
 	struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
+	uint32_t tmp;
+	int ret, count;
+
+	/*
+	 * Force Gen1 operation when starting the link. In case the link is
+	 * started in Gen2 mode, there is a possibility the devices on the
+	 * bus will not be detected@all. This happens with PCIe switches.
+	 */
+	tmp = readl(pp->dbi_base + PCIE_RC_LCR);
+	tmp &= ~PCIE_RC_LCR_MAX_LINK_SPEEDS_MASK;
+	tmp |= PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN1;
+	writel(tmp, pp->dbi_base + PCIE_RC_LCR);
+
+	/* Start LTSSM. */
+	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
+			IMX6Q_GPR12_PCIE_CTL_2, 1 << 10);
+
+	ret = imx6_pcie_wait_for_link(pp);
+	if (ret)
+		return ret;
+
+	/* Allow Gen2 mode after the link is up. */
+	tmp = readl(pp->dbi_base + PCIE_RC_LCR);
+	tmp &= ~PCIE_RC_LCR_MAX_LINK_SPEEDS_MASK;
+	tmp |= PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN2;
+	writel(tmp, pp->dbi_base + PCIE_RC_LCR);
+
+	/*
+	 * Start Directed Speed Change so the best possible speed both link
+	 * partners support can be negotiated.
+	 */
+	tmp = readl(pp->dbi_base + PCIE_LINK_WIDTH_SPEED_CONTROL);
+	tmp |= PORT_LOGIC_SPEED_CHANGE;
+	writel(tmp, pp->dbi_base + PCIE_LINK_WIDTH_SPEED_CONTROL);
+
+	count = 200;
+	while (count--) {
+		tmp = readl(pp->dbi_base + PCIE_LINK_WIDTH_SPEED_CONTROL);
+		/* Test if the speed change finished. */
+		if (!(tmp & PORT_LOGIC_SPEED_CHANGE))
+			break;
+		usleep_range(100, 1000);
+	}
+
+	/* Make sure link training is finished as well! */
+	if (count)
+		ret = imx6_pcie_wait_for_link(pp);
+	else
+		ret = -EINVAL;
 
+	if (ret) {
+		dev_err(pp->dev, "Failed to bring link up!\n");
+	} else {
+		tmp = readl(pp->dbi_base + 0x80);
+		dev_dbg(pp->dev, "Link up, Gen=%i\n", (tmp >> 16) & 0xf);
+	}
+
+	return ret;
+}
+
+static void imx6_pcie_host_init(struct pcie_port *pp)
+{
 	imx6_pcie_assert_core_reset(pp);
 
 	imx6_pcie_init_phy(pp);
@@ -336,10 +405,7 @@ static void imx6_pcie_host_init(struct pcie_port *pp)
 
 	dw_pcie_setup_rc(pp);
 
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
-			IMX6Q_GPR12_PCIE_CTL_2, 1 << 10);
-
-	imx6_pcie_wait_for_link(pp);
+	imx6_pcie_start_link(pp);
 
 	return;
 }
Signature · 1 line
1.8.4.3
#5 lore raw

PATCH 6/7 PCI: imx6: Fix bugs in PCIe startup code

In reply to Marek Vasut

From: Richard Zhu <[email protected]>

- LTSSM shouldn't be set once in assert_core_reset
- Move peripheral reset just before LTSSM start

From: Richard Zhu <[email protected]>

Cc Bjorn Helgaas <[email protected]>
Cc Frank Li <[email protected]>
Cc Harro Haan <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Mohit KUMAR <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Sean Cross <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Siva Reddy Kallam <[email protected]>
Cc Srikanth T Shivanand <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Troy Kisky <[email protected]>
Cc Yinghai Lu <[email protected]>
---
 drivers/pci/host/pci-imx6.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/pci/host/pci-imx6.c +6 -9
index a945e74..7985272 100644
@@ -220,18 +220,9 @@ static int imx6_pcie_assert_core_reset(struct pcie_port *pp)
 
 	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
 			IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18);
-	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
-			IMX6Q_GPR12_PCIE_CTL_2, 1 << 10);
 	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
 			IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 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);
-		msleep(100);
-		gpio_set_value(imx6_pcie->reset_gpio, 1);
-	}
-
 	return 0;
 }
 
@@ -275,6 +266,12 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 	/* allow the clocks to stabilize */
 	usleep_range(200, 500);
 
+	/* Some boards don't have PCIe reset GPIO. */
+	if (gpio_is_valid(imx6_pcie->reset_gpio)) {
+		gpio_set_value(imx6_pcie->reset_gpio, 0);
+		msleep(100);
+		gpio_set_value(imx6_pcie->reset_gpio, 1);
+	}
 	return 0;
 
 err_pcie_axi:
Signature · 1 line
1.8.4.3
#6 lore raw

PATCH 7/7 ARM: dts: imx6q-sabrelite: Enable PCI express

In reply to Marek Vasut
Cc Bjorn Helgaas <[email protected]>
Cc Frank Li <[email protected]>
Cc Harro Haan <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Mohit KUMAR <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Sean Cross <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Siva Reddy Kallam <[email protected]>
Cc Srikanth T Shivanand <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Troy Kisky <[email protected]>
Cc Yinghai Lu <[email protected]>
---
 arch/arm/boot/dts/imx6q-sabrelite.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/imx6q-sabrelite.dts +4 -0
index f004913..0806ce7 100644
@@ -154,6 +154,10 @@
 	};
 };
 
+&pcie {
+	status = "okay";
+};
+
 &sata {
 	status = "okay";
 };
Signature · 1 line
1.8.4.3
maintainer
#7 lore raw

PATCH v2 1/7 PCI: imx6: Make reset-gpio optional

In reply to Marek Vasut
Quoted 20 lines · Marek Vasut

Some boards do not have a PCIe reset GPIO. To avoid probe failure on these boards, make the reset GPIO optional as well.

Cc Bjorn Helgaas <[email protected]>
Cc Frank Li <[email protected]>
Cc Harro Haan <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Mohit KUMAR <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Sean Cross <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Siva Reddy Kallam <[email protected]>
Cc Srikanth T Shivanand <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Troy Kisky <[email protected]>
Cc Yinghai Lu <[email protected]>
Quoted 4 lines
---
 .../devicetree/bindings/pci/designware-pcie.txt    |  2 ++
 drivers/pci/host/pci-imx6.c                        | 29 +++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)

Richard or Shawn, can you ack/nak these (patches 1-6)? I'd like to dispose of them one way or the other.

Quoted 67 lines

V2: Make the 'reset-gpio' prop shared between imx6 and exynos
Rebase on top of pci/host-imx6

Documentation/devicetree/bindings/pci/designware-pcie.txt +2 -0
index d5d26d4..d6fae13 100644
@@ -19,6 +19,8 @@ Required properties:
 	to define the mapping of the PCIe interface to interrupt
 	numbers.
 - num-lanes: number of lanes to use
+
+Optional properties:
 - reset-gpio: gpio pin number of power good signal
 
 Optional properties for fsl,imx6q-pcie
drivers/pci/host/pci-imx6.c +15 -14
index 9fc1cb6..c247602 100644
@@ -214,9 +214,12 @@ static int imx6_pcie_assert_core_reset(struct pcie_port *pp)
 	regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
 			IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 16);
 
-	gpio_set_value(imx6_pcie->reset_gpio, 0);
-	msleep(100);
-	gpio_set_value(imx6_pcie->reset_gpio, 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);
+		msleep(100);
+		gpio_set_value(imx6_pcie->reset_gpio, 1);
+	}
 
 	return 0;
 }
@@ -432,17 +435,15 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
 
 	/* Fetch GPIOs */
 	imx6_pcie->reset_gpio = of_get_named_gpio(np, "reset-gpio", 0);
-	if (!gpio_is_valid(imx6_pcie->reset_gpio)) {
-		dev_err(&pdev->dev, "no reset-gpio defined\n");
-		ret = -ENODEV;
-	}
-	ret = devm_gpio_request_one(&pdev->dev,
-				imx6_pcie->reset_gpio,
-				GPIOF_OUT_INIT_LOW,
-				"PCIe reset");
-	if (ret) {
-		dev_err(&pdev->dev, "unable to get reset gpio\n");
-		return ret;
+	if (gpio_is_valid(imx6_pcie->reset_gpio)) {
+		ret = devm_gpio_request_one(&pdev->dev,
+					imx6_pcie->reset_gpio,
+					GPIOF_OUT_INIT_LOW,
+					"PCIe reset");
+		if (ret) {
+			dev_err(&pdev->dev, "unable to get reset gpio\n");
+			return ret;
+		}
 	}
 
 	imx6_pcie->power_on_gpio = of_get_named_gpio(np, "power-on-gpio", 0);
Signature · 1 line
1.8.4.3
#8 lore raw

PATCH v2 1/7 PCI: imx6: Make reset-gpio optional

Quoted 26 lines · Bjorn Helgaas
Quoted 20 lines · Marek Vasut

Some boards do not have a PCIe reset GPIO. To avoid probe failure on these boards, make the reset GPIO optional as well.

Cc Bjorn Helgaas <[email protected]>
Cc Frank Li <[email protected]>
Cc Harro Haan <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Mohit KUMAR <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Sean Cross <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Siva Reddy Kallam <[email protected]>
Cc Srikanth T Shivanand <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Troy Kisky <[email protected]>
Cc Yinghai Lu <[email protected]>
Quoted 4 lines
---
 .../devicetree/bindings/pci/designware-pcie.txt    |  2 ++
 drivers/pci/host/pci-imx6.c                        | 29 +++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)
Quoted 2 lines

Richard or Shawn, can you ack/nak these (patches 1-6)? I'd like to dispose of them one way or the other.

maintainer
#9 lore raw

PATCH v2 1/7 PCI: imx6: Make reset-gpio optional

Quoted 27 lines · Shawn Guo
Quoted 26 lines · Bjorn Helgaas
Quoted 24 lines · Marek Vasut

Some boards do not have a PCIe reset GPIO. To avoid probe failure on these boards, make the reset GPIO optional as well.

Cc Bjorn Helgaas <[email protected]>
Cc Frank Li <[email protected]>
Cc Harro Haan <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Mohit KUMAR <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Sean Cross <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Siva Reddy Kallam <[email protected]>
Cc Srikanth T Shivanand <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Troy Kisky <[email protected]>
Cc Yinghai Lu <[email protected]>
---
 .../devicetree/bindings/pci/designware-pcie.txt    |  2 ++
 drivers/pci/host/pci-imx6.c                        | 29 +++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)
Quoted 4 lines
Quoted 2 lines

Richard or Shawn, can you ack/nak these (patches 1-6)? I'd like to dispose of them one way or the other.

I assume this ack applies to all the patches (1-6). I applied these
to my pci/host-imx6 branch for v3.14. Thanks!

Bjorn

#10 lore raw

PATCH v2 1/7 PCI: imx6: Make reset-gpio optional

In reply to Marek Vasut
Quoted 5 lines · Marek Vasut

Some boards do not have a PCIe reset GPIO. To avoid probe failure on these boards, make the reset GPIO optional as well.

Quoted 16 lines
Cc Bjorn Helgaas <[email protected]>
Cc Frank Li <[email protected]>
Cc Harro Haan <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Mohit KUMAR <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Richard Zhu <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Sean Cross <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Siva Reddy Kallam <[email protected]>
Cc Srikanth T Shivanand <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Troy Kisky <[email protected]>
Cc Yinghai Lu <[email protected]>

Best regards,
Jingoo Han

Quoted 4 lines
---
 .../devicetree/bindings/pci/designware-pcie.txt    |  2 ++
 drivers/pci/host/pci-imx6.c                        | 29 +++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)